diff options
author | Thomas White <taw@physics.org> | 2017-05-05 13:42:54 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-05-05 16:45:05 +0200 |
commit | 9104fb61c53f7d7d8fcb32627a7f87c2062ef496 (patch) | |
tree | 89dcb0b3892a78c8a09cbd33fdf2b97b7f3913ee /libcrystfel/src/detector.c | |
parent | bb552aba7ac926bfae331b5648abd8647ba1d9f5 (diff) |
Fill in photon energy, clen and adu for CBFs
This needed a bit of reorganisation and clarification of who is
repsonsible for loading what. The low-level file loaders, e.g.
hdf5_read and hdf5_read2 in hdf5-file.c or cbf_read in image.c, are
responsible. There is a helper function adjust_centering_for_rail in
detector.h which they can use.
It seems like this could be done more cleanly at the imagefile layer.
However, we need to make sure that the "old" hdfile API still works on
its own, even when not accessed via the new imagefile API.
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r-- | libcrystfel/src/detector.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index b2e3cc58..e3b351ff 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -528,37 +528,15 @@ int panel_number(struct detector *det, struct panel *p) } -void fill_in_values(struct detector *det, struct hdfile *f, struct event* ev) +void adjust_centering_for_rail(struct panel *p) { - int i; - - for ( i=0; i<det->n_panels; i++ ) { - - double offs; - struct panel *p = &det->panels[i]; + double offs; - if ( p->clen_from != NULL ) { - - double val; - int r; - - r = hdfile_get_value(f, p->clen_from, ev, &val, - H5T_NATIVE_DOUBLE); - if ( r ) { - ERROR("Failed to read '%s'\n", p->clen_from); - } else { - p->clen = val * 1.0e-3; - } - - } - - /* Offset in +z direction from calibrated clen to actual */ - offs = p->clen - p->clen_for_centering; - p->cnx += p->rail_x * offs; - p->cny += p->rail_y * offs; - p->clen = p->clen_for_centering + p->coffset + p->rail_z * offs; - - } + /* Offset in +z direction from calibrated clen to actual */ + offs = p->clen - p->clen_for_centering; + p->cnx += p->rail_x * offs; + p->cny += p->rail_y * offs; + p->clen = p->clen_for_centering + p->coffset + p->rail_z * offs; } @@ -1076,10 +1054,8 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam, } else if ( strcmp(key, "photon_energy") == 0 ) { if ( beam != NULL ) { - double v; char *end; - v = strtod(val, &end); if ( (val[0] != '\0') && (end[0] == '\0') ) { beam->photon_energy = v; |