SICS-720 Add autofocussing on Taipan using the following energy relations,
Avfocus = 115 + 2.13 * Ef Mvfocus = 102.2 + 1.78 * Ei Ahfocus = 45.68 - (-105.7) * (0.945) ^ Ef Mhfocus = 184.42 - (60.1) * (0.951) ^ Ei NOTE: Parameters are set via tasub mono/ana VB1/VB2/HB1/HB2/HB3
This commit is contained in:
55
tasub.c
55
tasub.c
@ -173,6 +173,8 @@ static ptasUB MakeTasUB()
|
||||
pNew->actualEn = .0;
|
||||
pNew->outOfPlaneAllowed = 1;
|
||||
pNew->mustRecalculate = 1;
|
||||
pNew->autofocus = 0;
|
||||
pNew->focusfn = THETA_FN;
|
||||
|
||||
return pNew;
|
||||
}
|
||||
@ -381,6 +383,10 @@ int TasUBFactory(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
if (pNew->motors[MCV] != NULL && pNew->motors[MCH] != NULL &&
|
||||
pNew->motors[ACV] != NULL && pNew->motors[ACH] != NULL) {
|
||||
pNew->autofocus = 1;
|
||||
}
|
||||
|
||||
status = AddCommand(pSics, argv[1], TasUBWrapper, KillTasUB, pNew);
|
||||
if (status != 1) {
|
||||
@ -453,6 +459,11 @@ static int setCrystalParameters(pmaCrystal crystal, SConnection * pCon,
|
||||
SCSendOK(pCon);
|
||||
SCparChange(pCon);
|
||||
return 1;
|
||||
} else if (strcmp(argv[2], "hb3") == 0) {
|
||||
crystal->HB3 = d;
|
||||
SCSendOK(pCon);
|
||||
SCparChange(pCon);
|
||||
return 1;
|
||||
} else if (strcmp(argv[2], "vb1") == 0) {
|
||||
crystal->VB1 = d;
|
||||
SCSendOK(pCon);
|
||||
@ -493,6 +504,11 @@ static int getCrystalParameters(pmaCrystal crystal, SConnection * pCon,
|
||||
crystal->HB2);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else if (strcmp(argv[2], "hb3") == 0) {
|
||||
snprintf(pBueffel, 131, "%s.%s.hb3 = %f", argv[0], argv[1],
|
||||
crystal->HB3);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
} else if (strcmp(argv[2], "vb1") == 0) {
|
||||
snprintf(pBueffel, 131, "%s.%s.vb1 = %f", argv[0], argv[1],
|
||||
crystal->VB1);
|
||||
@ -2200,9 +2216,44 @@ int TasUBWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
} else if (strcmp(argv[1], "autofocus") == 0) {
|
||||
if (argc > 2) {
|
||||
status = Tcl_GetInt(InterpGetTcl(pSics), argv[2], &(self->autofocus));
|
||||
if (status != TCL_OK) {
|
||||
SCWrite(pCon, "ERROR: failed to convert argument to number",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
snprintf(pBueffel, 131, "%s.autofocus = %d", argv[0], self->autofocus);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
} else if (strcmp(argv[1], "focusfn") == 0) {
|
||||
if (argc > 2) {
|
||||
strtolower(argv[2]);
|
||||
if (strcmp(argv[2], "theta") == 0) {
|
||||
self->focusfn = THETA_FN;
|
||||
} else if (strcmp(argv[2], "energy") == 0) {
|
||||
self->focusfn = ENERGY_FN;
|
||||
} else {
|
||||
SCWrite(pCon, "ERROR: Arguments should be theta or energy", eError);
|
||||
}
|
||||
} else {
|
||||
switch (self->focusfn) {
|
||||
case ENERGY_FN:
|
||||
snprintf(pBueffel, 131, "%s.focusfn = %s", argv[0], "energy");
|
||||
break;
|
||||
case THETA_FN:
|
||||
snprintf(pBueffel, 131, "%s.focusfn = %s", argv[0], "theta");
|
||||
break;
|
||||
}
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
snprintf(pBueffel, 131, "ERROR: subcommand %s to %s not defined",
|
||||
argv[1], argv[0]);
|
||||
argv[1], argv[0]);
|
||||
SCWrite(pCon, pBueffel, eError);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user