diff options
author | Thomas White <taw@physics.org> | 2020-05-25 15:01:58 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | aab8403884c4731f7365796de8f53315f4a61616 (patch) | |
tree | 6a7bc45b52c7943220c71de07caba9c681b2567d /src/indexamajig.c | |
parent | 23ea67dc03ac19f7a1457ecfdc8d5ee9cac68632 (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/indexamajig.c')
-rw-r--r-- | src/indexamajig.c | 39 |
1 files changed, 29 insertions, 10 deletions
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); |