aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-02-14 17:32:16 -0800
committerThomas White <taw@physics.org>2012-02-22 15:27:15 +0100
commitbe1244abae1dec8ff0e149552d22f0e7bff45334 (patch)
tree1c4251a2410aab2384ddbcbeb749e71c058e654f
parent66913c316206cd4970a4480ac7131a0077a9c752 (diff)
Accept wavelength in Angstrom
-rw-r--r--src/hdf5-file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index b54905df..06b59906 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -280,17 +280,25 @@ static double get_wavelength(struct hdfile *f)
herr_t r;
hid_t dh;
double lambda;
+ int nm = 1;
dh = H5Dopen(f->fh, "/LCLS/photon_wavelength_nm", H5P_DEFAULT);
- if ( dh < 0 ) return -1.0;
+ if ( dh < 0 ) {
+ dh = H5Dopen(f->fh, "/LCLS/photon_wavelength_A", H5P_DEFAULT);
+ if ( dh < 0 ) return -1.0;
+ nm = 0;
+
+ }
r = H5Dread(dh, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
H5P_DEFAULT, &lambda);
H5Dclose(dh);
+
if ( r < 0 ) return -1.0;
/* Convert nm -> m */
- return lambda / 1.0e9;
+ if ( nm ) return lambda / 1.0e9;
+ return lambda / 1.0e10;
}