aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/crystfel-mille.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-07-13 17:18:54 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:05 +0200
commitb1089d5a0b75fb1dc66a6d8384d5e3ff1d0d7d78 (patch)
tree2233e60d39abd2d0dc80654b3dc4f38ce6472107 /libcrystfel/src/crystfel-mille.c
parent2501aedda111feaf139f9d8e94c4ab36926e93e3 (diff)
Re-define geometry group labelling scheme
The old version was totally broken. The serial numbers have to contain the complete hierarchy information, otherwise they aren't unique.
Diffstat (limited to 'libcrystfel/src/crystfel-mille.c')
-rw-r--r--libcrystfel/src/crystfel-mille.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/libcrystfel/src/crystfel-mille.c b/libcrystfel/src/crystfel-mille.c
index 139f2e9e..974ecf27 100644
--- a/libcrystfel/src/crystfel-mille.c
+++ b/libcrystfel/src/crystfel-mille.c
@@ -54,20 +54,15 @@ static const enum gparam rv[] =
};
-int mille_label(int hierarchy_level, int member_index, enum gparam param)
+int mille_label(int group_serial, enum gparam param)
{
- int label;
-
- assert(member_index < 1000);
-
- label = 100000*hierarchy_level + 100*member_index;
switch ( param ) {
- 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 */
+ case GPARAM_DET_TX : return group_serial+1; /* x-shift */
+ case GPARAM_DET_TY : return group_serial+2; /* y-shift */
+ case GPARAM_DET_TZ : return group_serial+3; /* z-shift */
+ case GPARAM_DET_RX : return group_serial+4; /* Rotation around x */
+ case GPARAM_DET_RY : return group_serial+5; /* Rotation around y */
+ case GPARAM_DET_RZ : return group_serial+6; /* Rotation around z */
default : abort();
}
}
@@ -112,9 +107,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], 0, 0, 0,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_TX);
+ labels[j] = mille_label(group->serial, GPARAM_DET_TX);
j++;
fs_ss_gradient(GPARAM_DET_TY, rps[i].refl, cell,
@@ -122,9 +115,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], 0, 0, 0,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_TY);
+ labels[j] = mille_label(group->serial, GPARAM_DET_TY);
j++;
fs_ss_gradient(GPARAM_DET_TZ, rps[i].refl, cell,
@@ -132,9 +123,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], 0, 0, 0,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_TZ);
+ labels[j] = mille_label(group->serial, GPARAM_DET_TZ);
j++;
fs_ss_gradient(GPARAM_DET_RX, rps[i].refl, cell,
@@ -142,9 +131,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], cx, cy, cz,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_RX);
+ labels[j] = mille_label(group->serial, GPARAM_DET_RX);
j++;
fs_ss_gradient(GPARAM_DET_RY, rps[i].refl, cell,
@@ -152,9 +139,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], cx, cy, cz,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_RX);
+ labels[j] = mille_label(group->serial, GPARAM_DET_RY);
j++;
fs_ss_gradient(GPARAM_DET_RZ, rps[i].refl, cell,
@@ -162,9 +147,7 @@ void write_mille(Mille *mille, int n, UnitCell *cell,
Minvs[rps[i].peak->pn], cx, cy, cz,
&global_gradients_fs[j],
&global_gradients_ss[j]);
- labels[j] = mille_label(group->hierarchy_level,
- group->member_index,
- GPARAM_DET_RZ);
+ labels[j] = mille_label(group->serial, GPARAM_DET_RZ);
j++;
group = group->parent;