- 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

44
tasub.c
View File

@ -242,7 +242,7 @@ int TasUBFactory(SConnection *pCon,SicsInterp *pSics, void *pData,
return 0;
}
if(argc > 2 && argc < 14){
SCWrite(pCon,"ERROR: not enough motor names specified form MakeTasUB",eError);
SCWrite(pCon,"ERROR: not enough motor names specified for MakeTasUB",eError);
return 0;
}
pNew = MakeTasUB();
@ -414,7 +414,7 @@ static int getCrystalParameters(pmaCrystal crystal, SConnection *pCon,
SCWrite(pCon,pBueffel,eValue);
return 1;
}else if(strcmp(argv[2],"vb2") == 0){
snprintf(pBueffel,131,"%s.%s.vb2 = %f",argv[0],argv[1],crystal->VB1);
snprintf(pBueffel,131,"%s.%s.vb2 = %f",argv[0],argv[1],crystal->VB2);
SCWrite(pCon,pBueffel,eValue);
return 1;
}else if(strcmp(argv[2],"ss") == 0){
@ -952,6 +952,44 @@ static int calcUB(ptasUB self, SConnection *pCon, SicsInterp *pSics,
SCparChange(pCon);
return 1;
}
/*-----------------------------------------------------------------*/
static int calcUBFromCell(ptasUB self, SConnection *pCon){
MATRIX B, U, UB;
int status;
B = mat_creat(3,3,UNIT_MATRIX);
U = mat_creat(3,3,UNIT_MATRIX);
if(B == NULL || U == NULL){
SCWrite(pCon,"ERROR: out of memory in calcUBFromCell",eError);
return 0;
}
status = calculateBMatrix(self->cell,B);
if(status == REC_NO_VOLUME){
SCWrite(pCon,"ERROR: cell has no volume",eError);
return 0;
}
UB = mat_mul(U,B);
if(UB == NULL){
SCWrite(pCon,"ERROR: matrix multiplication failed",eError);
return 0;
}
if(mat_det(UB) < .000001){
SCWrite(pCon,"ERROR: invalid UB matrix, check reflections",eError);
return 0;
}
if(self->machine.UB != NULL){
mat_free(self->machine.UB);
}
self->machine.UB = UB;
self->machine.planeNormal[0][0] = .0;
self->machine.planeNormal[1][0] = .0;
self->machine.planeNormal[2][0] = 1.;
self->ubValid = 1;
SCparChange(pCon);
mat_free(U);
mat_free(B);
return 1;
}
/*------------------------------------------------------------------*/
static int calcRefAngles(ptasUB self, SConnection *pCon,
SicsInterp *pSics,
@ -1421,6 +1459,8 @@ int TasUBWrapper(SConnection *pCon,SicsInterp *pSics, void *pData,
return 1;
} else if(strcmp(argv[1],"makeub") == 0){
return calcUB(self,pCon,pSics,argc,argv);
} else if(strcmp(argv[1],"makeubfromcell") == 0){
return calcUBFromCell(self,pCon);
} else if(strcmp(argv[1],"calcang") == 0){
return calcRefAngles(self,pCon,pSics,argc,argv);
} else if(strcmp(argv[1],"calcqe") == 0){