- Fixes to hkl code

- Fixes to make RITA work
- tasub extended to calculate UB from cell alone, support for elastic mode
- New MultiCounter as abstraction for counting on HM's
- regression test driver for counters
This commit is contained in:
koennecke
2006-09-13 07:12:00 +00:00
parent 87d81cf474
commit cb3bf30bbf
33 changed files with 1961 additions and 671 deletions

87
hkl.c
View File

@ -61,7 +61,6 @@
fprintf(fd,"%s hm %d\n",name, self->iHM);
fprintf(fd,"%s scantolerance %f\n", name,self->scanTolerance);
fprintf(fd,"%s nb %d\n", name, self->iNOR);
fprintf(fd,"%s phiom %d\n", name, self->iOMPHI);
return 1;
}
@ -689,7 +688,7 @@ int hklInRange(void *data, float fSet[4], int mask[4])
fSet[0] = dTheta;
/* for omega check against the limits +- SCANBORDER in order to allow for
a omega scan
a omega scan.
*/
MotorGetPar(self->pOmega,"softlowerlim",&fLimit);
if((float)fSet[1] < fLimit + self->scanTolerance){
@ -721,7 +720,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
float fSet[4], double myPsi, int iRetry)
{
double stt, om, chi, phi, psi, ompsi, chipsi, phipsi;
int i, test;
int i, test, mask[4];
/*
just the plain angle calculation
@ -731,16 +730,31 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
return 0;
}
fSet[0] = stt;
fSet[1] = om;
fSet[2] = chi;
fSet[3] = phi;
if(iRetry == 1) {
rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
rotatePsi(om,chi,phi,myPsi,&ompsi,&chipsi,&phipsi);
fSet[1] = ompsi;
fSet[2] = circlify(chipsi);
fSet[3] = circlify(phipsi);
return 1;
} else {
return findAllowedBisecting(self->fLambda, z1, fSet, hklInRange,self);
if(hklInRange(self,fSet, mask) == 1){
return 1;
} else {
if(tryOmegaTweak(self,z1, &stt, &om, &chi, &phi) == 1){
fSet[0] = stt;
fSet[1] = om;
fSet[2] = chi;
fSet[3] = phi;
return 1;
} else {
return findAllowedBisecting(self->fLambda, z1, fSet, hklInRange,self);
}
}
}
}
/*-----------------------------------------------------------------------*/
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
@ -789,7 +803,11 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
if(checkNormalBeam(omnb, &gamma, nu,fSet,pCon,self)){
return 1;
} else {
return 0;
if(checkNormalBeam(360. - omnb, &gamma, nu, fSet,pCon,self)){
return 1;
} else {
return 0;
}
}
}
/*---------------------------------------------------------------------*/
@ -850,7 +868,7 @@ static int calculateNormalBeamOmega(MATRIX z1, pHKL self,
{
if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{
return 1;
return 1;
}
}
return 0;
@ -903,31 +921,7 @@ static int calculateNormalBeamOmega(MATRIX z1, pHKL self,
if(self->iNOR == 0)
{
status = calculateBisecting(z1,self,pCon,fSet, myPsi, iRetry);
/*
* Betrand mode: wrap phi rotation into omega
*/
if(self->iOMPHI > 0) {
if(ABS(fSet[2] - .0) < .1 || ABS(fSet[2] - 180.) < .1){
fSet[1] -= fSet[3];
/*
fSet[1] = 360. - fSet[3];
*/
fSet[3] = .0;
if(fSet[1] < 0.){
fSet[1] += 360.;
}
if(fSet[1] > 360.0){
fSet[1] -= 360.;
}
} else {
snprintf(pBueffel,511,
"ERROR: for omphi mode chi must be 0 or 180, is %f",
fSet[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
}
}
}
else if(self->iNOR == 1)
{
status = calculateNormalBeam(z1,self,pCon,fSet, myPsi, iRetry);
@ -1414,8 +1408,8 @@ ente:
if(strcmp(argv[1],"list") == 0 )
{
sprintf(pBueffel,
"lambda = %f Normal Beam = %d PHIOM = %d Quadrant = %d HM = %d",
self->fLambda, self->iNOR, self->iOMPHI,
"lambda = %f Normal Beam = %d Quadrant = %d HM = %d",
self->fLambda, self->iNOR,
self->iQuad,self->iHM);
SCWrite(pCon,pBueffel,eValue);
sprintf(pBueffel,"UB = { %f %f %f",
@ -1654,29 +1648,6 @@ ente:
SCSendOK(pCon);
return 1;
}
/*------------- phi omega mode (to be removed) */
else if(strcmp(argv[1],"phiom") == 0)
{
if(argc < 3)
{
snprintf(pBueffel,511,"%s.phiom = %d",argv[0],self->iOMPHI);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
if(!SCMatchRights(pCon,usUser))
{
return 0;
}
if(!isNumeric(argv[2]))
{
sprintf(pBueffel,"ERROR: %s was not recognized as a number", argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
self->iOMPHI = atoi(argv[2]);
SCSendOK(pCon);
return 1;
}
/*------------- quadrant */
else if(strcmp(argv[1],"quadrant") == 0)
{