- Conescan working now

- Removed old NETReadTillterm


SKIPPED:
	psi/libpsi.a
	psi/tasdriveo.c
This commit is contained in:
koennecke
2006-04-11 08:03:15 +00:00
parent da3dfd9d76
commit 38cfea4865
13 changed files with 230 additions and 124 deletions

39
cone.c
View File

@ -34,6 +34,7 @@ static void ConeSaveStatus(void *data, char *name, FILE *fd){
fprintf(fd,"%s center %d\n", name,self->center);
fprintf(fd,"%s target %f %f %f\n", name, self->target.h,
self->target.k, self->target.l);
fprintf(fd,"%s qscale %f \n", name, self->qScale);
}
/*=================== Drivable Interface ============================================================*/
static int ConeHalt(void *pData){
@ -89,12 +90,11 @@ static MATRIX makeCsToPsiMatrix(reflection center, double lambda){
static long ConeSetValue(void *pData, SConnection *pCon, float fVal){
pConeData self = NULL;
float fSet[4];
double openingAngle, length, testAngle;
MATRIX csToPsi = NULL, B = NULL, newScat = NULL, cent;
double openingAngle, length;
MATRIX csToPsi = NULL, B = NULL, newScat = NULL;
int status;
reflection center;
char buffer[131];
double z1[3];
if(!SCMatchRights(pCon,usUser)){
return 0;
@ -129,27 +129,13 @@ static long ConeSetValue(void *pData, SConnection *pCon, float fVal){
* calculate scattering vector on cone and make its length
* match the length of the apropriate scattering vector
*/
length = scatteringVectorLength(B,self->target);
length = scatteringVectorLength(B,self->target) * self->qScale;
newScat = calcConeVector(openingAngle, fVal, length, csToPsi);
if(newScat == NULL){
SCWrite(pCon,"ERROR: fails to calculate cone vector",eError);
return 0;
}
/**
* this is debugging code
*/
length = vectorLength(newScat);
z1FromAngles(self->ubi->hkl->fLambda,center.s2t,center.om,center.chi,
center.phi,z1);
cent = makeVectorInit(z1);
testAngle = angleBetween(cent,newScat);
snprintf(buffer,131,"OpeningAngle = %f, testAngle = %f, length = %f",
openingAngle,testAngle,length);
SCWrite(pCon,buffer,eWarning);
/*
* try to find setting angles for this vector
*/
@ -240,6 +226,7 @@ static pConeData MakeConeMot(pUBCALC u){
self->pDriv->GetValue = ConeGetValue;
self->ubi = u;
self->pHkl = u->hkl;
self->qScale = 1.0;
return self;
}
/*----------------------------------------------------------------------------------*/
@ -288,6 +275,19 @@ int ConeAction(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char
SCWrite(pCon,pBuffer,eValue);
return 1;
}
} else if(strcmp(argv[1],"qscale") == 0){
if(argc > 2){
if(!SCMatchRights(pCon,usUser)){
return 0;
}
self->qScale = atof(argv[2]);
SCSendOK(pCon);
return 1;
} else {
snprintf(pBuffer,131,"%s.qscale = %f", argv[0], self->qScale);
SCWrite(pCon,pBuffer,eValue);
return 1;
}
} else if (strcmp(argv[1],"target") == 0){
if(argc >= 5){
if(!SCMatchRights(pCon,usUser)){
@ -296,6 +296,7 @@ int ConeAction(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char
self->target.h = atof(argv[2]);
self->target.k = atof(argv[3]);
self->target.l = atof(argv[4]);
self->qScale = 1.;
SCSendOK(pCon);
return 1;
} else {