aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/crystfel-mille.c26
-rw-r--r--libcrystfel/src/crystfel-mille.h3
-rw-r--r--libcrystfel/src/geometry.h3
-rw-r--r--src/adjust_detector.c33
4 files changed, 38 insertions, 27 deletions
diff --git a/libcrystfel/src/crystfel-mille.c b/libcrystfel/src/crystfel-mille.c
index 6bdcb51a..4230dadc 100644
--- a/libcrystfel/src/crystfel-mille.c
+++ b/libcrystfel/src/crystfel-mille.c
@@ -54,7 +54,7 @@ static const enum gparam rv[] =
};
-int mille_label(int hierarchy_level, int member_index, char param)
+int mille_label(int hierarchy_level, int member_index, enum gparam param)
{
int label;
@@ -62,12 +62,12 @@ int mille_label(int hierarchy_level, int member_index, char param)
label = 100000*hierarchy_level + 100*member_index;
switch ( param ) {
- case 'x' : return label+1; /* x-shift */
- case 'y' : return label+2; /* y-shift */
- case 'z' : return label+3; /* z-shift */
- case 'a' : return label+4; /* Rotation around x */
- case 'b' : return label+5; /* Rotation around y */
- case 'c' : return label+6; /* Rotation around z */
+ 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 */
default : abort();
}
}
@@ -116,15 +116,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, 'x');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DETX);
j++;
global_gradients[j] = -xl / (kpred+zl);
- labels[j] = mille_label(group->hierarchy_level, group->member_index, 'z');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_CLEN);
j++;
global_gradients[j] = -(ypk - group->cy);
- labels[j] = mille_label(group->hierarchy_level, group->member_index, 'c');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_ROTZ);
j++;
group = group->parent;
@@ -148,15 +148,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, 'y');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_DETY);
j++;
global_gradients[j] = -yl / (kpred+zl);
- labels[j] = mille_label(group->hierarchy_level, group->member_index, 'z');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_CLEN);
j++;
global_gradients[j] = xpk - group->cx;
- labels[j] = mille_label(group->hierarchy_level, group->member_index, 'c');
+ labels[j] = mille_label(group->hierarchy_level, group->member_index, GPARAM_ROTZ);
j++;
group = group->parent;
diff --git a/libcrystfel/src/crystfel-mille.h b/libcrystfel/src/crystfel-mille.h
index 7b4f84cf..696ee9e1 100644
--- a/libcrystfel/src/crystfel-mille.h
+++ b/libcrystfel/src/crystfel-mille.h
@@ -34,6 +34,7 @@ typedef void *Mille;
#include "cell.h"
#include "image.h"
#include "predict-refine.h"
+#include "geometry.h"
/**
* \file crystfel-mille.h
@@ -46,7 +47,7 @@ extern Mille *crystfel_mille_new(const char *outFileName,
extern void crystfel_mille_free(Mille *m);
-extern int mille_label(int hierarchy_level, int member_index, char param);
+extern int mille_label(int hierarchy_level, int member_index, enum gparam param);
extern void write_mille(Mille *mille, int n, UnitCell *cell,
struct reflpeak *rps, struct image *image,
diff --git a/libcrystfel/src/geometry.h b/libcrystfel/src/geometry.h
index 19c6a23a..21bd4d39 100644
--- a/libcrystfel/src/geometry.h
+++ b/libcrystfel/src/geometry.h
@@ -83,6 +83,9 @@ enum gparam {
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 */
};
diff --git a/src/adjust_detector.c b/src/adjust_detector.c
index 81c6ede9..c2b47a02 100644
--- a/src/adjust_detector.c
+++ b/src/adjust_detector.c
@@ -58,12 +58,12 @@ static void show_help(const char *s)
" -p, --panel=p Panel (or group) to move\n"
" --mm Interpret shifts as mm, not px\n"
"\n"
- " -a Rotation around x-axis (deg)\n"
- " -b Rotation around y-axis (deg)\n"
- " -c Rotation around z-axis (deg)\n"
- " -x Shift in x direction\n"
- " -y Shift in y direction\n"
- " -z Shift in z direction\n"
+ " --rotx Rotation around x-axis (deg)\n"
+ " --roty Rotation around y-axis (deg)\n"
+ " --rotz Rotation around z-axis (deg)\n"
+ " --shiftx Shift in x direction (px, see above)\n"
+ " --shifty Shift in y direction (px, see above)\n"
+ " --shiftz Shift in z direction (px, see above)\n"
"\n"
" -h, --help Display this help message\n"
" --version Print version number and exit\n");
@@ -114,11 +114,18 @@ int main(int argc, char *argv[])
{"panel", 1, NULL, 'p'},
{"mm", 0, NULL, 3},
+ {"shiftx", 1, NULL, 11},
+ {"shifty", 1, NULL, 12},
+ {"shiftz", 1, NULL, 13},
+ {"rotx", 1, NULL, 14},
+ {"roty", 1, NULL, 15},
+ {"rotz", 1, NULL, 16},
+
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hVo:g:i:l:p:x:y:z:a:b:c:",
+ while ((c = getopt_long(argc, argv, "hVo:g:i:l:p:",
longopts, NULL)) != -1)
{
@@ -151,27 +158,27 @@ int main(int argc, char *argv[])
mm = 1;
break;
- case 'x' :
+ case 11 :
x_shift = parse_double(optarg, 'x');
break;
- case 'y' :
+ case 12 :
y_shift = parse_double(optarg, 'y');
break;
- case 'z' :
+ case 13 :
z_shift = parse_double(optarg, 'z');
break;
- case 'a' :
+ case 14 :
x_rot = parse_double(optarg, 'a');
break;
- case 'b' :
+ case 15 :
y_rot = parse_double(optarg, 'b');
break;
- case 'c' :
+ case 16 :
z_rot = parse_double(optarg, 'c');
break;