aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-25 15:01:58 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commitaab8403884c4731f7365796de8f53315f4a61616 (patch)
tree6a7bc45b52c7943220c71de07caba9c681b2567d /src
parent23ea67dc03ac19f7a1457ecfdc8d5ee9cac68632 (diff)
Get rid of imagefile_field_list and stuff_from_stream
The only place this is used is in geoptimiser, to get the average_camera_length, itself a very bad solution.
Diffstat (limited to 'src')
-rw-r--r--src/geoptimiser.c31
-rw-r--r--src/im-sandbox.c1
-rw-r--r--src/indexamajig.c39
-rw-r--r--src/partial_sim.c2
-rw-r--r--src/partialator.c3
-rw-r--r--src/process_image.c4
-rw-r--r--src/process_image.h1
7 files changed, 48 insertions, 33 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index cae2ae4e..ec4fbcd4 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -219,21 +219,22 @@ static Reflection *find_closest_reflection(struct image *image,
static double get_average_clen(struct image *image)
{
int i;
- struct stuff_from_stream *stuff = image->stuff_from_stream;
-
- if ( stuff == NULL ) {
- ERROR("No 'stuff' from stream!\n");
- return -1.0;
- }
-
- for ( i=0; i<stuff->n_fields; i++ ) {
-
- if ( strncmp(stuff->fields[i], "average_camera_length = ",
- 24) == 0 )
- {
- return atof(stuff->fields[i]+24);
- }
- }
+ // FIXME!
+ // struct stuff_from_stream *stuff = image->stuff_from_stream;
+ //
+ // if ( stuff == NULL ) {
+ // ERROR("No 'stuff' from stream!\n");
+ // return -1.0;
+ // }
+ //
+ // for ( i=0; i<stuff->n_fields; i++ ) {
+ //
+ // if ( strncmp(stuff->fields[i], "average_camera_length = ",
+ // 24) == 0 )
+ // {
+ // return atof(stuff->fields[i]+24);
+ // }
+ // }
ERROR("Failed to recover average camera length from stream file\n");
return -1.0;
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index c7840f94..660c2ae1 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -415,7 +415,6 @@ static int run_work(const struct index_args *iargs, Stream *st,
time_accounts_set(taccs, TACC_FINALCLEANUP);
cleanup_indexing(iargs->ipriv);
- free_imagefile_field_list(iargs->copyme);
cell_free(iargs->cell);
if ( sb->profile ) time_accounts_print(taccs);
time_accounts_free(taccs);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index f4c3af50..bff9e90f 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -92,6 +92,8 @@ struct indexamajig_arguments
int if_multi;
int if_retry;
int profile; /* Whether to do wall-clock time profiling */
+ char **copy_headers;
+ int n_copy_headers;
TakeTwoOptions **taketwo_opts_ptr;
FelixOptions **felix_opts_ptr;
@@ -107,6 +109,21 @@ static void show_version(FILE *fh, struct argp_state *state)
}
+static void add_copy_header(struct indexamajig_arguments *args,
+ const char *header)
+{
+ char **new_copy_headers = realloc(args->copy_headers,
+ (args->n_copy_headers+1)*sizeof(char *));
+ if ( new_copy_headers == NULL ) {
+ ERROR("Failed to add copy header '%s'\n", header);
+ return;
+ }
+
+ args->copy_headers = new_copy_headers;
+ args->copy_headers[args->n_copy_headers++] = strdup(header);
+}
+
+
static error_t parse_arg(int key, char *arg, struct argp_state *state)
{
float tmp;
@@ -525,7 +542,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
break;
case 602 :
- add_imagefile_field(args->iargs.copyme, arg);
+ add_copy_header(args, arg);
break;
case 603 :
@@ -587,6 +604,8 @@ int main(int argc, char *argv[])
args.if_refine = 1;
args.if_checkcell = 1;
args.profile = 0;
+ args.copy_headers = NULL;
+ args.n_copy_headers = 0;
args.taketwo_opts_ptr = &taketwo_opts;
args.felix_opts_ptr = &felix_opts;
args.xgandalf_opts_ptr = &xgandalf_opts;
@@ -618,7 +637,6 @@ int main(int argc, char *argv[])
args.iargs.dtempl = NULL;
args.iargs.peaks = PEAK_ZAEF;
args.iargs.half_pixel_shift = 1;
- args.iargs.copyme = NULL;
args.iargs.pk_inn = -1.0;
args.iargs.pk_mid = -1.0;
args.iargs.pk_out = -1.0;
@@ -634,11 +652,6 @@ int main(int argc, char *argv[])
args.iargs.min_peaks = 0;
args.iargs.overpredict = 0;
args.iargs.wait_for_file = 0;
- args.iargs.copyme = new_imagefile_field_list();
- if ( args.iargs.copyme == NULL ) {
- ERROR("Couldn't allocate HDF5 field list.\n");
- return 1;
- }
args.iargs.ipriv = NULL; /* No default */
args.iargs.int_meth = integration_method("rings-nocen-nosat-nograd", NULL);
args.iargs.push_res = +INFINITY;
@@ -759,8 +772,9 @@ int main(int argc, char *argv[])
{NULL, 0, 0, OPTION_DOC, "Output options:", 6},
{"no-non-hits-in-stream", 601, NULL, OPTION_NO_USAGE, "Don't include non-hits in "
"stream (see --min-peaks)"},
- {"copy-hdf5-field", 602, "f", OPTION_NO_USAGE, "Put the value of this HDF5 field "
- "into the stream"},
+ {"copy-hdf5-field", 602, "f", OPTION_HIDDEN, NULL},
+ {"copy-header", 602, "f", OPTION_NO_USAGE, "Put the value of this image header "
+ "field into the stream"},
{"no-peaks-in-stream", 603, NULL, OPTION_NO_USAGE, "Don't put peak search results "
"in stream"},
{"no-refls-in-stream", 604, NULL, OPTION_NO_USAGE, "Don't put integration results "
@@ -831,6 +845,12 @@ int main(int argc, char *argv[])
return 1;
}
+ /* Add any headers we need to copy */
+ for ( r=0; r<args.n_copy_headers; r++ ) {
+ data_template_add_copy_header(args.iargs.dtempl,
+ args.copy_headers[r]);
+ }
+
/* If no integration radii were given, apply the defaults */
if ( args.iargs.ir_inn < 0 ) {
STATUS("WARNING: You did not specify --int-radius.\n");
@@ -1008,7 +1028,6 @@ int main(int argc, char *argv[])
fh, st, tmpdir, args.serial_start, zmq_address,
timeout, args.profile);
- free_imagefile_field_list(args.iargs.copyme);
cell_free(args.iargs.cell);
free(args.prefix);
free(args.temp_location);
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 32263cad..9e774431 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -899,7 +899,7 @@ int main(int argc, char *argv[])
image.spectrum = spectrum_generate_gaussian(image.lambda, image.bw);
image.filename = "dummy.h5";
image.ev = "(none)";
- image.copyme = NULL;
+ image.copied_headers = NULL;
image.crystals = NULL;
image.n_crystals = 0;
image.indexed_by = INDEXING_SIMULATION;
diff --git a/src/partialator.c b/src/partialator.c
index 47a752b0..032eb0d9 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -1389,9 +1389,6 @@ int main(int argc, char *argv[])
return 1;
}
- free_stuff_from_stream(cur.stuff_from_stream);
- cur.stuff_from_stream = NULL;
-
for ( i=0; i<cur.n_crystals; i++ ) {
Crystal *cr;
diff --git a/src/process_image.c b/src/process_image.c
index bca2a7f2..60e3edbc 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -201,7 +201,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
image = file_wait_open_read(pargs->filename, pargs->event,
iargs->dtempl,
sb_shared, taccs, last_task,
- iargs->wait_for_file, cookie);
+ iargs->wait_for_file,
+ cookie);
if ( image == NULL ) {
if ( iargs->wait_for_file != 0 ) {
pthread_mutex_lock(&sb_shared->totals_lock);
@@ -213,7 +214,6 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
}
image->serial = serial;
- image->copyme = iargs->copyme;
/* Take snapshot of image before applying horrible noise filters */
time_accounts_set(taccs, TACC_FILTER);
diff --git a/src/process_image.h b/src/process_image.h
index 908a2e06..354641c3 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -80,7 +80,6 @@ struct index_args
float min_snr_peak_pix;
float min_sig;
float min_peak_over_neighbour;
- struct imagefile_field_list *copyme;
int integrate_saturated;
int use_saturated;
int no_revalidate;