aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/hdf5-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/hdf5-file.c')
-rw-r--r--libcrystfel/src/hdf5-file.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 9a52fd4d..dc86d641 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -1390,8 +1390,10 @@ int hdfile_get_value(struct hdfile *f, const char *name,
}
-void fill_in_beam_parameters(struct beam_params *beam, struct hdfile *f,
- struct event *ev, struct image *image)
+static void hdfile_fill_in_beam_parameters(struct beam_params *beam,
+ struct hdfile *f,
+ struct event *ev,
+ struct image *image)
{
double eV;
@@ -1404,8 +1406,8 @@ void fill_in_beam_parameters(struct beam_params *beam, struct hdfile *f,
int r;
- r = hdfile_get_value(f, beam->photon_energy_from, ev, &eV,
- H5T_NATIVE_DOUBLE);
+ r = hdfile_get_value(f, beam->photon_energy_from,
+ ev, &eV, H5T_NATIVE_DOUBLE);
if ( r ) {
ERROR("Failed to read '%s'\n",
beam->photon_energy_from);
@@ -1417,6 +1419,36 @@ void fill_in_beam_parameters(struct beam_params *beam, struct hdfile *f,
}
+static void hdfile_fill_in_clen(struct detector *det, struct hdfile *f,
+ struct event *ev)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+
+ struct panel *p = &det->panels[i];
+
+ 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;
+ }
+
+ }
+
+ adjust_centering_for_rail(p);
+
+ }
+}
+
+
int hdf5_read(struct hdfile *f, struct image *image, const char *element,
int satcorr)
{
@@ -1481,7 +1513,7 @@ int hdf5_read(struct hdfile *f, struct image *image, const char *element,
if ( image->beam != NULL ) {
- fill_in_beam_parameters(image->beam, f, NULL, image);
+ hdfile_fill_in_beam_parameters(image->beam, f, NULL, image);
if ( image->lambda > 1000 ) {
/* Error message covers a silly value in the beam file
@@ -1885,13 +1917,13 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
H5Dclose(f->dh);
f->data_open = 0;
- fill_in_values(image->det, f, ev);
+ hdfile_fill_in_clen(image->det, f, ev);
if ( satcorr ) debodge_saturation(f, image);
if ( image->beam != NULL ) {
- fill_in_beam_parameters(image->beam, f, ev, image);
+ hdfile_fill_in_beam_parameters(image->beam, f, ev, image);
if ( (image->lambda > 1.0) || (image->lambda < 1e-20) ) {