From 51cbfe0995cb1c3206841f8a33b75bd64447cb4e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 30 Nov 2010 16:39:15 +0100 Subject: facetron: Placeholders for HRS scaling --- src/Makefile.am | 5 +- src/Makefile.in | 8 ++-- src/facetron.c | 141 ++++++++++++++------------------------------------------ 3 files changed, 43 insertions(+), 111 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5599da98..6031e441 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ calibrate_detector_LDADD = @LIBS@ facetron_SOURCES = facetron.c cell.c hdf5-file.c utils.c detector.c peaks.c \ image.c geometry.c reflections.c stream.c thread-pool.c \ - beam-parameters.c symmetry.c post-refinement.c + beam-parameters.c symmetry.c post-refinement.c hrs-scaling.c facetron_LDADD = @LIBS@ cubeit_SOURCES = cubeit.c cell.c hdf5-file.c utils.c detector.c render.c \ @@ -87,4 +87,5 @@ EXTRA_DIST = cell.h hdf5-file.h image.h utils.h diffraction.h detector.h \ render.h hdfsee.h dirax.h peaks.h index.h filters.h \ diffraction-gpu.h cl-utils.h symmetry.h \ povray.h index-priv.h geometry.h templates.h render_hkl.h \ - stream.h thread-pool.h beam-parameters.h post-refinement.h + stream.h thread-pool.h beam-parameters.h post-refinement.h \ + hrs-scaling.h diff --git a/src/Makefile.in b/src/Makefile.in index fbdcd53c..a427a4ef 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -85,7 +85,7 @@ am_facetron_OBJECTS = facetron.$(OBJEXT) cell.$(OBJEXT) \ peaks.$(OBJEXT) image.$(OBJEXT) geometry.$(OBJEXT) \ reflections.$(OBJEXT) stream.$(OBJEXT) thread-pool.$(OBJEXT) \ beam-parameters.$(OBJEXT) symmetry.$(OBJEXT) \ - post-refinement.$(OBJEXT) + post-refinement.$(OBJEXT) hrs-scaling.$(OBJEXT) facetron_OBJECTS = $(am_facetron_OBJECTS) facetron_DEPENDENCIES = am_get_hkl_OBJECTS = get_hkl.$(OBJEXT) sfac.$(OBJEXT) cell.$(OBJEXT) \ @@ -325,7 +325,7 @@ calibrate_detector_SOURCES = calibrate_detector.c utils.c hdf5-file.c image.c \ calibrate_detector_LDADD = @LIBS@ facetron_SOURCES = facetron.c cell.c hdf5-file.c utils.c detector.c peaks.c \ image.c geometry.c reflections.c stream.c thread-pool.c \ - beam-parameters.c symmetry.c post-refinement.c + beam-parameters.c symmetry.c post-refinement.c hrs-scaling.c facetron_LDADD = @LIBS@ cubeit_SOURCES = cubeit.c cell.c hdf5-file.c utils.c detector.c render.c \ @@ -346,7 +346,8 @@ EXTRA_DIST = cell.h hdf5-file.h image.h utils.h diffraction.h detector.h \ render.h hdfsee.h dirax.h peaks.h index.h filters.h \ diffraction-gpu.h cl-utils.h symmetry.h \ povray.h index-priv.h geometry.h templates.h render_hkl.h \ - stream.h thread-pool.h beam-parameters.h post-refinement.h + stream.h thread-pool.h beam-parameters.h post-refinement.h \ + hrs-scaling.h all: all-am @@ -487,6 +488,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_hkl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdf5-file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdfsee.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hrs-scaling.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indexamajig.Po@am__quote@ diff --git a/src/facetron.c b/src/facetron.c index d14141c9..38d701e6 100644 --- a/src/facetron.c +++ b/src/facetron.c @@ -33,6 +33,7 @@ #include "thread-pool.h" #include "beam-parameters.h" #include "post-refinement.h" +#include "hrs-scaling.h" /* Maximum number of iterations of NLSq to do for each image per macrocycle. */ @@ -134,26 +135,39 @@ static void refine_image(int mytask, void *tasks) } -struct integrate_args +static void refine_all(struct image *images, int n_total_patterns, + struct detector *det, const char *sym, + ReflItemList *obs, double *i_full, int nthreads, + FILE *graph, FILE *pgraph) { - const char *sym; - ReflItemList *obs; - double *i_full; - unsigned int *cts; - pthread_mutex_t *list_lock; - struct image *image; -}; + struct refine_args *tasks; + int i; + tasks = malloc(n_total_patterns * sizeof(struct refine_args)); + for ( i=0; iimage; - double nominal_photon_energy = pargs->image->beam->photon_energy; + double nominal_photon_energy = image->beam->photon_energy; hdfile = hdfile_open(image->filename); if ( hdfile == NULL ) { @@ -165,7 +179,7 @@ static void integrate_image(int mytask, void *tasks) return; } - if ( hdf5_read(hdfile, pargs->image, 0, nominal_photon_energy) ) { + if ( hdf5_read(hdfile, image, 0, nominal_photon_energy) ) { ERROR("Couldn't read '%s'\n", image->filename); hdfile_close(hdfile); return; @@ -178,10 +192,8 @@ static void integrate_image(int mytask, void *tasks) for ( j=0; josf; - - i_full_est = i_partial / spots[j].p; - - get_asymm(h, k, l, &ha, &ka, &la, pargs->sym); - - pthread_mutex_lock(pargs->list_lock); - integrate_intensity(pargs->i_full, ha, ka, la, i_full_est); - integrate_count(pargs->cts, ha, ka, la, 1); - if ( !find_item(pargs->obs, ha, ka, la) ) { - add_item(pargs->obs, ha, ka, la); - } - pthread_mutex_unlock(pargs->list_lock); } free(image->data); if ( image->flags != NULL ) free(image->flags); hdfile_close(hdfile); - free(spots); + image->cpeaks = spots; /* Muppet proofing */ image->data = NULL; @@ -225,78 +224,6 @@ static void integrate_image(int mytask, void *tasks) } -static void refine_all(struct image *images, int n_total_patterns, - struct detector *det, const char *sym, - ReflItemList *obs, double *i_full, int nthreads, - FILE *graph, FILE *pgraph) -{ - struct refine_args *tasks; - int i; - - tasks = malloc(n_total_patterns * sizeof(struct refine_args)); - for ( i=0; ih, it->k, it->l); - total /= lookup_count(cts, it->h, it->k, it->l); - set_intensity(i_full, it->h, it->k, it->l, total); - - } -} - - int main(int argc, char *argv[]) { int c; @@ -485,6 +412,9 @@ int main(int argc, char *argv[]) images[i].data = NULL; images[i].flags = NULL; + /* Get reflections from this image */ + integrate_image(&images[i]); + free(filename); progress_bar(i, n_total_patterns-1, "Loading pattern data"); @@ -496,8 +426,8 @@ int main(int argc, char *argv[]) cts = new_list_count(); /* Make initial estimates */ - estimate_full(images, n_total_patterns, det, sym, obs, i_full, cts, - nthreads); + STATUS("Performing initial scaling.\n"); + scale_intensities(images, n_total_patterns, sym); /* Iterate */ for ( i=0; i