aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5-file.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-05-25 17:32:52 +0200
committerThomas White <taw@physics.org>2010-05-25 17:32:52 +0200
commitfdd3cd4aac0e6f69ec6f6c030af466a5e12bd40c (patch)
tree0fa91c42419ea9396b6af085c78140dc58d1e6f9 /src/hdf5-file.c
parente4a0b2c4f00ad396abd3c5c7e8cb55e2f39bc2cc (diff)
Add gas detector value to output stream
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r--src/hdf5-file.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index d76f2bd4..d6d646ed 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -204,6 +204,24 @@ static double get_wavelength(struct hdfile *f)
}
+static double get_f0(struct hdfile *f)
+{
+ herr_t r;
+ hid_t dh;
+ double f0;
+
+ dh = H5Dopen(f->fh, "/LCLS/f_11_ENRC", H5P_DEFAULT);
+ if ( dh < 0 ) return -1.0;
+
+ r = H5Dread(dh, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, &f0);
+ H5Dclose(dh);
+ if ( r < 0 ) return -1.0;
+
+ return f0;
+}
+
+
static void debodge_saturation(struct hdfile *f, struct image *image)
{
hid_t dh, sh;
@@ -321,6 +339,12 @@ int hdf5_read(struct hdfile *f, struct image *image)
image->lambda = ph_en_to_lambda(eV_to_J(2000.0));
}
+ image->f0 = get_f0(f);
+ if ( image->f0 < 0.0 ) {
+ ERROR("Couldn't read incident intensity - using 1.0.\n");
+ image->f0 = 1.0;
+ }
+
debodge_saturation(f, image);
return 0;