diff options
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/crystfel-mille.c | 28 | ||||
-rw-r--r-- | libcrystfel/src/predict-refine.c | 48 | ||||
-rw-r--r-- | libcrystfel/src/predict-refine.h | 21 |
3 files changed, 55 insertions, 42 deletions
diff --git a/libcrystfel/src/crystfel-mille.c b/libcrystfel/src/crystfel-mille.c index a16ade52..d4c75ef0 100644 --- a/libcrystfel/src/crystfel-mille.c +++ b/libcrystfel/src/crystfel-mille.c @@ -62,12 +62,12 @@ int mille_label(int hierarchy_level, int member_index, enum gparam param) label = 100000*hierarchy_level + 100*member_index; switch ( param ) { - case GPARAM_DETX : return label+1; /* x-shift */ - case GPARAM_DETY : return label+2; /* y-shift */ - case GPARAM_CLEN : return label+3; /* z-shift */ - case GPARAM_ROTX : return label+4; /* Rotation around x */ - case GPARAM_ROTY : return label+5; /* Rotation around y */ - case GPARAM_ROTZ : return label+6; /* Rotation around z */ + case GPARAM_DET_TX : return label+1; /* x-shift */ + case GPARAM_DET_TY : return label+2; /* y-shift */ + case GPARAM_DET_TZ : return label+3; /* z-shift */ + case GPARAM_DET_RX : return label+4; /* Rotation around x */ + case GPARAM_DET_RY : return label+5; /* Rotation around y */ + case GPARAM_DET_RZ : return label+6; /* Rotation around z */ default : abort(); } } @@ -111,15 +111,15 @@ void write_mille(Mille *mille, int n, UnitCell *cell, while ( group != NULL ) { global_gradients[j] = -1.0; - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DETX); + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_TX); j++; global_gradients[j] = -xl / (kpred+zl); - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_CLEN); + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_TZ); j++; - global_gradients[j] = -(ypk - group->cy); - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_ROTZ); + global_gradients[j] = 0.0; + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_RZ); j++; group = group->parent; @@ -143,15 +143,15 @@ void write_mille(Mille *mille, int n, UnitCell *cell, while ( group != NULL ) { global_gradients[j] = -1.0; - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DETY); + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_TY); j++; global_gradients[j] = -yl / (kpred+zl); - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_CLEN); + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_TZ); j++; - global_gradients[j] = xpk - group->cx; - labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_ROTZ); + global_gradients[j] = 0.0; + labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DET_RZ); j++; group = group->parent; diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index d600563a..d8547710 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -123,9 +123,13 @@ double r_gradient(UnitCell *cell, int k, Reflection *refl, struct image *image) case GPARAM_CSZ : return - ls * cos(phi); - case GPARAM_DETX : - case GPARAM_DETY : - case GPARAM_CLEN : + /* Detector movements don't affect excitation error */ + case GPARAM_DET_TX : + case GPARAM_DET_TY : + case GPARAM_DET_TZ : + case GPARAM_DET_RX : + case GPARAM_DET_RY : + case GPARAM_DET_RZ : return 0.0; } @@ -182,15 +186,24 @@ double fs_gradient(int param, Reflection *refl, UnitCell *cell, case GPARAM_CSZ : return -l * xl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl); - case GPARAM_DETX : - return -1; + case GPARAM_DET_TX : + return 0.0; - case GPARAM_DETY : - return 0; + case GPARAM_DET_TY : + return 0.0; - case GPARAM_CLEN : + case GPARAM_DET_TZ : return -xl / (kpred+zl); + case GPARAM_DET_RX : + return 0.0; + + case GPARAM_DET_RY : + return 0.0; + + case GPARAM_DET_RZ : + return -1; + default: ERROR("Positional gradient requested for parameter %i?\n", param); abort(); @@ -247,15 +260,24 @@ double ss_gradient(int param, Reflection *refl, UnitCell *cell, case GPARAM_CSZ : return -l * yl * p->cnz * p->pixel_pitch / (kpred*kpred + 2.0*kpred*zl + zl*zl); - case GPARAM_DETX : - return 0; + case GPARAM_DET_TX : + return 0.0; - case GPARAM_DETY : - return -1; + case GPARAM_DET_TY : + return 0.0; - case GPARAM_CLEN : + case GPARAM_DET_TZ : return -yl / (kpred+zl); + case GPARAM_DET_RX : + return 0.0; + + case GPARAM_DET_RY : + return 0.0; + + case GPARAM_DET_RZ : + return -1; + default : ERROR("Positional gradient requested for parameter %i?\n", param); abort(); diff --git a/libcrystfel/src/predict-refine.h b/libcrystfel/src/predict-refine.h index c667dc6d..8a2f6ef0 100644 --- a/libcrystfel/src/predict-refine.h +++ b/libcrystfel/src/predict-refine.h @@ -42,21 +42,12 @@ enum gparam { GPARAM_CSX, GPARAM_CSY, GPARAM_CSZ, - GPARAM_R, - GPARAM_DIV, - GPARAM_DETX, - GPARAM_DETY, - GPARAM_CLEN, - GPARAM_OSF, /* Linear scale factor */ - GPARAM_BFAC, /* D-W scale factor */ - GPARAM_ANG1, /* Out of plane rotation angles of crystal */ - GPARAM_ANG2, - GPARAM_WAVELENGTH, - GPARAM_ROTX, /* Detector panel rotation about +x */ - GPARAM_ROTY, /* Detector panel rotation about +y */ - GPARAM_ROTZ, /* Detector panel rotation about +z */ - - GPARAM_EOL /* End of list */ + GPARAM_DET_TX, + GPARAM_DET_TY, + GPARAM_DET_TZ, + GPARAM_DET_RX, /* Detector panel (group) rotation about +x */ + GPARAM_DET_RY, /* Detector panel (group) rotation about +y */ + GPARAM_DET_RZ, /* Detector panel (group) rotation about +z */ }; |