diff options
author | Thomas White <taw@physics.org> | 2011-03-14 10:57:21 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:19 +0100 |
commit | f27607b8f51779e5bf4b344294122c65e49f008b (patch) | |
tree | 72bc10b5f3bffa3d8eb359b38fa0430beb9878d3 | |
parent | 38ab00ccb6869318f1a12a96443fa6c23de1f6e7 (diff) |
Remove 'reintegrate'
What it really does isn't that well defined, and it'd be a lot of work
to define it usefully. Removing it for now..
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | Makefile.in | 38 | ||||
-rw-r--r-- | src/reintegrate.c | 354 |
3 files changed, 8 insertions, 392 deletions
diff --git a/Makefile.am b/Makefile.am index bdd3f2be..5a309f76 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4 bin_PROGRAMS = src/pattern_sim src/process_hkl src/get_hkl src/indexamajig \ src/compare_hkl src/powder_plot src/render_hkl \ - src/calibrate_detector src/partialator src/reintegrate \ + src/calibrate_detector src/partialator \ src/estimate_background src/check_hkl src/sum_stack noinst_PROGRAMS = tests/list_check @@ -107,12 +107,6 @@ src_cubeit_SOURCES = src/cubeit.c src/cell.c src/hdf5-file.c src/utils.c \ src/symmetry.c src/stream.c src/thread-pool.c endif -src_reintegrate_SOURCES = src/reintegrate.c src/cell.c src/hdf5-file.c \ - src/utils.c src/detector.c src/peaks.c src/image.c \ - src/stream.c src/index.c src/dirax.c src/mosflm.c \ - src/geometry.c src/symmetry.c \ - src/thread-pool.c src/reflist.c - src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \ src/utils.c src/cell.c src/thread-pool.c diff --git a/Makefile.in b/Makefile.in index f37e4218..b76f0796 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,9 +39,9 @@ bin_PROGRAMS = src/pattern_sim$(EXEEXT) src/process_hkl$(EXEEXT) \ src/get_hkl$(EXEEXT) src/indexamajig$(EXEEXT) \ src/compare_hkl$(EXEEXT) src/powder_plot$(EXEEXT) \ src/render_hkl$(EXEEXT) src/calibrate_detector$(EXEEXT) \ - src/partialator$(EXEEXT) src/reintegrate$(EXEEXT) \ - src/estimate_background$(EXEEXT) src/check_hkl$(EXEEXT) \ - src/sum_stack$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) + src/partialator$(EXEEXT) src/estimate_background$(EXEEXT) \ + src/check_hkl$(EXEEXT) src/sum_stack$(EXEEXT) $(am__EXEEXT_1) \ + $(am__EXEEXT_2) noinst_PROGRAMS = tests/list_check$(EXEEXT) $(am__EXEEXT_3) TESTS = tests/list_check$(EXEEXT) $(am__EXEEXT_3) @BUILD_HDFSEE_TRUE@am__append_1 = src/hdfsee @@ -209,16 +209,6 @@ am_src_process_hkl_OBJECTS = src/process_hkl.$(OBJEXT) \ src_process_hkl_OBJECTS = $(am_src_process_hkl_OBJECTS) src_process_hkl_LDADD = $(LDADD) src_process_hkl_DEPENDENCIES = $(top_builddir)/lib/libgnu.a -am_src_reintegrate_OBJECTS = src/reintegrate.$(OBJEXT) \ - src/cell.$(OBJEXT) src/hdf5-file.$(OBJEXT) src/utils.$(OBJEXT) \ - src/detector.$(OBJEXT) src/peaks.$(OBJEXT) src/image.$(OBJEXT) \ - src/stream.$(OBJEXT) src/index.$(OBJEXT) src/dirax.$(OBJEXT) \ - src/mosflm.$(OBJEXT) src/geometry.$(OBJEXT) \ - src/symmetry.$(OBJEXT) src/thread-pool.$(OBJEXT) \ - src/reflist.$(OBJEXT) -src_reintegrate_OBJECTS = $(am_src_reintegrate_OBJECTS) -src_reintegrate_LDADD = $(LDADD) -src_reintegrate_DEPENDENCIES = $(top_builddir)/lib/libgnu.a am_src_render_hkl_OBJECTS = src/render_hkl.$(OBJEXT) \ src/cell.$(OBJEXT) src/reflections.$(OBJEXT) \ src/utils.$(OBJEXT) src/povray.$(OBJEXT) \ @@ -285,9 +275,8 @@ SOURCES = $(src_calibrate_detector_SOURCES) $(src_check_hkl_SOURCES) \ $(src_hdfsee_SOURCES) $(src_indexamajig_SOURCES) \ $(src_partialator_SOURCES) $(src_pattern_sim_SOURCES) \ $(src_powder_plot_SOURCES) $(src_process_hkl_SOURCES) \ - $(src_reintegrate_SOURCES) $(src_render_hkl_SOURCES) \ - $(src_sum_stack_SOURCES) $(tests_gpu_sim_check_SOURCES) \ - $(tests_list_check_SOURCES) + $(src_render_hkl_SOURCES) $(src_sum_stack_SOURCES) \ + $(tests_gpu_sim_check_SOURCES) $(tests_list_check_SOURCES) DIST_SOURCES = $(src_calibrate_detector_SOURCES) \ $(src_check_hkl_SOURCES) $(src_compare_hkl_SOURCES) \ $(am__src_cubeit_SOURCES_DIST) \ @@ -295,8 +284,8 @@ DIST_SOURCES = $(src_calibrate_detector_SOURCES) \ $(am__src_hdfsee_SOURCES_DIST) \ $(am__src_indexamajig_SOURCES_DIST) $(src_partialator_SOURCES) \ $(am__src_pattern_sim_SOURCES_DIST) $(src_powder_plot_SOURCES) \ - $(src_process_hkl_SOURCES) $(src_reintegrate_SOURCES) \ - $(src_render_hkl_SOURCES) $(src_sum_stack_SOURCES) \ + $(src_process_hkl_SOURCES) $(src_render_hkl_SOURCES) \ + $(src_sum_stack_SOURCES) \ $(am__tests_gpu_sim_check_SOURCES_DIST) \ $(tests_list_check_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -674,12 +663,6 @@ src_partialator_SOURCES = src/partialator.c src/cell.c src/hdf5-file.c \ @BUILD_CUBEIT_TRUE@ src/detector.c src/render.c src/filters.c src/image.c \ @BUILD_CUBEIT_TRUE@ src/symmetry.c src/stream.c src/thread-pool.c -src_reintegrate_SOURCES = src/reintegrate.c src/cell.c src/hdf5-file.c \ - src/utils.c src/detector.c src/peaks.c src/image.c \ - src/stream.c src/index.c src/dirax.c src/mosflm.c \ - src/geometry.c src/symmetry.c \ - src/thread-pool.c src/reflist.c - src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \ src/utils.c src/cell.c src/thread-pool.c @@ -926,11 +909,6 @@ src/process_hkl.$(OBJEXT): src/$(am__dirstamp) \ src/process_hkl$(EXEEXT): $(src_process_hkl_OBJECTS) $(src_process_hkl_DEPENDENCIES) src/$(am__dirstamp) @rm -f src/process_hkl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(src_process_hkl_OBJECTS) $(src_process_hkl_LDADD) $(LIBS) -src/reintegrate.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) -src/reintegrate$(EXEEXT): $(src_reintegrate_OBJECTS) $(src_reintegrate_DEPENDENCIES) src/$(am__dirstamp) - @rm -f src/reintegrate$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(src_reintegrate_OBJECTS) $(src_reintegrate_LDADD) $(LIBS) src/render_hkl.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/povray.$(OBJEXT): src/$(am__dirstamp) \ @@ -994,7 +972,6 @@ mostlyclean-compile: -rm -f src/process_hkl.$(OBJEXT) -rm -f src/reflections.$(OBJEXT) -rm -f src/reflist.$(OBJEXT) - -rm -f src/reintegrate.$(OBJEXT) -rm -f src/render.$(OBJEXT) -rm -f src/render_hkl.$(OBJEXT) -rm -f src/sfac.$(OBJEXT) @@ -1042,7 +1019,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/process_hkl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/reflections.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/reflist.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/reintegrate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/render.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/render_hkl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/sfac.Po@am__quote@ diff --git a/src/reintegrate.c b/src/reintegrate.c deleted file mode 100644 index fcffd499..00000000 --- a/src/reintegrate.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * reintegrate.c - * - * Like "indexamajig", but skip the indexing step - * - * (c) 2006-2010 Thomas White <taw@physics.org> - * - * Part of CrystFEL - crystallography with a FEL - * - */ - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <pthread.h> -#include <sys/time.h> -#include <assert.h> - -#include "utils.h" -#include "hdf5-file.h" -#include "symmetry.h" -#include "peaks.h" -#include "stream.h" -#include "index.h" -#include "thread-pool.h" - - -struct static_integration_args -{ - struct detector *det; - pthread_mutex_t *output_mutex; /* Protects the output stream */ - int config_cmfilter; - int config_polar; - int config_satcorr; - int config_sa; - int config_closer; - int config_sanity; - FILE *ofh; -}; - - -struct integration_args -{ - char *filename; - UnitCell *cell; - - struct static_integration_args static_args; -}; - - -struct queue_args -{ - FILE *fh; - const char *prefix; - int config_basename; - - struct static_integration_args static_args; -}; - - -static void show_help(const char *s) -{ - printf("Syntax: %s [options]\n\n", s); - printf( -"Like 'indexamajig', but skip the indexing step.\n" -"\n" -" -h, --help Display this help message.\n" -"\n" -" -i, --input=<filename> Specify the name of the input 'stream'.\n" -" (must be a file, not e.g. stdin)\n" -" -o, --output=<filename> Write out stream to this file. '-' for stdout.\n" -" -g. --geometry=<file> Get detector geometry from file.\n" -" -x, --prefix=<p> Prefix filenames from input file with <p>.\n" -" --basename Remove the directory parts of the filenames.\n" -" --no-check-prefix Don't attempt to correct the --prefix.\n" -" --check-sanity Check that indexed locations approximately correspond\n" -" with detected peaks.\n" -" --filter-cm Perform common-mode noise subtraction on images\n" -" before proceeding. Intensities will be extracted\n" -" from the image as it is after this processing.\n" -" --unpolarized Don't correct for the polarisation of the X-rays.\n" -" --no-sat-corr Don't correct values of saturated peaks using a\n" -" table included in the HDF5 file.\n" -" --no-sa Don't correct for the differing solid angles of\n" -" the pixels.\n" -" --no-closer-peak Don't integrate from the location of a nearby peak\n" -" instead of the position closest to the reciprocal\n" -" lattice point.\n" -" -j <n> Run <n> analyses in parallel.\n"); -} - - -static void process_image(void *pg, int cookie) -{ - struct integration_args *apargs = pg; - struct static_integration_args *pargs = &apargs->static_args; - struct hdfile *hdfile; - struct image image; - - image.features = NULL; - image.data = NULL; - image.flags = NULL; - image.indexed_cell = NULL; - image.filename = apargs->filename; - image.det = pargs->det; - - STATUS("Processing '%s'\n", apargs->filename); - - hdfile = hdfile_open(apargs->filename); - if ( hdfile == NULL ) { - return; - } else if ( hdfile_set_first_image(hdfile, "/") ) { - ERROR("Couldn't select path\n"); - hdfile_close(hdfile); - return; - } - - hdf5_read(hdfile, &image, pargs->config_satcorr); - - map_all_peaks(&image); - - /* Sanity check */ - if ( pargs->config_sanity - && !peak_sanity_check(&image, image.indexed_cell, 1, 0.006e9) ) { - - STATUS("Failed peak sanity check.\n"); - - } else { - - RefList *reflections; - - reflections = find_projected_peaks(&image, image.indexed_cell, - 0, 0.1); - - reflist_free(reflections); - } - - pthread_mutex_lock(pargs->output_mutex); - write_chunk(pargs->ofh, &image, pargs->stream_flags); - pthread_mutex_unlock(pargs->output_mutex); - - - free(image.data); - if ( image.flags != NULL ) free(image.flags); - hdfile_close(hdfile); - - free(apargs->filename); - cell_free(apargs->cell); - free(apargs); -} - - -static void *get_image(void *qp) -{ - struct integration_args *pargs; - struct queue_args *qargs = qp; - UnitCell *cell; - char *filename; - double ph_ev; - - /* Get the next filename */ - if ( find_chunk(qargs->fh, &cell, &filename, &ph_ev) ) { - return NULL; - } - - pargs = malloc(sizeof(struct integration_args)); - - if ( qargs->config_basename ) { - char *tmp; - tmp = safe_basename(filename); - free(filename); - filename = tmp; - } - - memcpy(&pargs->static_args, &qargs->static_args, - sizeof(struct static_integration_args)); - - pargs->cell = cell; - pargs->filename = malloc(1024); - snprintf(pargs->filename, 1023, "%s%s", qargs->prefix, filename); - free(filename); - - return pargs; -} - - -static void integrate_all(int nthreads, struct detector *det, FILE *fh, - int config_basename, const char *prefix, - int config_cmfilter, int config_polar, - int config_satcorr, int config_sa, int config_closer, - int config_sanity, FILE *ofh) -{ - struct queue_args qargs; - pthread_mutex_t output_mutex = PTHREAD_MUTEX_INITIALIZER; - - /* Information required to choose the next image */ - qargs.fh = fh; - qargs.prefix = prefix; - qargs.config_basename = config_basename; - - /* Information for the task which does not vary */ - qargs.static_args.det = det; - qargs.static_args.config_cmfilter = config_cmfilter; - qargs.static_args.config_polar = config_polar; - qargs.static_args.config_satcorr = config_satcorr; - qargs.static_args.config_sa = config_sa; - qargs.static_args.config_closer = config_closer; - qargs.static_args.config_sanity = qargs.static_args.config_sanity; - qargs.static_args.output_mutex = &output_mutex; - qargs.static_args.ofh = ofh; - - run_threads(nthreads, process_image, get_image, NULL, &qargs, 0); -} - - -int main(int argc, char *argv[]) -{ - int c; - char *infile = NULL; - char *outfile = NULL; - char *geomfile = NULL; - FILE *fh; - FILE *ofh; - char *prefix = NULL; - int nthreads = 1; - int config_basename = 0; - int config_checkprefix = 1; - int config_closer = 1; - int config_polar = 1; - int config_sanity = 0; - int config_satcorr = 1; - int config_sa = 1; - int config_cmfilter = 0; - struct detector *det; - - /* Long options */ - const struct option longopts[] = { - {"help", 0, NULL, 'h'}, - {"input", 1, NULL, 'i'}, - {"output", 1, NULL, 'o'}, - {"geometry", 1, NULL, 'g'}, - {"prefix", 1, NULL, 'x'}, - {"basename", 0, &config_basename, 1}, - {"no-check-prefix", 0, &config_checkprefix, 0}, - {"no-closer-peak", 0, &config_closer, 0}, - {"unpolarized", 0, &config_polar, 0}, - {"check-sanity", 0, &config_sanity, 1}, - {"sat-corr", 0, &config_satcorr, 1}, - {"no-sat-corr", 0, &config_satcorr, 0}, - {"no-sa", 0, &config_sa, 0}, - {"filter-cm", 0, &config_cmfilter, 1}, - {0, 0, NULL, 0} - }; - - /* Short options */ - while ((c = getopt_long(argc, argv, "hi:g:x:j:o:", - longopts, NULL)) != -1) - { - - switch (c) { - case 'h' : - show_help(argv[0]); - return 0; - - case 'i' : - infile = strdup(optarg); - break; - - case 'o' : - outfile = strdup(optarg); - break; - - case 'g' : - geomfile = strdup(optarg); - break; - - case 'x' : - prefix = strdup(optarg); - break; - - case 'j' : - nthreads = atoi(optarg); - break; - - case 0 : - break; - - default : - return 1; - } - - } - - if ( infile == NULL ) { - infile = strdup("-"); - } - if ( strcmp(infile, "-") == 0 ) { - fh = stdin; - } else { - fh = fopen(infile, "r"); - } - if ( fh == NULL ) { - ERROR("Failed to open input file '%s'\n", infile); - return 1; - } - free(infile); - - if ( outfile == NULL ) { - outfile = strdup("-"); - } - if ( strcmp(outfile, "-") == 0 ) { - ofh = stdout; - } else { - ofh = fopen(outfile, "w"); - } - if ( ofh == NULL ) { - ERROR("Failed to open output file '%s'\n", outfile); - return 1; - } - free(outfile); - - if ( prefix == NULL ) { - prefix = strdup(""); - } else { - if ( config_checkprefix ) { - prefix = check_prefix(prefix); - } - } - - det = get_detector_geometry(geomfile); - if ( det == NULL ) { - ERROR("Failed to read detector geometry from '%s'\n", geomfile); - return 1; - } - free(geomfile); - - rewind(fh); - integrate_all(nthreads, det, fh, config_basename, prefix, - config_cmfilter, config_polar, config_satcorr, config_sa, - config_closer, config_sanity, ofh); - - fclose(fh); - free(prefix); - - return 0; -} |