From 4d654fcf91e742edd6940c4eda04113aa41ff8c8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Mar 2011 11:11:11 +0100 Subject: Remove 'estimate_background' We should be estimating proper SNRs with sigma(I) estimates --- Makefile.am | 7 +- Makefile.in | 42 ++------- README | 3 - src/estimate_background.c | 231 ---------------------------------------------- 4 files changed, 10 insertions(+), 273 deletions(-) delete mode 100644 src/estimate_background.c diff --git a/Makefile.am b/Makefile.am index f7437acc..738c8949 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,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/estimate_background src/check_hkl src/sum_stack + src/check_hkl src/sum_stack noinst_PROGRAMS = tests/list_check @@ -109,11 +109,6 @@ src_cubeit_SOURCES = src/cubeit.c src/cell.c src/hdf5-file.c src/utils.c \ src/reflist.c src/reflist-utils.c endif -src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \ - src/utils.c src/cell.c src/thread-pool.c \ - src/image.c src/detector.c src/hdf5-file.c \ - src/reflist.c src/reflist-utils.c - tests_list_check_SOURCES = tests/list_check.c src/reflist.c src/thread-pool.c \ src/utils.c diff --git a/Makefile.in b/Makefile.in index 402094df..499a2447 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,9 +39,8 @@ 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/estimate_background$(EXEEXT) \ - src/check_hkl$(EXEEXT) src/sum_stack$(EXEEXT) $(am__EXEEXT_1) \ - $(am__EXEEXT_2) + src/partialator$(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 @@ -120,16 +119,6 @@ am__src_cubeit_SOURCES_DIST = src/cubeit.c src/cell.c src/hdf5-file.c \ src_cubeit_OBJECTS = $(am_src_cubeit_OBJECTS) src_cubeit_LDADD = $(LDADD) src_cubeit_DEPENDENCIES = $(top_builddir)/lib/libgnu.a -am_src_estimate_background_OBJECTS = \ - src/estimate_background.$(OBJEXT) src/stream.$(OBJEXT) \ - src/utils.$(OBJEXT) src/cell.$(OBJEXT) \ - src/thread-pool.$(OBJEXT) src/image.$(OBJEXT) \ - src/detector.$(OBJEXT) src/hdf5-file.$(OBJEXT) \ - src/reflist.$(OBJEXT) src/reflist-utils.$(OBJEXT) -src_estimate_background_OBJECTS = \ - $(am_src_estimate_background_OBJECTS) -src_estimate_background_LDADD = $(LDADD) -src_estimate_background_DEPENDENCIES = $(top_builddir)/lib/libgnu.a am_src_get_hkl_OBJECTS = src/get_hkl.$(OBJEXT) src/sfac.$(OBJEXT) \ src/cell.$(OBJEXT) src/utils.$(OBJEXT) \ src/reflections.$(OBJEXT) src/symmetry.$(OBJEXT) \ @@ -277,16 +266,15 @@ am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(src_calibrate_detector_SOURCES) $(src_check_hkl_SOURCES) \ $(src_compare_hkl_SOURCES) $(src_cubeit_SOURCES) \ - $(src_estimate_background_SOURCES) $(src_get_hkl_SOURCES) \ - $(src_hdfsee_SOURCES) $(src_indexamajig_SOURCES) \ - $(src_partialator_SOURCES) $(src_pattern_sim_SOURCES) \ - $(src_powder_plot_SOURCES) $(src_process_hkl_SOURCES) \ - $(src_render_hkl_SOURCES) $(src_sum_stack_SOURCES) \ - $(tests_gpu_sim_check_SOURCES) $(tests_list_check_SOURCES) + $(src_get_hkl_SOURCES) $(src_hdfsee_SOURCES) \ + $(src_indexamajig_SOURCES) $(src_partialator_SOURCES) \ + $(src_pattern_sim_SOURCES) $(src_powder_plot_SOURCES) \ + $(src_process_hkl_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) \ - $(src_estimate_background_SOURCES) $(src_get_hkl_SOURCES) \ + $(am__src_cubeit_SOURCES_DIST) $(src_get_hkl_SOURCES) \ $(am__src_hdfsee_SOURCES_DIST) \ $(am__src_indexamajig_SOURCES_DIST) $(src_partialator_SOURCES) \ $(am__src_pattern_sim_SOURCES_DIST) $(src_powder_plot_SOURCES) \ @@ -670,11 +658,6 @@ src_partialator_SOURCES = src/partialator.c src/cell.c src/hdf5-file.c \ @BUILD_CUBEIT_TRUE@ src/symmetry.c src/stream.c src/thread-pool.c \ @BUILD_CUBEIT_TRUE@ src/reflist.c src/reflist-utils.c -src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \ - src/utils.c src/cell.c src/thread-pool.c \ - src/image.c src/detector.c src/hdf5-file.c \ - src/reflist.c src/reflist-utils.c - tests_list_check_SOURCES = tests/list_check.c src/reflist.c src/thread-pool.c \ src/utils.c @@ -859,11 +842,6 @@ src/reflist-utils.$(OBJEXT): src/$(am__dirstamp) \ src/cubeit$(EXEEXT): $(src_cubeit_OBJECTS) $(src_cubeit_DEPENDENCIES) src/$(am__dirstamp) @rm -f src/cubeit$(EXEEXT) $(AM_V_CCLD)$(LINK) $(src_cubeit_OBJECTS) $(src_cubeit_LDADD) $(LIBS) -src/estimate_background.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) -src/estimate_background$(EXEEXT): $(src_estimate_background_OBJECTS) $(src_estimate_background_DEPENDENCIES) src/$(am__dirstamp) - @rm -f src/estimate_background$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(src_estimate_background_OBJECTS) $(src_estimate_background_LDADD) $(LIBS) src/get_hkl.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/beam-parameters.$(OBJEXT): src/$(am__dirstamp) \ @@ -963,7 +941,6 @@ mostlyclean-compile: -rm -f src/diffraction.$(OBJEXT) -rm -f src/dirax.$(OBJEXT) -rm -f src/dw-hdfsee.$(OBJEXT) - -rm -f src/estimate_background.$(OBJEXT) -rm -f src/filters.$(OBJEXT) -rm -f src/geometry.$(OBJEXT) -rm -f src/get_hkl.$(OBJEXT) @@ -1011,7 +988,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dirax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dw-hdfsee.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/estimate_background.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/filters.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/geometry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/get_hkl.Po@am__quote@ diff --git a/README b/README index 5a59eea7..e98bcd9b 100644 --- a/README +++ b/README @@ -58,9 +58,6 @@ In addition, there is also: - cubeit, for summing patterns in 3D to inspect the peak profiles. - - estimate_background, for calculating signal to noise ratios from - the indexed peaks. - - calibrate_detector, which does nothing useful at the moment. diff --git a/src/estimate_background.c b/src/estimate_background.c deleted file mode 100644 index 1f956377..00000000 --- a/src/estimate_background.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * estimate-background.c - * - * Like 'process_hkl', but for signal/noise ratios - * - * (c) 2006-2010 Thomas White - * - * Part of CrystFEL - crystallography with a FEL - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "statistics.h" -#include "sfac.h" -#include "reflections.h" -#include "symmetry.h" -#include "stream.h" - - -/* Number of bins for plot of resolution shells */ -#define NBINS (10) - - - -static void show_help(const char *s) -{ - printf("Syntax: %s [options]\n\n", s); - printf( -"Estimate peak SNR from FEL Bragg intensities.\n" -"\n" -" -h, --help Display this help message.\n" -" -i, --input= Specify input filename (\"-\" for stdin).\n" -); -} - - - -int main(int argc, char *argv[]) -{ - int c; - char *filename = NULL; - FILE *fh; - int rval; - double total_vol, vol_per_shell; - double rmin, rmax; - double rmins[NBINS]; - double rmaxs[NBINS]; - double snrs[NBINS]; - unsigned int counts[NBINS]; - UnitCell *real_cell; - double overall_snr; - unsigned int overall_counts; - int i; - - /* Long options */ - const struct option longopts[] = { - {"help", 0, NULL, 'h'}, - {"input", 1, NULL, 'i'}, - {0, 0, NULL, 0} - }; - - /* Short options */ - while ((c = getopt_long(argc, argv, "hi:", - longopts, NULL)) != -1) { - - switch (c) { - case 'h' : - show_help(argv[0]); - return 0; - - case 'i' : - filename = strdup(optarg); - break; - - case 0 : - break; - - default : - return 1; - } - - } - - if ( filename == NULL ) { - ERROR("Please specify filename using the -i option\n"); - return 1; - } - - /* Open the data stream */ - if ( strcmp(filename, "-") == 0 ) { - fh = stdin; - } else { - fh = fopen(filename, "r"); - } - free(filename); - if ( fh == NULL ) { - ERROR("Failed to open input file\n"); - return 1; - } - - /* FIXME: Fixed resolution shells */ - rmin = 0.120e9; - rmax = 1.172e9; - - for ( i=0; i %i %i %i %f\n", h, k, l, d/1e9); - - bin = -1; - for ( j=0; jrmins[j]) && (d<=rmaxs[j]) ) { - bin = j; - break; - } - } - if ( bin == -1 ) { - ERROR("Warnung! %i %i %i %f\n", h, k, l, d/1e9); - continue; - } - - snr = max/bg; - snrs[bin] += snr; - counts[bin]++; - - } while ( !done ); - - } while ( !rval ); - - /* Print out results */ - overall_snr = 0.0; - overall_counts = 0; - for ( i=0; i0 ) { - overall_snr += snrs[i]; - overall_counts += counts[i]; - } - - } - - printf("Overall: %f (%f / %i)\n", overall_snr/(double)overall_counts, - overall_snr, overall_counts); - - - fclose(fh); - - return 0; -} -- cgit v1.2.3