- made fixes to hkl
- Introduced a help system - introduced a module for handling automatic updates of files during long measurements - Added a circular buffer and handling facilities to varlog - Upgraded documentation SKIPPED: psi/faverage.h psi/nxamor.tex psi/pimotor.h psi/pimotor.tex
This commit is contained in:
44
hkl.c
44
hkl.c
@ -18,6 +18,10 @@
|
||||
three detectors.
|
||||
|
||||
Mark Koennecke, May 2002
|
||||
|
||||
Added handling of the chi ==0 or chi == 180 degree case to tryTweakOmega
|
||||
|
||||
Mark Koennecke, December 2003
|
||||
-----------------------------------------------------------------------------*/
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
@ -35,6 +39,11 @@
|
||||
the space we leave in omega in order to allow for a scan to be done
|
||||
*/
|
||||
#define SCANBORDER 3.
|
||||
/*
|
||||
the tolerance in chi we give before we allow to fix omega with phi
|
||||
*/
|
||||
#define CHITOLERANCE 3.
|
||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int HKLSave(void *pData, char *name, FILE *fd)
|
||||
{
|
||||
@ -466,9 +475,22 @@ static int checkNormalBeam(double om, double *gamma, double nu,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*--------------------------------------------------------------------*/
|
||||
static int chiVertical(double chi){
|
||||
if(ABS(chi - .0) < CHITOLERANCE){
|
||||
return 1;
|
||||
}
|
||||
if(ABS(chi - 180.0) < CHITOLERANCE){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
tryOmegaTweak tries to calculate a psi angle in order to put an
|
||||
offending omega back into range.
|
||||
|
||||
This routine also handles the special case when chi ~ 0 or chi ~ 180.
|
||||
Then it is possible to fix a omega problem by turing in phi.
|
||||
-----------------------------------------------------------------------*/
|
||||
static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
|
||||
double *chi, double *phi){
|
||||
@ -506,6 +528,22 @@ static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
|
||||
omOffset = *om - omTarget;
|
||||
omOffset = -omOffset;
|
||||
|
||||
/*
|
||||
check for the special case of chi == 0 or chi == 180
|
||||
*/
|
||||
if(chiVertical(*chi)){
|
||||
dumstt = *stt;
|
||||
offom = omTarget;
|
||||
offchi = *chi;
|
||||
offphi = *phi - omOffset;
|
||||
if(checkBisecting(self,&dumstt,offom,offchi,offphi)){
|
||||
*om = offom;
|
||||
*chi = offchi;
|
||||
*phi = offphi;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
calculate angles with omega offset
|
||||
*/
|
||||
@ -622,8 +660,6 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
|
||||
float fSet[4], double myPsi, int iRetry)
|
||||
@ -1508,14 +1544,14 @@ ente:
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pBueffel," theta = %f, omega = %f, chi = %f, phi = %f",
|
||||
sprintf(pBueffel," 2-theta = %f, omega = %f, chi = %f, phi = %f",
|
||||
fSet[0], fSet[1], fSet[2],fSet[3]);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
}
|
||||
if(!iRet)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"WARNING: Settings violate motor limits or cannot be calculated",
|
||||
"WARNING: Cannot drive to the hkl of your desire",
|
||||
eWarning);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user