aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-02-09 13:59:15 +0100
committerThomas White <taw@physics.org>2023-02-09 14:32:49 +0100
commitc165bddef859284d31acae1f4a70d39d1f8e527e (patch)
tree2f17e663aa3d0d947f052a7bd4889ca345e45d02
parentba6a1130304634537a3af094aee278fac77f39b3 (diff)
partial_sim: Fix up behaviour after DataTemplate
It's been broken for a long time. Now, at least it does what the documentation says it does. Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/78
-rw-r--r--doc/man/partial_sim.123
-rw-r--r--src/partial_sim.c50
2 files changed, 12 insertions, 61 deletions
diff --git a/doc/man/partial_sim.1 b/doc/man/partial_sim.1
index 936427fa..102e3cdf 100644
--- a/doc/man/partial_sim.1
+++ b/doc/man/partial_sim.1
@@ -29,10 +29,7 @@ You need to provide a CrystFEL geometry file (with \fB--geometry=\fR\fImy.geom\f
For each randomly generated orientation, partial_sim calculates which reflections would appear on the detector with the specified beam parameters. It calculates the partiality for each reflection and multiplies it by the fully integrated intensity to produce a partial intensity. The fully integrated intensities can be taken from a file you provide (see below), otherwise they will be randomly generated (by taking the absolute value of a Gaussian random number, mean zero and standard deviation 1000). All the partial intensities for the orientation are multiplied by an overall scaling factor, which is randomly generated with a Gaussian distribution with mean 1 and standard deviation 0.3. The partial intensities are written to the output stream, and the process repeated for as many different orientations as you ask for (see below, default: 2).
-.P
-See
-.BR "man crystfel_geometry"
-for information about CrystFEL geometry description files.
+Set the incident radiation wavelength and bandwidth in the geometry file. Set the reciprocal space profile radius on the command line with \fI--profile-radius\fR. Beam divergence is not taken into account by the \fIxsphere\fR partiality model used by partial_sim. See \fBman crystfel_geometry\fR for information about CrystFEL geometry description files.
.SH OPTIONS
.PD 0
@@ -122,29 +119,11 @@ Add a Poisson-distributed background with \fIval\fR photons to the sketches (see
.PD 0
.B
-.IP "\fB--beam-divergence=\fIval\fR"
-.PD
-Set the convergence angle (the full angle, not "half-angle"/"semi-angle") for the incident beam. The default is \fB--beam-divergence=0.001\fR, i.e. 1 mrad.\fR.
-
-.PD 0
-.B
-.IP "\fB--beam-bandwidth=\fIval\fR"
-.PD
-Set the bandwidth, expressed as a decimal fraction applying to to wavelengths (not the photon energies), for the incident beam. The default is \fB--beam-bandwidth=0.01\fR, i.e. 1%.\fR.
-
-.PD 0
-.B
.IP "\fB--profile-radius=\fIval\fR"
.PD
Set the radius of the scattering density surrounding each reciprocal lattice point, in m^-1. The default is \fB--profile-radius=0.001e9\fR m^-1.
.PD 0
-.B
-.IP "\fB--photon-energy=\fIval\fR"
-.PD
-Set the central photon energy, in eV, for the incident beam. The default is \fB--photon-energy=9000\fR, i.e. 9 keV X-rays.
-
-.PD 0
.IP \fB--really-random\fR
.PD
Seed the random number generator using the kernel random number generator (/dev/urandom). This means that truly random (although not "cryptographically random") numbers will be used for the orientation and crystal size, instead of the same sequence being used for each new run.
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 5d8042c5..37cf51ac 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -266,11 +266,8 @@ 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"
" --really-random Be non-deterministic.\n"
"\n"
);
@@ -527,10 +524,7 @@ int main(int argc, char *argv[])
struct image *test_image;
/* 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;
@@ -690,28 +684,14 @@ int main(int argc, char *argv[])
break;
case 8 :
- divergence = strtod(optarg, &rval);
- if ( *rval != '\0' ) {
- ERROR("Invalid beam divergence.\n");
- return 1;
- }
- if ( divergence < 0.0 ) {
- ERROR("Beam divergence must be positive.\n");
- return 1;
- }
- break;
+ ERROR("--beam-divergence is no longer used.\n");
+ ERROR("The 'xsphere' partiality model does not take divergence into account.\n");
+ return 1;
case 9 :
- bandwidth = strtod(optarg, &rval);
- if ( *rval != '\0' ) {
- ERROR("Invalid beam bandwidth.\n");
- return 1;
- }
- if ( bandwidth < 0.0 ) {
- ERROR("Beam bandwidth must be positive.\n");
- return 1;
- }
- break;
+ ERROR("--beam-bandwidth is no longer used.\n");
+ ERROR("Set the bandwidth in the geometry file instead.\n");
+ return 1;
case 10 :
profile_radius = strtod(optarg, &rval);
@@ -719,23 +699,16 @@ int main(int argc, char *argv[])
ERROR("Invalid profile radius.\n");
return 1;
}
- if ( divergence < 0.0 ) {
+ if ( profile_radius < 0.0 ) {
ERROR("Profile radius must be positive.\n");
return 1;
}
break;
case 11 :
- photon_energy = strtod(optarg, &rval);
- if ( *rval != '\0' ) {
- ERROR("Invalid photon energy.\n");
- return 1;
- }
- if ( photon_energy < 0.0 ) {
- ERROR("Photon energy must be positive.\n");
- return 1;
- }
- break;
+ ERROR("--photon-energy is no longer used.\n");
+ ERROR("Set the photon energy in the geometry file instead.\n");
+ return 1;
case 12 :
template = strdup(optarg);
@@ -882,8 +855,7 @@ int main(int argc, char *argv[])
STATUS(" Wavelength: %.5f A (photon energy %.2f eV)\n",
test_image->lambda*1e10,
ph_lambda_to_eV(test_image->lambda));
- STATUS(" Beam divergence: %.5f mrad\n",
- test_image->div*1e3);
+ STATUS(" Beam divergence: 0 (not modelled)\n");
STATUS(" Beam bandwidth: %.5f %%\n",
test_image->bw*100.0);
STATUS("Reciprocal space profile radius: %e m^-1\n",