Update from PSI

r1039 | ffr | 2006-08-03 09:59:29 +1000 (Thu, 03 Aug 2006) | 2 lines
This commit is contained in:
Ferdi Franceschini
2006-08-03 09:59:29 +10:00
committed by Douglas Clowes
parent 4aa50787c2
commit 074f1cb3cd
63 changed files with 1431 additions and 286 deletions

View File

@@ -32,6 +32,7 @@
#include "nxscript.h"
#include "fourtable.h"
#include "lld.h"
#include "stdscan.h"
extern void SNXFormatTime(char *pBueffel, int iLen);
extern float nintf(float f);
@@ -65,6 +66,7 @@
int iLogFile; /* log file num at connection */
SConnection *pCon; /* log file owning connection */
char *pCurrentFile; /* current file root */
char headerTemplate[512];
int iCount; /* count of reflection */
int CountMode; /* timer or preset */
int np; /* number of scan points */
@@ -146,7 +148,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
pMesure CreateMesure(pHKL pCryst, pScanData pScanner, pMotor pOmega,
char *pOm, pMotor p2Theta, char *p2t,
char *pFileRoot,
pDataNumber pDanu)
pDataNumber pDanu, char *hdTemplate)
{
pMesure pNew = NULL;
@@ -197,7 +199,8 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
pNew->lCounts = (long *)malloc(90*sizeof(long));
#endif
pNew->lCounts = (long *)malloc(50*sizeof(long));
pNew->stepTable = MakeFourCircleTable();
pNew->stepTable = MakeFourCircleTable();
strncpy(pNew->headerTemplate,hdTemplate,511);
return pNew;
}
/*------------------------------------------------------------------------*/
@@ -249,7 +252,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
/* check no of parameters
inicom name hkl scan omega root danu
*/
if(argc < 8)
if(argc < 9)
{
SCWrite(pCon,
"ERROR: Insufficient number of parameters to MesureFactory",eError);
@@ -336,7 +339,7 @@ static void ListMesure(pMesure self, char *name, SConnection *pCon)
/* finally create the thing */
pNew = CreateMesure(pCryst,pScan,pMot,argv[4], pMot2, argv[5],
argv[6],pDanu);
argv[6],pDanu,argv[8]);
if(!pNew)
{
SCWrite(pCon,"ERROR: no memory in MesureFactory",eError);
@@ -759,7 +762,7 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
char *pFile = NULL, *pPtr;
float zero, pos;
pMotor pMot = NULL;
FILE *temp = NULL;
assert(self);
assert(pCon);
@@ -813,6 +816,19 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
SCSetInterrupt(pCon,eAbortBatch);
return 0;
}
temp = fopen(self->headerTemplate,"r");
if(temp == NULL)
{
SCWrite(pCon,"ERROR: failed to open header template",eError);
}
if(temp != NULL && self->fRefl != NULL)
{
WriteTemplate(self->fRefl, temp, pFilename, NULL,
pCon, pServ->pSics);
fclose(temp);
}
/* open hkl-data file */
strcpy(pFilename,pRoot);
@@ -855,59 +871,6 @@ static int ScanReflection(pMesure self, float twoTheta, SConnection *pCon)
sprintf(pBuff,"user = %s",pVar->text);
strcat(pBueffel,pBuff);
}
fprintf(self->fRefl,"%s\n",pBueffel);
fprintf(self->fRefl,"lambda = %f Angstroem\n",fVal);
fprintf(self->fRefl,
"UB = %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f %7.6f\n",
fUB[0], fUB[1],fUB[2],fUB[3],fUB[4],fUB[5],fUB[6],fUB[7],fUB[8]);
/*
* zero points for Juerg
*/
pBueffel[0] = '\0';
if(self->pCryst->pTheta != NULL){
MotorGetPar(self->pCryst->pTheta,"softzero",&zero);
snprintf(pBuff,131,"stt.zero = %f ", zero);
strcat(pBueffel,pBuff);
}
if(self->pCryst->pOmega != NULL){
MotorGetPar(self->pCryst->pOmega,"softzero",&zero);
snprintf(pBuff,131,"om.zero = %f ", zero);
strcat(pBueffel,pBuff);
}
if(self->pCryst->pChi != NULL){
MotorGetPar(self->pCryst->pChi,"softzero",&zero);
snprintf(pBuff,131,"chi.zero = %f ", zero);
strcat(pBueffel,pBuff);
}
if(self->pCryst->pPhi != NULL){
MotorGetPar(self->pCryst->pPhi,"softzero",&zero);
snprintf(pBuff,131,"phi.zero = %f ", zero);
strcat(pBueffel,pBuff);
}
fprintf(self->fRefl,"%s\n",pBueffel);
/*
* CEX motors ....
*/
pBueffel[0] = '\0';
pMot = FindCommandData(pServ->pSics,"cex1","Motor");
if(pMot != NULL){
MotorGetSoftPosition(pMot,pCon,&pos);
snprintf(pBuff,131,"cex1 = %f ",pos);
strcat(pBueffel,pBuff);
}
pMot = FindCommandData(pServ->pSics,"cex2","Motor");
if(pMot != NULL){
MotorGetSoftPosition(pMot,pCon,&pos);
snprintf(pBuff,131,"cex2 = %f ",pos);
strcat(pBueffel,pBuff);
}
if(strlen(pBueffel) > 1) {
fprintf(self->fRefl,"%s\n",pBueffel);
}
return 1;
}
/*---------------------------------------------------------------------------*/