aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-07-08 10:22:50 +0200
committerThomas White <taw@physics.org>2015-07-08 10:23:13 +0200
commitcc42a8ac8d210527411ce811eb960264d4d8ad1e (patch)
tree7ff2fe6bf3c4f640529adbd6d7eb3b28e365f07f
parent31b653d3920fb952a926447afce5fd3b76d9d5ee (diff)
pattern_sim: Add check for HDF5 references
This trips *everyone* up.
-rw-r--r--src/pattern_sim.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index f9d8126d..bd97ead7 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -223,6 +223,27 @@ static int random_ncells(double len, double min_m, double max_m)
}
+static void fixup_geom(struct detector *det)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+ det->panels[i].clen += det->panels[i].coffset;
+ }
+}
+
+
+static int geom_contains_references(struct detector *det)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+ if ( det->panels[i].clen_from != NULL ) return 1;
+ }
+ return 0;
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -554,6 +575,13 @@ int main(int argc, char *argv[])
ERROR("The value given on the command line "
"(with --photon-energy) will be used instead.\n");
}
+ if ( geom_contains_references(image.det) ) {
+ ERROR("Geometry file contains a reference to an HDF5 location"
+ " for the camera length. Change it to a numerical value "
+ " and try again.\n");
+ return 1;
+ }
+ fixup_geom(image.det);
if ( spectrum_str == NULL ) {
STATUS("You didn't specify a spectrum type, so"