diff options
author | Thomas White <taw@physics.org> | 2014-09-24 16:41:59 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-09-24 16:41:59 +0200 |
commit | f92b47bcd85ff06c386119153270b22d532c897c (patch) | |
tree | ce7269ae5ca02b86a798b30bdb7df0a99787a221 | |
parent | e3bb47c737988d277aebc240e517ae52819ad895 (diff) |
Remove bandwidth, divergence and profile radius from struct beam_params
-rw-r--r-- | libcrystfel/src/image.h | 4 | ||||
-rw-r--r-- | src/partial_sim.c | 50 | ||||
-rw-r--r-- | src/pattern_sim.c | 30 | ||||
-rw-r--r-- | tests/gpu_sim_check.c | 19 |
4 files changed, 38 insertions, 65 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index bc78147e..6589ac1a 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -104,10 +104,6 @@ struct beam_params 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. */ - double divergence; /* divergence (radians) */ - - double profile_radius; /* Reciprocal space size of a reflection */ }; diff --git a/src/partial_sim.c b/src/partial_sim.c index 8d8bc885..10f5e58d 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -263,6 +263,7 @@ struct queue_args double full_stddev; double noise_stddev; double background; + double profile_radius; struct image *template_image; double max_q; @@ -338,7 +339,7 @@ static void run_job(void *vwargs, int cookie) } while ( osf <= 0.0 ); crystal_set_osf(cr, osf); crystal_set_mosaicity(cr, 0.0); - crystal_set_profile_radius(cr, wargs->image.beam->profile_radius); + crystal_set_profile_radius(cr, qargs->profile_radius); /* Set up a random orientation */ orientation = random_quaternion(qargs->rngs[cookie]); @@ -429,27 +430,24 @@ int main(int argc, char *argv[]) struct queue_args qargs; struct image image; int n_threads = 1; - double cnoise = 0.0; char *rval; int i; FILE *fh; char *phist_file = NULL; - double osf_stddev = 2.0; - double full_stddev = 1000.0; - double noise_stddev = 20.0; - double background = 3000.0; gsl_rng *rng_for_seeds; int config_random = 0; char *image_prefix = NULL; - /* Default beam parameters */ - beam.divergence = 0.001; - beam.bandwidth = 0.01; - beam.profile_radius = 0.001e9; - beam.photon_energy = 9000.0; - - /* Beam parameters which it doesn't make sense to use here */ - beam.photon_energy_scale = 1.0; + /* Default simulation parameters */ + double divergence = 0.001; + double bandwidth = 0.01; + double profile_radius = 0.001e9; + double photon_energy = 9000.0; + double osf_stddev = 2.0; + double full_stddev = 1000.0; + double noise_stddev = 20.0; + double background = 3000.0; + double cnoise = 0.0; /* Long options */ const struct option longopts[] = { @@ -594,48 +592,48 @@ int main(int argc, char *argv[]) break; case 8 : - beam.divergence = strtod(optarg, &rval); + divergence = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid beam divergence.\n"); return 1; } - if ( beam.divergence < 0.0 ) { + if ( divergence < 0.0 ) { ERROR("Beam divergence must be positive.\n"); return 1; } break; case 9 : - beam.bandwidth = strtod(optarg, &rval); + bandwidth = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid beam bandwidth.\n"); return 1; } - if ( beam.bandwidth < 0.0 ) { + if ( bandwidth < 0.0 ) { ERROR("Beam bandwidth must be positive.\n"); return 1; } break; case 10 : - beam.profile_radius = strtod(optarg, &rval); + profile_radius = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid profile radius.\n"); return 1; } - if ( beam.divergence < 0.0 ) { + if ( divergence < 0.0 ) { ERROR("Profile radius must be positive.\n"); return 1; } break; case 11 : - beam.photon_energy = strtod(optarg, &rval); + photon_energy = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid photon energy.\n"); return 1; } - if ( beam.photon_energy < 0.0 ) { + if ( photon_energy < 0.0 ) { ERROR("Photon energy must be positive.\n"); return 1; } @@ -745,10 +743,9 @@ int main(int argc, char *argv[]) image.width = det->max_fs + 1; image.height = det->max_ss + 1; - image.lambda = ph_en_to_lambda(eV_to_J(beam.photon_energy)); - image.div = beam.divergence; - image.bw = beam.bandwidth; - image.beam = &beam; + image.lambda = ph_en_to_lambda(eV_to_J(photon_energy)); + image.div = divergence; + image.bw = bandwidth; image.filename = "dummy.h5"; image.copyme = NULL; image.crystals = NULL; @@ -780,6 +777,7 @@ int main(int argc, char *argv[]) qargs.background = background; qargs.max_q = largest_q(&image); qargs.image_prefix = image_prefix; + qargs.profile_radius = profile_radius; qargs.rngs = malloc(n_threads * sizeof(gsl_rng *)); if ( qargs.rngs == NULL ) { diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 20a96d84..0410da21 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -269,18 +269,10 @@ int main(int argc, char *argv[]) char *template_file = NULL; Stream *st = NULL; int no_fringes = 0; - struct beam_params beam; double nphotons = 1e12; double beam_radius = 1e-6; /* metres */ - - /* Default beam parameters */ - beam.bandwidth = 0.01; - beam.profile_radius = 0.001e9; - beam.photon_energy = 9000.0; - - /* Beam parameters which it doesn't make sense to use here */ - beam.photon_energy_scale = 1.0; - beam.divergence = -1.0; /* (not implemented .. yet?) */ + double bandwidth = 0.01; + double photon_energy = 9000.0; /* Long options */ const struct option longopts[] = { @@ -423,24 +415,24 @@ int main(int argc, char *argv[]) break; case 7 : - beam.bandwidth = strtod(optarg, &rval); + bandwidth = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid beam bandwidth.\n"); return 1; } - if ( beam.bandwidth < 0.0 ) { + if ( bandwidth < 0.0 ) { ERROR("Beam bandwidth must be positive.\n"); return 1; } break; case 9 : - beam.photon_energy = strtod(optarg, &rval); + photon_energy = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid photon energy.\n"); return 1; } - if ( beam.photon_energy < 0.0 ) { + if ( photon_energy < 0.0 ) { ERROR("Photon energy must be positive.\n"); return 1; } @@ -615,16 +607,10 @@ int main(int argc, char *argv[]) /* Define image parameters */ image.width = image.det->max_fs + 1; image.height = image.det->max_ss + 1; - if ( image.beam->photon_energy_from != NULL ) { - ERROR("Photon energy must be specified, not taken from the" - " HDF5 file. Please alter %s accordingly.\n", beamfile) - return 1; - } - double wl = ph_en_to_lambda(eV_to_J(beam.photon_energy)); + double wl = ph_en_to_lambda(eV_to_J(photon_energy)); image.lambda = wl; - image.bw = beam.bandwidth; - image.div = beam.divergence; + image.bw = bandwidth; image.nsamples = nsamples; free(beamfile); diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c index a829d1db..677999ab 100644 --- a/tests/gpu_sim_check.c +++ b/tests/gpu_sim_check.c @@ -80,7 +80,6 @@ int main(int argc, char *argv[]) UnitCell *cell; UnitCell *cell_raw; struct detector *det; - struct beam_params *beam; int i; double gpu_min, gpu_max, gpu_tot; double cpu_min, cpu_max, cpu_tot; @@ -150,18 +149,13 @@ int main(int argc, char *argv[]) cpu_image.det = det; gpu_image.det = det; + cpu_image.beam = NULL; + gpu_image.beam = NULL; - beam = calloc(1, sizeof(struct beam_params)); - beam->photon_energy = 6000.0; - beam->bandwidth = 1.0 / 100.0; - beam->divergence = 0.0; - cpu_image.beam = beam; - gpu_image.beam = beam; - - cpu_image.lambda = ph_en_to_lambda(eV_to_J(beam->photon_energy)); - gpu_image.lambda = ph_en_to_lambda(eV_to_J(beam->photon_energy)); - cpu_image.bw = beam->bandwidth; - gpu_image.bw = beam->bandwidth; + cpu_image.lambda = ph_en_to_lambda(eV_to_J(6000)); + gpu_image.lambda = ph_en_to_lambda(eV_to_J(6000)); + cpu_image.bw = 1.0 / 100.0; + gpu_image.bw = 1.0 / 100.0; cpu_image.nsamples = 10; gpu_image.nsamples = 10; @@ -210,7 +204,6 @@ int main(int argc, char *argv[]) cell_free(cell); free_detector_geometry(det); - free(beam); if ( perc > 1.0 ) { |