libcrystfel 0.11.1
|
Data Structures | |
struct | gaussian |
Typedefs | |
typedef struct _spectrum | Spectrum |
Functions | |
Spectrum * | spectrum_new (void) |
void | spectrum_free (Spectrum *s) |
Spectrum * | spectrum_load (const char *filename) |
void | spectrum_set_gaussians (Spectrum *s, struct gaussian *gs, int n_gauss) |
int | spectrum_get_num_gaussians (Spectrum *s) |
struct gaussian | spectrum_get_gaussian (Spectrum *s, int n) |
void | spectrum_set_pdf (Spectrum *s, double *kcens, double *heights, int nbins) |
void | spectrum_get_range (Spectrum *s, double *kmin, double *kmax) |
double | spectrum_get_density_at_k (Spectrum *s, double k) |
Spectrum * | spectrum_generate_tophat (double wavelength, double bandwidth) |
Spectrum * | spectrum_generate_gaussian (double wavelength, double bandwidth) |
Spectrum * | spectrum_generate_sase (double wavelength, double bandwidth, double spike_width, gsl_rng *rng) |
Spectrum * | spectrum_generate_twocolour (double wavelength, double bandwidth, double separation) |
Data structure representing a radiation spectrum
typedef struct _spectrum Spectrum |
This data structure is opaque. You must use the available accessor functions to read and write its contents.
|
extern |
wavelength | Wavelength in metres |
bandwidth | Bandwidth as a fraction |
Generates a Gaussian spectrum centered on 'wavelength', where the standard deviation of the Gaussian is bandwidth divided by wavelength (bandwidth fraction times k value).
|
extern |
wavelength | Wavelength in metres |
bandwidth | Bandwidth as a fraction of wavelength |
spike_width | The width of the SASE spikes, as a fraction of wavelength |
rng | A GSL random number generator |
Generates a SASE spectrum centered on 'wavelength', with 15 spikes of width spike_width divided by wavelength (i.e. spike_width times k value). The spikes will be distributed within a width of k values of bandwidth divided by wavelength (bandwidth times k-value).
Note that CrystFEL is not an undulator simulation program. This function just simulates a rough idea of the kind of spiky spectrum resulting from the SASE process.
|
extern |
wavelength | Wavelength in metres |
bandwidth | Bandwidth as a fraction |
Generates a top-hat spectrum centered on 'wavelength', where the width of the flat top is bandwidth/wavelength
|
extern |
wavelength | Wavelength in metres |
bandwidth | Bandwidth as a fraction of wavelength |
separation | Separation between peak centres, in m^-1 |
Generates a two-colour spectrum with Gaussian peaks centered at wavenumbers 1/wavelength ± separation/2. Each peak will have a standard deviation of bandwidth divided by wavelength (bandwidth fraction times k value).
|
extern |
s | A Spectrum |
k | A wavenumber (in 1/metres) |
Retrieves the spectral density at wavenumber k
. This is a sample from a probability density function, so to calculate the "amount of intensity" from this, you'll need to multiply the value by a small width of k.
k
. s | A Spectrum |
n | The index number of the required Gaussian |
Returns The n-th
Gaussian in the spectrum. The Gaussians are returned in descending order of integrated intensity, indexed from zero.
If n
is greater than or equal to the number of Gaussians in the spectrum, or if the spectrum is not represented as Gaussians, the returned Gaussian will have zero area.
n-th
Gaussian.
|
extern |
s | A Spectrum |
s
is not currently represented as Gaussians.
|
extern |
s | A Spectrum |
kmin | Location to store minimum k value |
kmax | Location to store maximum k value |
Sets kmin
and kmax
to the range of k values in the spectrum. If the spectrum is represented as Gaussians, the range returned will be enough to contain at least 5 sigmas of all the Gaussians.
The values will be returned in units of 1/m.
|
extern |
filename | Filename for the input file |
Loads the spectrum from \s filename. Currently, only the ESRF spectrum file format is supported.
|
extern |
Create a new Spectrum.
Sets the spectrum in terms of a sum of Gaussians.
The spectral density function will be normalised, so only the relative areas under the curves are relevant.
The input array will be copied, so you can safely free it after calling this function.
|
extern |
s | A Spectrum |
kvals | Pointer to array of k values (in 1/m); |
heights | Pointer to array of spectral density samples |
n | Number of samples |
Sets the spectrum in terms of samples of the probability density function. The spectral density function will be normalised. The spectrum can have a non-zero value only for k values in the range [kmin,kmax] (exclusive interval), where kmin and kmax are the smallest and largest values in kvals
.
The input arrays will be copied, so you can safely free them after calling this function.