diff options
-rw-r--r-- | src/detector.c | 15 | ||||
-rw-r--r-- | src/detector.h | 2 | ||||
-rw-r--r-- | src/pattern_sim.c | 5 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/detector.c b/src/detector.c index 8f59db67..222e539c 100644 --- a/src/detector.c +++ b/src/detector.c @@ -142,7 +142,7 @@ static uint16_t *bloom(int *hdr_in, int width, int height) } -void record_image(struct image *image) +void record_image(struct image *image, int do_water) { int x, y; double total_energy, energy_density; @@ -178,12 +178,15 @@ void record_image(struct image *image) val = image->sfacs[x + image->width*y]; intensity = pow(cabs(val), 2.0); - /* Add intensity contribution from water */ - water = water_intensity(image->qvecs[x + image->width*y], - image->xray_energy, - BEAM_RADIUS, WATER_RADIUS); + if ( do_water ) { - intensity += water; + /* Add intensity contribution from water */ + water = water_intensity(image->qvecs[x + image->width*y], + image->xray_energy, + BEAM_RADIUS, WATER_RADIUS); + intensity += water; + + } /* Area of pixel as seen from crystal (approximate) */ proj_area = pix_area * cos(image->twotheta[x + image->width*y]); diff --git a/src/detector.h b/src/detector.h index 2f6680c4..4d540d07 100644 --- a/src/detector.h +++ b/src/detector.h @@ -18,6 +18,6 @@ #include "image.h" -extern void record_image(struct image *image); +extern void record_image(struct image *image, int do_water); #endif /* DETECTOR_H */ diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 5ed68743..065fed72 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -43,6 +43,7 @@ static void show_help(const char *s) " --no-images Do not output any HDF5 files.\n" " -r, --random-orientation Use a randomly generated orientation\n" " (a new orientation will be used for each image).\n" +" --no-water Do not simulate water background.\n" ); } @@ -140,6 +141,7 @@ int main(int argc, char *argv[]) int config_nearbragg = 0; int config_randomquat = 0; int config_noimages = 0; + int config_nowater = 0; int number = 1; /* Index for the current image */ int n_images = 1; /* Generate one image by default */ int done = 0; @@ -152,6 +154,7 @@ int main(int argc, char *argv[]) {"random-orientation", 0, NULL, 'r'}, {"number", 1, NULL, 'n'}, {"no-images", 0, &config_noimages, 1}, + {"no-water", 0, &config_nowater, 1}, {0, 0, NULL, 0} }; @@ -227,7 +230,7 @@ int main(int argc, char *argv[]) image.hdr = NULL; get_diffraction(&image); - record_image(&image); + record_image(&image, !config_nowater); if ( config_nearbragg ) { output_intensities(&image); |