- Added polarisation support for TAS

This commit is contained in:
cvs
2002-04-03 15:32:26 +00:00
parent a5346ddedc
commit 0ce72deb58
17 changed files with 557 additions and 89 deletions

View File

@@ -233,12 +233,29 @@ static int TASHeader(pScanData self)
pTAS->tasPar[BY]->fVal,
pTAS->tasPar[BZ]->fVal);
/*
write currents if in polarisation mode
*/
if(pTAS->iPOL >= 0){
fprintf(self->fd,"VARIA: ");
iCount = 0;
for(i = MAXMOT-8; i < MAXMOT;i++)
{
fVal = readCurrent(tasMotorOrder[i],self->pCon);
strcpy(pWork2,tasMotorOrder[i]);
strtoupper(pWork2);
fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal);
iCount++;
}
fprintf(self->fd,"\n");
}
/*
write motors
*/
fprintf(self->fd,"VARIA: ");
iCount = 0;
for(i = 0; i < MAXMOT;i++)
for(i = 0; i < MAXMOT-8;i++)
{
pMot = FindMotor(self->pSics, tasMotorOrder[i]);
if(pMot)
@@ -273,7 +290,7 @@ static int TASHeader(pScanData self)
*/
fprintf(self->fd,"ZEROS: ");
iCount = 0;
for(i = 0; i < MAXMOT;i++)
for(i = 0; i < MAXMOT-8;i++)
{
pMot = FindMotor(self->pSics, tasMotorOrder[i]);
if(pMot)
@@ -338,8 +355,13 @@ static int TASHeader(pScanData self)
build both the format and the data header line,
start with the scan variables
*/
strcpy(pBueffel,"FORMT: (I4,1X,");
strcpy(pHeader," PNT");
if(pTAS->iPOL >=0 ){
strcpy(pBueffel,"FORMT: (I4,I4,");
strcpy(pHeader," PNT PAL");
} else {
strcpy(pBueffel,"FORMT: (I4,1X,");
strcpy(pHeader," PNT");
}
for(i = 0; i < self->iScanVar; i++)
{
DynarGet(self->pScanVar,i,&pPtr);
@@ -409,6 +431,14 @@ static int TASScanPoint(pScanData self, int iPoint)
long m1, m2, m3, cnts;
char pBueffel[1024], pWork[80];
/*
after polarisation analysis, this has to be ignored as it is called
another time from the ScanLoop
*/
if(pTAS->iIgnore){
return 1;
}
/*
reopen file for appending
*/
@@ -424,7 +454,7 @@ static int TASScanPoint(pScanData self, int iPoint)
*/
if(pTAS->iPOL > 0)
{
sprintf(pBueffel,"%3d.%1d",iPoint+1,pTAS->iPOL);
sprintf(pBueffel,"%3d %3d",iPoint+1,pTAS->iPOL);
}
else
{
@@ -610,8 +640,39 @@ static int TASScanDrive(pScanData self, int iPoint)
------------------------------------------------------------------------*/
static int RunPolScan(pScanData self, int iPoint)
{
SCWrite(self->pCon,"ERROR: polarized scans not yet implemented",eError);
return 0;
FILE *fd = NULL;
char buffer[132];
pTASdata pTAS = (pTASdata)self->pSpecial;
fd = fopen(pTAS->tasPar[POLFIL]->text,"r");
if(!fd){
SCWrite(self->pCon,"ERROR: failed to open polarisation analysis file",
eError);
return 0;
}
pTAS->iPOL = 0;
while(fgets(buffer,131,fd) != NULL){
/*
ignore all errors here
*/
InterpExecute(self->pSics,self->pCon,buffer);
strtolower(buffer);
if(strstr(buffer,"co") != NULL){
pTAS->iPOL++;
self->WriteScanPoints(self,iPoint);
}
/*
but allow for interrupts
*/
if(SCGetInterrupt(self->pCon) != eContinue){
break;
}
}
pTAS->iIgnore = 1;
fclose(fd);
pTAS->iPOL = 1;
return 1;
}
/*---------------------------------------------------------------------------
TASScanCount starts the counter for a TAS scan or runs the polarization
@@ -624,6 +685,7 @@ static int TASScanCount(pScanData self, int iPoint)
int status, iRet;
Status eOld;
pTAS->iIgnore = 0;
/*
call the polarisation scan function if necessary
*/
@@ -1290,6 +1352,7 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
*/
ClearScanVar(pTAS->pScan);
pTAS->scanVar[0] = '\0';
/*
at this stage all simple variables have been set. Now we get the values
@@ -1302,6 +1365,15 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
pTAS->pScan->pCon = pCon;
pTAS->pScan->pSics = pSics;
/*
check for polarisation
*/
if(pTAS->tasPar[LPA]->iVal == 1){
pTAS->iPOL = 1;
} else {
pTAS->iPOL = -1;
}
/*
now parse the scan variables
*/