diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/calibrate_detector.c | 4 | ||||
-rw-r--r-- | src/cubeit.c | 4 | ||||
-rw-r--r-- | src/facetron.c | 2 | ||||
-rw-r--r-- | src/geometry.c | 30 | ||||
-rw-r--r-- | src/geometry.h | 8 | ||||
-rw-r--r-- | src/image.h | 7 | ||||
-rw-r--r-- | src/indexamajig.c | 12 | ||||
-rw-r--r-- | src/peaks.c | 80 | ||||
-rw-r--r-- | src/reintegrate.c | 4 | ||||
-rw-r--r-- | src/render_hkl.c | 4 | ||||
-rw-r--r-- | src/templates.c | 22 |
11 files changed, 89 insertions, 88 deletions
diff --git a/src/calibrate_detector.c b/src/calibrate_detector.c index 0d613849..5ca468c6 100644 --- a/src/calibrate_detector.c +++ b/src/calibrate_detector.c @@ -168,8 +168,8 @@ static void add_image(void *args, int cookie) image.flags = NULL; image.indexed_cell = NULL; image.filename = pargs->filename; - image.hits = NULL; - image.n_hits = 0; + image.cpeaks = NULL; + image.n_cpeaks = 0; image.det = NULL; /* View head-on (unit cell is tilted) */ diff --git a/src/cubeit.c b/src/cubeit.c index ebb21151..ad78704e 100644 --- a/src/cubeit.c +++ b/src/cubeit.c @@ -216,8 +216,8 @@ static void sum_image(void *pg, int cookie) image.flags = NULL; image.indexed_cell = NULL; image.filename = apargs->filename; - image.hits = NULL; - image.n_hits = 0; + image.cpeaks = NULL; + image.n_cpeaks = 0; image.det = pargs->det; /* View head-on (unit cell is tilted) */ diff --git a/src/facetron.c b/src/facetron.c index fa9754e4..9bef1682 100644 --- a/src/facetron.c +++ b/src/facetron.c @@ -87,7 +87,7 @@ static void integrate_image(int mytask, void *tasks) { struct integrate_args *all_args = tasks; struct integrate_args *pargs = &all_args[mytask]; - struct reflhit *spots; + struct cpeak *spots; int j, n; struct hdfile *hdfile; struct image *image = pargs->image; diff --git a/src/geometry.c b/src/geometry.c index 09865822..cca2d050 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -22,24 +22,24 @@ #include "peaks.h" -#define MAX_HITS (1024) +#define MAX_CPEAKS (1024) -struct reflhit *find_intersections(struct image *image, UnitCell *cell, - double divergence, double bandwidth, - int *n, int output) +struct cpeak *find_intersections(struct image *image, UnitCell *cell, + double divergence, double bandwidth, + int *n, int output) { double asx, asy, asz; double bsx, bsy, bsz; double csx, csy, csz; - struct reflhit *hits; + struct cpeak *cpeaks; int np = 0; int hmax, kmax, lmax; double mres; signed int h, k, l; - hits = malloc(sizeof(struct reflhit)*MAX_HITS); - if ( hits == NULL ) { + cpeaks = malloc(sizeof(struct cpeak)*MAX_CPEAKS); + if ( cpeaks == NULL ) { *n = 0; return NULL; } @@ -118,11 +118,11 @@ struct reflhit *find_intersections(struct image *image, UnitCell *cell, if ( !found ) continue; - hits[np].h = h; - hits[np].k = k; - hits[np].l = l; - hits[np].x = xda; - hits[np].y = yda; + cpeaks[np].h = h; + cpeaks[np].k = k; + cpeaks[np].l = l; + cpeaks[np].x = xda; + cpeaks[np].y = yda; np++; if ( output ) { @@ -134,7 +134,7 @@ struct reflhit *find_intersections(struct image *image, UnitCell *cell, } *n = np; - return hits; + return cpeaks; } @@ -145,7 +145,7 @@ double partiality(struct image *image, signed int h, signed int k, signed int l) } -double integrate_all(struct image *image, struct reflhit *hits, int n) +double integrate_all(struct image *image, struct cpeak *cpeaks, int n) { double itot = 0.0; int i; @@ -154,7 +154,7 @@ double integrate_all(struct image *image, struct reflhit *hits, int n) float x, y, intensity; - if ( integrate_peak(image, hits[i].x, hits[i].y, &x, &y, + if ( integrate_peak(image, cpeaks[i].x, cpeaks[i].y, &x, &y, &intensity, NULL, NULL, 0, 0) ) continue; itot += intensity; diff --git a/src/geometry.h b/src/geometry.h index 3e25a8a3..8ebfc1b2 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -17,13 +17,13 @@ #include <config.h> #endif -extern struct reflhit *find_intersections(struct image *image, UnitCell *cell, - double divergence, double bandwidth, - int *n, int output); +extern struct cpeak *find_intersections(struct image *image, UnitCell *cell, + double divergence, double bandwidth, + int *n, int output); extern double partiality(struct image *image, signed int h, signed int k, signed int l); -extern double integrate_all(struct image *image, struct reflhit *hits, int n); +extern double integrate_all(struct image *image, struct cpeak *cpeaks, int n); #endif /* GEOMETRY_H */ diff --git a/src/image.h b/src/image.h index 71bf0d3a..4f5052bb 100644 --- a/src/image.h +++ b/src/image.h @@ -58,7 +58,8 @@ struct imagefeature { typedef struct _imagefeaturelist ImageFeatureList; -struct reflhit { +/* This structure represents a predicted peak in an image */ +struct cpeak { signed int h; signed int k; signed int l; @@ -79,8 +80,8 @@ struct image { int ncells; struct detector *det; char *filename; - struct reflhit *hits; - int n_hits; + struct cpeak *cpeaks; + int n_cpeaks; int id; /* ID number of the thread * handling this image */ diff --git a/src/indexamajig.c b/src/indexamajig.c index d0260a8e..54d5e630 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -1,7 +1,7 @@ /* * indexamajig.c * - * Find hits, index patterns, output hkl+intensity etc. + * Index patterns, output hkl+intensity etc. * * (c) 2006-2010 Thomas White <taw@physics.org> * @@ -258,8 +258,8 @@ static struct image *get_simage(struct image *template, int alternate) image->f0 = template->f0; /* Prevent muppetry */ - image->hits = NULL; - image->n_hits = 0; + image->cpeaks = NULL; + image->n_cpeaks = 0; return image; } @@ -317,8 +317,8 @@ static void process_image(void *pp, int cookie) image.indexed_cell = NULL; image.id = cookie; image.filename = filename; - image.hits = NULL; - image.n_hits = 0; + image.cpeaks = NULL; + image.n_cpeaks = 0; image.det = pargs->static_args.det; /* View head-on (unit cell is tilted) */ @@ -442,7 +442,7 @@ done: free(image.data); free(image.flags); image_feature_list_free(image.features); - free(image.hits); + free(image.cpeaks); hdfile_close(hdfile); } diff --git a/src/peaks.c b/src/peaks.c index 0cf7c232..e70ebfe2 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -33,7 +33,7 @@ /* Maximum number of peaks which may be predicted by find_projected_peaks() */ -#define MAX_HITS (1024) +#define MAX_CPEAKS (1024) /* How close a peak must be to an indexed position to be considered "close" * for the purposes of double hit detection and sanity checking. */ @@ -495,12 +495,12 @@ int find_projected_peaks(struct image *image, UnitCell *cell, double ax, ay, az; double bx, by, bz; double cx, cy, cz; - struct reflhit *hits; - int n_hits = 0; + struct cpeak *cpeaks; + int n_cpeaks = 0; double alen, blen, clen; - hits = malloc(sizeof(struct reflhit)*MAX_HITS); - if ( hits == NULL ) return 0; + cpeaks = malloc(sizeof(struct cpeak)*MAX_CPEAKS); + if ( cpeaks == NULL ) return 0; /* "Borrow" direction values to get reciprocal lengths */ cell_get_reciprocal(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); @@ -547,14 +547,14 @@ int find_projected_peaks(struct image *image, UnitCell *cell, if ( dist > domain_r ) continue; } - for ( j=0; j<n_hits; j++ ) { - if ( (hits[j].h == h) && (hits[j].k == k) - && (hits[j].l == l) ) { + for ( j=0; j<n_cpeaks; j++ ) { + if ( (cpeaks[j].h == h) && (cpeaks[j].k == k) + && (cpeaks[j].l == l) ) { - if ( dist < hits[j].min_distance ) { - hits[j].min_distance = dist; - hits[j].x = x; - hits[j].y = y; + if ( dist < cpeaks[j].min_distance ) { + cpeaks[j].min_distance = dist; + cpeaks[j].x = x; + cpeaks[j].y = y; } found = 1; @@ -563,14 +563,14 @@ int find_projected_peaks(struct image *image, UnitCell *cell, } if ( !found ) { - hits[n_hits].min_distance = dist; - hits[n_hits].x = x; - hits[n_hits].y = y; - hits[n_hits].h = h; - hits[n_hits].k = k; - hits[n_hits].l = l; - n_hits++; - if ( n_hits == MAX_HITS ) { + cpeaks[n_cpeaks].min_distance = dist; + cpeaks[n_cpeaks].x = x; + cpeaks[n_cpeaks].y = y; + cpeaks[n_cpeaks].h = h; + cpeaks[n_cpeaks].k = k; + cpeaks[n_cpeaks].l = l; + n_cpeaks++; + if ( n_cpeaks == MAX_CPEAKS ) { ERROR("Unit cell is insanely large!\n"); goto out; } @@ -580,11 +580,11 @@ int find_projected_peaks(struct image *image, UnitCell *cell, } out: - STATUS("Found %i reflections\n", n_hits); - image->hits = hits; - image->n_hits = n_hits; + STATUS("Found %i reflections\n", n_cpeaks); + image->cpeaks = cpeaks; + image->n_cpeaks = n_cpeaks; - return n_hits; + return n_cpeaks; } @@ -710,10 +710,10 @@ void output_intensities(struct image *image, UnitCell *cell, double bsx, bsy, bsz; double csx, csy, csz; - if ( image->n_hits == 0 ) { + if ( image->n_cpeaks == 0 ) { find_projected_peaks(image, cell, circular_domain, domain_r); } - if ( image->n_hits == 0 ) return; + if ( image->n_cpeaks == 0 ) return; /* Get exclusive access to the output stream if necessary */ if ( mutex != NULL ) pthread_mutex_lock(mutex); @@ -724,7 +724,7 @@ void output_intensities(struct image *image, UnitCell *cell, &bsx, &bsy, &bsz, &csx, &csy, &csz); - for ( i=0; i<image->n_hits; i++ ) { + for ( i=0; i<image->n_cpeaks; i++ ) { float x, y, intensity; double d; @@ -738,8 +738,8 @@ void output_intensities(struct image *image, UnitCell *cell, if ( image->features != NULL ) { f = image_feature_closest(image->features, - image->hits[i].x, - image->hits[i].y, + image->cpeaks[i].x, + image->cpeaks[i].y, &d, &idx); } else { f = NULL; @@ -773,8 +773,8 @@ void output_intensities(struct image *image, UnitCell *cell, int r; r = integrate_peak(image, - image->hits[i].x, - image->hits[i].y, + image->cpeaks[i].x, + image->cpeaks[i].y, &x, &y, &intensity, &bg, &max, polar, sa); if ( r ) { @@ -794,8 +794,8 @@ void output_intensities(struct image *image, UnitCell *cell, int r; r = integrate_peak(image, - image->hits[i].x, - image->hits[i].y, + image->cpeaks[i].x, + image->cpeaks[i].y, &x, &y, &intensity, &bg, &max, polar, sa); if ( r ) { @@ -808,11 +808,11 @@ void output_intensities(struct image *image, UnitCell *cell, /* Write h,k,l, integrated intensity and centroid coordinates */ fprintf(ofh, "%3i %3i %3i %6f (at %5.2f,%5.2f) max=%6f bg=%6f\n", - image->hits[i].h, image->hits[i].k, image->hits[i].l, + image->cpeaks[i].h, image->cpeaks[i].k, image->cpeaks[i].l, intensity, x, y, max, bg); - image->hits[i].x = x; - image->hits[i].y = y; + image->cpeaks[i].x = x; + image->cpeaks[i].y = y; } @@ -826,12 +826,12 @@ void output_intensities(struct image *image, UnitCell *cell, if ( f == NULL ) continue; - for ( j=0; j<image->n_hits; j++ ) { + for ( j=0; j<image->n_cpeaks; j++ ) { double d; - d = pow(image->hits[j].x-f->x, 2.0) - + pow(image->hits[j].y-f->y, 2.0); + d = pow(image->cpeaks[j].x-f->x, 2.0) + + pow(image->cpeaks[j].y-f->y, 2.0); if ( d < PEAK_CLOSE ) n_foundclose++; @@ -842,7 +842,7 @@ void output_intensities(struct image *image, UnitCell *cell, fprintf(ofh, "Peak statistics: %i peaks found by the peak search out of " "%i were close to indexed positions. " "%i indexed positions out of %i were close to detected peaks.\n", - n_foundclose, n_found, n_indclose, image->n_hits); + n_foundclose, n_found, n_indclose, image->n_cpeaks); fprintf(ofh, "%i integrations using indexed locations were aborted because " "they hit one or more bad pixels.\n", n_veto); fprintf(ofh, "%i integrations using peak search locations were aborted " diff --git a/src/reintegrate.c b/src/reintegrate.c index 43db6092..c9de3338 100644 --- a/src/reintegrate.c +++ b/src/reintegrate.c @@ -108,8 +108,8 @@ static void process_image(void *pg, int cookie) image.flags = NULL; image.indexed_cell = NULL; image.filename = apargs->filename; - image.hits = NULL; - image.n_hits = 0; + image.cpeaks = NULL; + image.n_cpeaks = 0; image.det = pargs->det; /* View head-on (unit cell is tilted) */ diff --git a/src/render_hkl.c b/src/render_hkl.c index e333da7f..4b077ba7 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -63,9 +63,9 @@ static void show_help(const char *s) " according to:\n" " I : the intensity of the reflection.\n" " sqrtI : the square root of the intensity.\n" -" count : the number of hits for the reflection.\n" +" count : the number of measurements for the reflection.\n" " (after correcting for 'epsilon')\n" -" rawcts : the raw number of hits for the\n" +" rawcts : the raw number of measurements for the\n" " reflection (no 'epsilon' correction).\n" "\n" " --colour-key Draw (only) the key for the current colour scale.\n" diff --git a/src/templates.c b/src/templates.c index 468612f2..105fa755 100644 --- a/src/templates.c +++ b/src/templates.c @@ -43,7 +43,7 @@ struct template { double omega; double phi; int n; - struct reflhit *spots; + struct cpeak *spots; }; @@ -165,16 +165,16 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename, for ( phi = 0.0; phi < phi_max-phi_step; phi += phi_step ) { int n; - struct reflhit *hits; + struct cpeak *cpeaks; UnitCell *cell_rot; assert(i < n_templates); cell_rot = rotate_cell(cell, omega, phi, 0.0); - hits = find_intersections(&image, cell_rot, 5.0e-3, + cpeaks = find_intersections(&image, cell_rot, 5.0e-3, 3.0/100.0, &n, 0); - if ( hits == NULL ) { + if ( cpeaks == NULL ) { ERROR("Template calculation failed.\n"); return NULL; } @@ -182,7 +182,7 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename, priv->templates[i].omega = omega; priv->templates[i].phi = phi; priv->templates[i].n = n; - priv->templates[i].spots = hits; + priv->templates[i].spots = cpeaks; i++; free(cell_rot); @@ -228,7 +228,7 @@ static int fast_integrate_peak(struct image *image, int xp, int yp) } -static double integrate_all_rot(struct image *image, struct reflhit *hits, +static double integrate_all_rot(struct image *image, struct cpeak *cpeaks, int n, double rot) { double itot = 0.0; @@ -243,8 +243,8 @@ static double integrate_all_rot(struct image *image, struct reflhit *hits, float xp, yp; - xp = cosr*hits[i].x + sinr*hits[i].y; - yp = -sinr*hits[i].x + cosr*hits[i].y; + xp = cosr*cpeaks[i].x + sinr*cpeaks[i].y; + yp = -sinr*cpeaks[i].x + cosr*cpeaks[i].y; itot += fast_integrate_peak(image, rint(xp), rint(yp)); num_int++; @@ -257,7 +257,7 @@ static double integrate_all_rot(struct image *image, struct reflhit *hits, /* Return the mean of the distances between peaks in the image and peaks from * the given template. */ -static double mean_distance(struct image *image, struct reflhit *hits, +static double mean_distance(struct image *image, struct cpeak *cpeaks, int n, double rot) { double dtot = 0.0; @@ -275,8 +275,8 @@ static double mean_distance(struct image *image, struct reflhit *hits, int j; double min_dsq; - xp = cosr*hits[i].x + sinr*hits[i].y; - yp = -sinr*hits[i].x + cosr*hits[i].y; + xp = cosr*cpeaks[i].x + sinr*cpeaks[i].y; + yp = -sinr*cpeaks[i].x + cosr*cpeaks[i].y; /* Compare to every real peak */ min_dsq = +INFINITY; |