aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorAlexandra Tolstikova <alexandra.tolstikova@desy.de>2017-11-16 13:46:23 +0100
committerThomas White <taw@physics.org>2018-09-10 15:01:10 +0200
commit17aec9c77e9b75510e43b0fb073df75f66849761 (patch)
tree0a9e0252b5c81ad6ad451f513a9a3834b582e10a /libcrystfel
parentec9f2c41c1f21968412eb4b7f57fda69ed6e37b1 (diff)
pattern_sim: read spectrum from file
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/image.h6
-rw-r--r--libcrystfel/src/utils.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index dffcdb3a..29ce8ae1 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -60,6 +60,7 @@ struct imagefile_field_list;
* @SPECTRUM_TOPHAT: A top hat distribution of wavelengths
* @SPECTRUM_SASE: A simulated SASE spectrum
* @SPECTRUM_TWOCOLOUR: A spectrum containing two peaks
+ * @SPECTRUM_FROMFILE: An arbitrary spectrum read from input file
*
* A %SpectrumType represents a type of X-ray energy spectrum to use for
* generating simulated data.
@@ -67,7 +68,8 @@ struct imagefile_field_list;
typedef enum {
SPECTRUM_TOPHAT,
SPECTRUM_SASE,
- SPECTRUM_TWOCOLOUR
+ SPECTRUM_TWOCOLOUR,
+ SPECTRUM_FROMFILE
} SpectrumType;
@@ -124,7 +126,7 @@ typedef struct _imagefeaturelist ImageFeatureList;
/* Structure describing a wavelength sample from a spectrum */
struct sample
{
- double k;
+ double k; /* 1/m */
double weight;
};
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index a759ff15..2c756ad7 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -185,6 +185,8 @@ static inline int within_tolerance(double a, double b, double percent)
/* Photon energy (eV) to wavelength (m) */
#define ph_eV_to_lambda(a) ph_en_to_lambda(eV_to_J(a))
+/* Photon energy (eV) to k (1/m) */
+#define ph_eV_to_k(a) ((a)*ELECTRON_CHARGE/PLANCK/C_VACUO)
/* ------------------------------ Message macros ---------------------------- */