diff options
author | Thomas White <taw@physics.org> | 2014-08-12 13:37:25 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-08-12 13:37:25 +0200 |
commit | 1a18ec0d0a4d6ffe90f5e9e4243fa23b871a6875 (patch) | |
tree | ba66a546479948d7fb9ac41ce2714117dfba68bd | |
parent | a82278dbdd8311c46676b0921c423934208ec81a (diff) |
Add beam/photon_energy_scale
-rw-r--r-- | doc/man/crystfel_geometry.5 | 5 | ||||
-rw-r--r-- | libcrystfel/src/beam-parameters.c | 12 | ||||
-rw-r--r-- | libcrystfel/src/beam-parameters.h | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5 index ce06181a..963cff19 100644 --- a/doc/man/crystfel_geometry.5 +++ b/doc/man/crystfel_geometry.5 @@ -200,6 +200,11 @@ The radius of X-ray beam, in metres. The photon energy in electron-Volts, or an HDF5 path to a stored wavelength value, also in eV. .PD 0 +.IP \fBbeam/photon_energy_scale\fR +.PD +Scaling factor for the photon energy, used if the photon energy itself is taken from the HDF5 file. This can be useful to correct old data sets which have systematically wrong energies. + +.PD 0 .IP \fBbeam/bandwidth\fR .PD Bandwidth: FWHM(wavelength) over wavelength. Note: current simulation code just uses a rectangular distribution with this as its (full) width. diff --git a/libcrystfel/src/beam-parameters.c b/libcrystfel/src/beam-parameters.c index 617f9061..4b9941ac 100644 --- a/libcrystfel/src/beam-parameters.c +++ b/libcrystfel/src/beam-parameters.c @@ -3,12 +3,12 @@ * * Beam parameters * - * Copyright © 2012 Deutsches Elektronen-Synchrotron DESY, - * a research centre of the Helmholtz Association. + * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * a research centre of the Helmholtz Association. * * Authors: - * 2010,2012 Thomas White <taw@physics.org> - * 2012 Chunhong Yoon + * 2010,2012,2014 Thomas White <taw@physics.org> + * 2012 Chunhong Yoon * * This file is part of CrystFEL. * @@ -55,6 +55,7 @@ struct beam_params *get_beam_parameters(const char *filename) b->fluence = -1.0; b->beam_radius = -1.0; b->photon_energy = -1.0; + b->photon_energy_scale = 1.0; b->bandwidth = -1.0; b->divergence = -1.0; b->profile_radius = -1.0; @@ -94,6 +95,8 @@ struct beam_params *get_beam_parameters(const char *filename) } else { b->photon_energy = atof(bits[2]); } + } else if ( strcmp(bits[0], "beam/photon_energy_scale") == 0 ) { + b->photon_energy_scale = atof(bits[2]); } else if ( strcmp(bits[0], "beam/bandwidth") == 0 ) { b->bandwidth = atof(bits[2]); } else if ( strcmp(bits[0], "beam/divergence") == 0 ) { @@ -161,5 +164,6 @@ void fill_in_beam_parameters(struct beam_params *beam, struct hdfile *f) { if ( beam->photon_energy_from != NULL ) { beam->photon_energy = get_value(f, beam->photon_energy_from); + beam->photon_energy *= beam->photon_energy_scale; } } diff --git a/libcrystfel/src/beam-parameters.h b/libcrystfel/src/beam-parameters.h index bc3708d9..e4085a0b 100644 --- a/libcrystfel/src/beam-parameters.h +++ b/libcrystfel/src/beam-parameters.h @@ -3,11 +3,11 @@ * * Beam parameters * - * Copyright © 2013-2013 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2013-2014 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: - * 2010,2012-2013 Thomas White <taw@physics.org> + * 2010,2012-2014 Thomas White <taw@physics.org> * 2012 Chunhong Yoon * * This file is part of CrystFEL. @@ -44,6 +44,8 @@ struct beam_params double beam_radius; /* metres */ double photon_energy; /* eV per photon */ char *photon_energy_from; /* HDF5 dataset name */ + double photon_energy_scale; /* Scale factor for photon energy, if the + * energy is to be from the HDF5 file */ double bandwidth; /* FWHM(wavelength) over wavelength. * Note: current simulation code just uses * a rectangular distribution with this as |