diff options
author | Thomas White <taw@physics.org> | 2024-05-06 17:22:39 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-05-06 17:22:39 +0200 |
commit | 741ca70b8fae1ca560fa84b7a533efbd7f2ba1de (patch) | |
tree | c3c980789ad150b94dbd56755daa2ffa84848806 /libcrystfel | |
parent | c7a602f5d1e1109e341f25bad264a11f2beec9b3 (diff) |
Previously, there was a bad bug here. We would still try to write a
top-level coffset even if panels have moved such that the coffset is no
longer a single value.
One possibility is to unset panel->cnz_offset_default when moving a
panel. This works, but we have to do it on every translation, or accept
a floating-point comparison with zero and associated non-determinism.
It's very likely that if we move one panel, we'll be moving all panels,
even if only by a small amount. So, a more stable way seems to just
write separate coffset values all the time. The coffset values aren't
really meant to be used at the top level anyway (that's what clen is
for!), so this fits pretty well.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 12 | ||||
-rw-r--r-- | libcrystfel/src/datatemplate_priv.h | 1 |
2 files changed, 1 insertions, 12 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index 2f5763a8..94c894cb 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -591,7 +591,6 @@ static int parse_field_for_panel(struct panel_template *panel, const char *key, } else if ( strcmp(key, "coffset") == 0) { panel->cnz_offset = atof(val); - panel->cnz_offset_default = def; } else if ( strcmp(key, "res") == 0 ) { panel->pixel_pitch = 1.0/atof(val); panel->pixel_pitch_default = def; @@ -1067,7 +1066,6 @@ DataTemplate *data_template_new_from_string(const char *string_in) defaults.cnx = NAN; defaults.cny = NAN; defaults.cnz_offset = 0.0; - defaults.cnz_offset_default = 1; defaults.pixel_pitch = -1.0; defaults.pixel_pitch_default = 1; defaults.bad = 0; @@ -2403,7 +2401,6 @@ int data_template_write_to_fh(const DataTemplate *dtempl, FILE *fh) } /* Other top-levels */ - int cnz_offset_done = 0; int mask_done[MAX_MASKS] = {0}; int satmap_done = 0; int satmap_file_done = 0; @@ -2419,11 +2416,6 @@ int data_template_write_to_fh(const DataTemplate *dtempl, FILE *fh) const struct panel_template *p = &dtempl->panels[i]; int j; - if ( p->cnz_offset_default && !cnz_offset_done ) { - fprintf(fh, "coffset = %f\n", p->cnz_offset); - cnz_offset_done = 1; - } - for ( j=0; j<MAX_MASKS; j++ ) { if ( p->masks[j].data_location == NULL ) continue; if ( !p->masks[j].mask_default ) continue; @@ -2561,9 +2553,7 @@ int data_template_write_to_fh(const DataTemplate *dtempl, FILE *fh) fprintf(fh, "%s/ss = %fx %+fy %+fz\n", p->name, p->ssx, p->ssy, p->ssz); - if ( !p->cnz_offset_default ) { - fprintf(fh, "%s/coffset = %f\n", p->name, p->cnz_offset); - } + fprintf(fh, "%s/coffset = %f\n", p->name, p->cnz_offset); for ( j=0; j<MAX_MASKS; j++ ) { if ( p->masks[j].data_location == NULL ) continue; diff --git a/libcrystfel/src/datatemplate_priv.h b/libcrystfel/src/datatemplate_priv.h index ab40ac2f..26ee91ed 100644 --- a/libcrystfel/src/datatemplate_priv.h +++ b/libcrystfel/src/datatemplate_priv.h @@ -130,7 +130,6 @@ struct panel_template /** The offset to be applied from clen */ double cnz_offset; - int cnz_offset_default; /** Mask definitions */ struct mask_template masks[MAX_MASKS]; |