aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hdf5-file.c24
-rw-r--r--src/image.h3
-rw-r--r--src/peaks.c2
3 files changed, 29 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;
diff --git a/src/image.h b/src/image.h
index 4ba9e5f9..0479debc 100644
--- a/src/image.h
+++ b/src/image.h
@@ -85,6 +85,9 @@ struct image {
/* Wavelength must always be given */
double lambda; /* Wavelength in m */
+ /* Incident intensity (if unknown, put 1.0) */
+ double f0;
+
int width;
int height;
diff --git a/src/peaks.c b/src/peaks.c
index af17ba73..27e12910 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -482,6 +482,8 @@ void output_intensities(struct image *image, UnitCell *cell,
printf("cstar = %+9.7f %+9.7f %+9.7f nm^-1\n",
csx/1e9, csy/1e9, csz/1e9);
+ printf("f0 = %7.5f (arbitrary gas detector units)\n", image->f0);
+
for ( i=0; i<n_hits; i++ ) {
float x, y, intensity;