From 1a18ec0d0a4d6ffe90f5e9e4243fa23b871a6875 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 12 Aug 2014 13:37:25 +0200 Subject: Add beam/photon_energy_scale --- libcrystfel/src/beam-parameters.c | 12 ++++++++---- libcrystfel/src/beam-parameters.h | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'libcrystfel') 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 - * 2012 Chunhong Yoon + * 2010,2012,2014 Thomas White + * 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 + * 2010,2012-2014 Thomas White * 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 -- cgit v1.2.3