aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-09-22 18:06:07 +0200
committerThomas White <taw@physics.org>2014-09-22 18:06:07 +0200
commit0a5a04cc90619a1973c91489c71585ce127df045 (patch)
treec1903fc77534cd97840330b914b98b7b1187bce0 /src
parent142e1ad4e0fad73d223c67a842dfb9728a3bf34c (diff)
Beam file removal, part I
Diffstat (limited to 'src')
-rw-r--r--src/diffraction-gpu.c1
-rw-r--r--src/diffraction.c12
-rw-r--r--src/dw-hdfsee.c6
-rw-r--r--src/dw-hdfsee.h3
-rw-r--r--src/get_hkl.c14
-rw-r--r--src/hdfsee.c20
-rw-r--r--src/im-sandbox.c1
-rw-r--r--src/indexamajig.c41
-rw-r--r--src/partial_sim.c110
-rw-r--r--src/pattern_sim.c89
-rw-r--r--src/process_image.c1
11 files changed, 174 insertions, 124 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index f031e07f..e31d7b0f 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -49,7 +49,6 @@
#include "cell.h"
#include "diffraction.h"
#include "cl-utils.h"
-#include "beam-parameters.h"
#include "pattern_sim.h"
diff --git a/src/diffraction.c b/src/diffraction.c
index 261761a0..1fb63ea3 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -41,7 +41,6 @@
#include "utils.h"
#include "cell.h"
#include "diffraction.h"
-#include "beam-parameters.h"
#include "symmetry.h"
#include "pattern_sim.h"
@@ -566,9 +565,10 @@ struct sample *generate_SASE(struct image *image, gsl_rng *rng)
eV_cen = gaussian_noise(rng, ph_lambda_to_eV(image->lambda),
jitter_sigma_eV);
- /* Convert FWHM to standard deviation. Note that bandwidth is taken to
- * be "delta E over E" (E = photon energy), not the bandwidth in terms
- * of wavelength, but the difference should be very small */
+ /* Convert FWHM to standard deviation. Note that bandwidth is taken
+ * here to be "delta E over E" (E = photon energy), not the bandwidth in
+ * terms of wavelength (as it is everywhere else), but the difference
+ * should be very small */
double sigma = (image->bw*eV_cen) / (2.0*sqrt(2.0*log(2.0)));
/* The spectrum will be calculated to a resolution which spreads six
@@ -613,6 +613,10 @@ struct sample *generate_twocolour(struct image *image)
eV_cen = ph_lambda_to_eV(image->lambda);
+ /* Convert FWHM to standard deviation. Note that bandwidth is taken
+ * here to be "delta E over E" (E = photon energy), not the bandwidth in
+ * terms of wavelength (as it is everywhere else), but the difference
+ * should be very small */
double halfwidth = eV_cen*image->bw/2.0; /* eV */
eV_cen1 = eV_cen - halfwidth;
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 6b49d3f7..03509c75 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -2383,7 +2383,7 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks,
int noisefilter, int calibmode, int colscale,
const char *element,
struct detector *det_geom,
- const char *beam,
+ struct beam_params *beam,
int show_rings, double *ring_radii,
int n_rings, double ring_size,
int median_filter)
@@ -2429,10 +2429,6 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks,
dw->curr_event = 0;
dw->ev_list = NULL;
- if ( beam != NULL ) {
- dw->image->beam = get_beam_parameters(beam);
- }
-
dw->image->det = det_geom;
dw->hdfile = hdfile_open(filename);
diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h
index b3521702..fc16594d 100644
--- a/src/dw-hdfsee.h
+++ b/src/dw-hdfsee.h
@@ -143,7 +143,8 @@ extern DisplayWindow *displaywindow_open(char *filename,
int noisefilter, int calibmode,
int colscale, const char *element,
struct detector *det_geom,
- const char *beam, int show_rings,
+ struct beam_params *beam,
+ int show_rings,
double *ring_radii, int n_rings,
double ring_size, int median_filter);
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 72b73041..52798a89 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -42,7 +42,6 @@
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
-#include "beam-parameters.h"
#include "cell.h"
#include "cell-utils.h"
@@ -411,8 +410,6 @@ int main(int argc, char *argv[])
char *input_file = NULL;
char *template = NULL;
char *output = NULL;
- char *beamfile = NULL;
- struct beam_params *beam = NULL;
RefList *input;
double adu_per_photon = 0.0;
int have_adu_per_photon = 0;
@@ -448,7 +445,7 @@ int main(int argc, char *argv[])
};
/* Short options */
- while ((c = getopt_long(argc, argv, "ht:o:i:w:y:e:b:p:",
+ while ((c = getopt_long(argc, argv, "ht:o:i:w:y:e:p:",
longopts, NULL)) != -1) {
switch (c) {
@@ -553,15 +550,6 @@ int main(int argc, char *argv[])
return 1;
}
- if ( beamfile != NULL ) {
- beam = get_beam_parameters(beamfile);
- if ( beam == NULL ) {
- ERROR("Failed to load beam parameters from '%s'\n",
- beamfile);
- return 1;
- }
- }
-
if ( holo_str != NULL ) {
holo = get_pointgroup(holo_str);
free(holo_str);
diff --git a/src/hdfsee.c b/src/hdfsee.c
index 8ae55f9c..4961c7b0 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -81,7 +81,6 @@ static void show_help(const char *s)
" -g, --geometry=<filename> Use geometry from file for display.\n"
" (When this option is used, the value of\n"
" of the -e parameter is ignored)"
-" -m, --beam=<filename> Get beam parameters from <filename>.\n"
"\n");
}
@@ -126,13 +125,13 @@ int main(int argc, char *argv[])
int colscale = SCALE_COLOUR;
char *cscale = NULL;
char *element = NULL;
- char *beam = NULL;
double ring_size = 5.0;
char *reslist = NULL;
double ring_radii[128];
int n_rings = -1;
int median_filter = 0;
struct detector *det_geom = NULL;
+ struct beam_params beam;
/* Long options */
const struct option longopts[] = {
@@ -145,7 +144,6 @@ int main(int argc, char *argv[])
{"colscale", 1, NULL, 'c'},
{"image", 1, NULL, 'e'},
{"geometry", 1, NULL, 'g'},
- {"beam", 1, NULL, 'm'},
{"show-rings", 0, &config_showrings, 1},
{"ring-size", 1, NULL, 2},
{"simple-rings", 1, NULL, 'r'},
@@ -210,16 +208,12 @@ int main(int argc, char *argv[])
break;
case 'g' :
- det_geom = get_detector_geometry(optarg);
+ det_geom = get_detector_geometry(optarg, &beam);
if ( det_geom == NULL ) {
- ERROR("Failed to read detector geometry from "
- "'%s'\n", optarg);
- return 1;
- }
- break;
-
- case 'm' :
- beam = strdup(optarg);
+ ERROR("Failed to read detector geometry from '%s'\n",
+ optarg);
+ return 1;
+ }
break;
case 2 :
@@ -298,7 +292,7 @@ int main(int argc, char *argv[])
config_noisefilter,
config_calibmode,
colscale, element,
- det_geom, beam,
+ det_geom, &beam,
config_showrings,
ring_radii,
n_rings,
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index e7a6e283..75c2624e 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -486,7 +486,6 @@ static void run_work(const struct index_args *iargs,
free(iargs->indm);
free(iargs->ipriv);
free_detector_geometry(iargs->det);
- free_beam_parameters(iargs->beam);
free(iargs->element);
free(iargs->hdf5_peak_path);
free_copy_hdf5_field_list(iargs->copyme);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ff4b2243..b139f299 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -62,7 +62,6 @@
#include "detector.h"
#include "filters.h"
#include "thread-pool.h"
-#include "beam-parameters.h"
#include "geometry.h"
#include "stream.h"
#include "reflist-utils.h"
@@ -90,9 +89,6 @@ static void show_help(const char *s)
" methods separated by commas.\n"
" See 'man indexamajig' for details.\n"
" -g. --geometry=<file> Get detector geometry from file.\n"
-" -b, --beam=<file> Get beam parameters from file (provides nominal\n"
-" wavelength value if no per-shot value is found in\n"
-" the HDF5 files.\n"
" -p, --pdb=<file> File (PDB or CrystFEL unit cell format) from which\n"
" to get the unit cell. Default: 'molecule.pdb'.\n"
" --basename Remove the directory parts of the filenames.\n"
@@ -199,6 +195,7 @@ int main(int argc, char *argv[])
char *tempdir = NULL;
char *int_diag = NULL;
char *geom_filename = NULL;
+ struct beam_params beam;
/* Defaults */
iargs.cell = NULL;
@@ -215,7 +212,7 @@ int main(int argc, char *argv[])
iargs.check_hdf5_snr = 0;
iargs.det = NULL;
iargs.peaks = PEAK_ZAEF;
- iargs.beam = NULL;
+ iargs.beam = &beam;
iargs.element = NULL;
iargs.hdf5_peak_path = strdup("/processing/hitfinder/peakinfo");
iargs.copyme = NULL;
@@ -250,7 +247,6 @@ int main(int argc, char *argv[])
{"output", 1, NULL, 'o'},
{"indexing", 1, NULL, 'z'},
{"geometry", 1, NULL, 'g'},
- {"beam", 1, NULL, 'b'},
{"pdb", 1, NULL, 'p'},
{"prefix", 1, NULL, 'x'},
{"threshold", 1, NULL, 't'},
@@ -300,7 +296,7 @@ int main(int argc, char *argv[])
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hi:o:z:p:x:j:g:t:b:e:",
+ while ((c = getopt_long(argc, argv, "hi:o:z:p:x:j:g:t:e:v",
longopts, NULL)) != -1)
{
switch (c) {
@@ -309,7 +305,7 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
- case 99 :
+ case 'v' :
printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
printf(CRYSTFEL_BOILERPLATE"\n");
return 0;
@@ -340,27 +336,12 @@ int main(int argc, char *argv[])
case 'g' :
geom_filename = optarg;
- iargs.det = get_detector_geometry(optarg);
- if ( iargs.det == NULL ) {
- ERROR("Failed to read detector geometry from "
- "'%s'\n", optarg);
- return 1;
- }
break;
case 't' :
iargs.threshold = strtof(optarg, NULL);
break;
- case 'b' :
- iargs.beam = get_beam_parameters(optarg);
- if ( iargs.beam == NULL ) {
- ERROR("Failed to load beam parameters"
- " from '%s'\n", optarg);
- return 1;
- }
- break;
-
case 'e' :
iargs.element = strdup(optarg);
break;
@@ -514,6 +495,12 @@ int main(int argc, char *argv[])
return 1;
}
+ iargs.det = get_detector_geometry(geom_filename, iargs.beam);
+ if ( iargs.det == NULL ) {
+ ERROR("Failed to read detector geometry from '%s'\n", optarg);
+ return 1;
+ }
+
if ( indm_str == NULL ) {
STATUS("You didn't specify an indexing method, so I won't try "
@@ -598,12 +585,6 @@ int main(int argc, char *argv[])
return 1;
}
- if ( iargs.beam == NULL ) {
- ERROR("You need to provide a beam parameters file (please read"
- " the manual for more details).\n");
- return 1;
- }
-
add_geom_beam_stuff_to_copy_hdf5(iargs.copyme, iargs.det, iargs.beam);
if ( cellfile != NULL ) {
@@ -678,7 +659,7 @@ int main(int argc, char *argv[])
/* Prepare the indexer */
if ( indm != NULL ) {
ipriv = prepare_indexing(indm, iargs.cell, iargs.det,
- iargs.beam, iargs.tols);
+ iargs.tols);
if ( ipriv == NULL ) {
ERROR("Failed to prepare indexing.\n");
return 1;
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 47d8766e..32c5bb01 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -47,7 +47,6 @@
#include "utils.h"
#include "reflist-utils.h"
#include "symmetry.h"
-#include "beam-parameters.h"
#include "geometry.h"
#include "stream.h"
#include "thread-pool.h"
@@ -225,7 +224,6 @@ static void show_help(const char *s)
" -o, --output=<file> Write partials in stream format to <file>.\n"
" --images=<prefix> Write images to <prefix>NNN.h5.\n"
" -g. --geometry=<file> Get detector geometry from file.\n"
-" -b, --beam=<file> Get beam parameters from file\n"
" -p, --pdb=<file> PDB file from which to get the unit cell.\n"
"\n"
" -y, --symmetry=<sym> Symmetry of the input reflection list.\n"
@@ -238,6 +236,11 @@ static void show_help(const char *s)
" generated full intensities, if not using -i.\n"
" --noise-stddev=<val> Set the standard deviation of the noise.\n"
" --background=<val> Background level in photons. Default 3000.\n"
+" --beam-divergence Beam divergence in radians. Default 1 mrad.\n"
+" --beam-bandwidth Beam bandwidth as a fraction. Default 1%%.\n"
+" --profile-radius Reciprocal space reflection profile radius in m^-1.\n"
+" Default 0.001e9 m^-1\n"
+" --photon-energy Photon energy in eV. Default 9000.\n"
"\n"
);
}
@@ -411,11 +414,10 @@ int main(int argc, char *argv[])
int c;
char *input_file = NULL;
char *output_file = NULL;
- char *beamfile = NULL;
char *geomfile = NULL;
char *cellfile = NULL;
struct detector *det = NULL;
- struct beam_params *beam = NULL;
+ struct beam_params beam;
RefList *full = NULL;
char *sym_str = NULL;
SymOpList *sym;
@@ -440,13 +442,23 @@ int main(int argc, char *argv[])
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.fluence = -1.0;
+ beam.beam_radius = -1.0;
+ beam.photon_energy_scale = 1.0;
+
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
- {"version", 0, NULL, 8 },
+ {"version", 0, NULL, 'v'},
{"output", 1, NULL, 'o'},
{"input", 1, NULL, 'i'},
- {"beam", 1, NULL, 'b'},
{"pdb", 1, NULL, 'p'},
{"geometry", 1, NULL, 'g'},
{"symmetry", 1, NULL, 'y'},
@@ -459,6 +471,10 @@ int main(int argc, char *argv[])
{"noise-stddev", 1, NULL, 5},
{"images", 1, NULL, 6},
{"background", 1, NULL, 7},
+ {"beam-divergence", 1, NULL, 8},
+ {"beam-bandwidth", 1, NULL, 9},
+ {"profile-radius", 1, NULL, 10},
+ {"photon-energy", 1, NULL, 11},
{"really-random", 0, &config_random, 1},
@@ -466,7 +482,7 @@ int main(int argc, char *argv[])
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hi:o:b:p:g:y:n:r:j:c:",
+ while ((c = getopt_long(argc, argv, "hi:o:p:g:y:n:r:j:c:v",
longopts, NULL)) != -1)
{
switch (c) {
@@ -475,7 +491,7 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
- case 8 :
+ case 'v' :
printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
printf(CRYSTFEL_BOILERPLATE"\n");
return 0;
@@ -488,10 +504,6 @@ int main(int argc, char *argv[])
output_file = strdup(optarg);
break;
- case 'b' :
- beamfile = strdup(optarg);
- break;
-
case 'p' :
cellfile = strdup(optarg);
break;
@@ -578,8 +590,55 @@ int main(int argc, char *argv[])
return 1;
}
if ( background < 0.0 ) {
- ERROR("Invalid background level.");
- ERROR(" (must be positive).\n");
+ ERROR("Background level must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 8 :
+ beam.divergence = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid beam divergence.\n");
+ return 1;
+ }
+ if ( beam.divergence < 0.0 ) {
+ ERROR("Beam divergence must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 9 :
+ beam.bandwidth = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid beam bandwidth.\n");
+ return 1;
+ }
+ if ( beam.bandwidth < 0.0 ) {
+ ERROR("Beam bandwidth must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 10 :
+ beam.profile_radius = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid profile radius.\n");
+ return 1;
+ }
+ if ( beam.divergence < 0.0 ) {
+ ERROR("Profile radius must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 11 :
+ beam.photon_energy = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid photon energy.\n");
+ return 1;
+ }
+ if ( beam.photon_energy < 0.0 ) {
+ ERROR("Photon energy must be positive.\n");
return 1;
}
break;
@@ -607,18 +666,6 @@ int main(int argc, char *argv[])
return 1;
}
- /* Load beam */
- if ( beamfile == NULL ) {
- ERROR("You need to provide a beam parameters file.\n");
- return 1;
- }
- beam = get_beam_parameters(beamfile);
- if ( beam == NULL ) {
- ERROR("Failed to load beam parameters from '%s'\n", beamfile);
- return 1;
- }
- free(beamfile);
-
/* Load cell */
if ( cellfile == NULL ) {
ERROR("You need to give a PDB file with the unit cell.\n");
@@ -642,7 +689,7 @@ int main(int argc, char *argv[])
ERROR("You need to give a geometry file.\n");
return 1;
}
- det = get_detector_geometry(geomfile);
+ det = get_detector_geometry(geomfile, &beam);
if ( det == NULL ) {
ERROR("Failed to read geometry from '%s'\n", geomfile);
return 1;
@@ -700,10 +747,10 @@ 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(beam.photon_energy));
+ image.div = beam.divergence;
+ image.bw = beam.bandwidth;
+ image.beam = &beam;
image.filename = "dummy.h5";
image.copyme = NULL;
image.crystals = NULL;
@@ -842,7 +889,6 @@ int main(int argc, char *argv[])
close_stream(stream);
cell_free(cell);
free_detector_geometry(det);
- free(beam);
free_symoplist(sym);
reflist_free(full);
free(save_file);
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 8e048b4e..f1892876 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -51,7 +51,6 @@
#include "hdf5-file.h"
#include "detector.h"
#include "peaks.h"
-#include "beam-parameters.h"
#include "symmetry.h"
#include "reflist.h"
#include "reflist-utils.h"
@@ -76,7 +75,6 @@ static void show_help(const char *s)
" --gpu-dev=<n> Use GPU device <n>. Omit this option to see the\n"
" available devices.\n"
" -g, --geometry=<file> Get detector geometry from file.\n"
-" -b, --beam=<file> Get beam parameters from file.\n"
" -n, --number=<N> Generate N images. Default 1.\n"
" --no-images Do not output any HDF5 files.\n"
" -o, --output=<filename> Output HDF5 filename. Default: sim.h5.\n"
@@ -96,6 +94,11 @@ static void show_help(const char *s)
" --background=<N> Add N photons of Poisson background (default 0).\n"
" --template=<file> Take orientations from stream <file>.\n"
" --no-fringes Exclude the side maxima of Bragg peaks.\n"
+" --beam-divergence Beam divergence in radians. Default 1 mrad.\n"
+" --beam-bandwidth Beam bandwidth as a fraction. Default 1%%.\n"
+" --profile-radius Reciprocal space reflection profile radius in m^-1.\n"
+" Default 0.001e9 m^-1\n"
+" --photon-energy Photon energy in eV. Default 9000.\n"
);
}
@@ -266,11 +269,23 @@ int main(int argc, char *argv[])
char *template_file = NULL;
Stream *st = NULL;
int no_fringes = 0;
+ struct beam_params beam;
+
+ /* 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.fluence = -1.0;
+ beam.beam_radius = -1.0;
+ beam.photon_energy_scale = 1.0;
+ beam.divergence = -1.0; /* (not implemented .. yet?) */
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
- {"version", 0, NULL, 7 },
+ {"version", 0, NULL, 'v'},
{"gpu", 0, &config_gpu, 1},
{"random-orientation", 0, NULL, 'r'},
{"number", 1, NULL, 'n'},
@@ -283,22 +298,26 @@ int main(int argc, char *argv[])
{"pdb", 1, NULL, 'p'},
{"output", 1, NULL, 'o'},
{"geometry", 1, NULL, 'g'},
- {"beam", 1, NULL, 'b'},
{"sample-spectrum", 1, NULL, 's'},
{"type-spectrum", 1, NULL, 'x'},
{"spectrum", 1, NULL, 'x'},
{"really-random", 0, &config_random, 1},
{"no-fringes", 0, &no_fringes, 1},
+
{"gpu-dev", 1, NULL, 2},
{"min-size", 1, NULL, 3},
{"max-size", 1, NULL, 4},
{"background", 1, NULL, 5},
{"template", 1, NULL, 6},
+ {"beam-bandwidth", 1, NULL, 7},
+ {"profile-radius", 1, NULL, 8},
+ {"photon-energy", 1, NULL, 9},
+
{0, 0, NULL, 0}
};
/* Short options */
- while ((c = getopt_long(argc, argv, "hrn:i:t:p:o:g:b:y:s:x:",
+ while ((c = getopt_long(argc, argv, "hrn:i:t:p:o:g:y:s:x:v",
longopts, NULL)) != -1) {
switch (c) {
@@ -307,7 +326,7 @@ int main(int argc, char *argv[])
show_help(argv[0]);
return 0;
- case 7 :
+ case 'v' :
printf("CrystFEL: " CRYSTFEL_VERSIONSTRING "\n");
printf(CRYSTFEL_BOILERPLATE"\n");
return 0;
@@ -402,6 +421,43 @@ int main(int argc, char *argv[])
template_file = strdup(optarg);
break;
+ case 7 :
+ beam.bandwidth = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid beam bandwidth.\n");
+ return 1;
+ }
+ if ( beam.bandwidth < 0.0 ) {
+ ERROR("Beam bandwidth must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 8 :
+ beam.profile_radius = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid profile radius.\n");
+ return 1;
+ }
+ if ( beam.divergence < 0.0 ) {
+ ERROR("Profile radius must be positive.\n");
+ return 1;
+ }
+ break;
+
+ case 9 :
+ beam.photon_energy = strtod(optarg, &rval);
+ if ( *rval != '\0' ) {
+ ERROR("Invalid photon energy.\n");
+ return 1;
+ }
+ if ( beam.photon_energy < 0.0 ) {
+ ERROR("Photon energy must be positive.\n");
+ return 1;
+ }
+ break;
+
+
case 0 :
break;
@@ -476,19 +532,13 @@ int main(int argc, char *argv[])
ERROR("You need to specify a geometry file with --geometry\n");
return 1;
}
- image.det = get_detector_geometry(geometry);
+ image.det = get_detector_geometry(geometry, NULL);
if ( image.det == NULL ) {
ERROR("Failed to read detector geometry from '%s'\n", geometry);
return 1;
}
free(geometry);
- if ( beamfile == NULL ) {
- ERROR("You need to specify a beam parameter file"
- " with --beam\n");
- return 1;
- }
-
if ( spectrum_str == NULL ) {
STATUS("You didn't specify a spectrum type, so"
" I'm using a 'tophat' spectrum.\n");
@@ -549,12 +599,6 @@ int main(int argc, char *argv[])
}
- image.beam = get_beam_parameters(beamfile);
- if ( image.beam == NULL ) {
- ERROR("Failed to read beam parameters from '%s'\n", beamfile);
- return 1;
- }
-
/* Define image parameters */
image.width = image.det->max_fs + 1;
image.height = image.det->max_ss + 1;
@@ -564,10 +608,10 @@ int main(int argc, char *argv[])
return 1;
}
- double wl = ph_en_to_lambda(eV_to_J(image.beam->photon_energy));
+ double wl = ph_en_to_lambda(eV_to_J(beam.photon_energy));
image.lambda = wl;
- image.bw = image.beam->bandwidth;
- image.div = image.beam->divergence;
+ image.bw = beam.bandwidth;
+ image.div = beam.divergence;
image.nsamples = nsamples;
free(beamfile);
@@ -786,7 +830,6 @@ skip:
free(image.det->panels);
free(image.det);
- free(image.beam);
free(powder->data);
free(powder);
cell_free(input_cell);
diff --git a/src/process_image.c b/src/process_image.c
index 8646f535..b78833af 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -43,7 +43,6 @@
#include "detector.h"
#include "filters.h"
#include "thread-pool.h"
-#include "beam-parameters.h"
#include "geometry.h"
#include "stream.h"
#include "reflist-utils.h"