From a6694b45f16a768951f320a235a1f51b7790e65f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 26 Jan 2012 17:27:34 -0800 Subject: Remove redundant sort before MOSFLM --- libcrystfel/src/mosflm.c | 47 +++++------------------------------------------ 1 file changed, 5 insertions(+), 42 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index f9638c75..6286b9e8 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -150,26 +150,6 @@ static int read_newmat(const char *filename, struct image *image) } -/* Need to sort mosflm peaks by intensity... */ -struct sptline { - double x; /* x coordinate of peak */ - double y; /* y coordinate of peak */ - double h; /* height of peak */ - double s; /* sigma of peak */ -}; - - -static int compare_vals(const void *ap, const void *bp) -{ - const struct sptline a = *(struct sptline *)ap; - const struct sptline b = *(struct sptline *)bp; - - if ( a.h < b.h ) return 1; - if ( a.h > b.h ) return -1; - return 0; -} - - /* Write .spt file for mosflm */ static void write_spt(struct image *image, const char *filename) { @@ -178,8 +158,7 @@ static void write_spt(struct image *image, const char *filename) double fclen = 67.8; /* fake camera length in mm */ double fpix = 0.075; /* fake pixel size in mm */ double pix; - int n, nPeaks; - struct sptline *sptlines; + int n; fh = fopen(filename, "w"); if ( !fh ) { @@ -192,14 +171,11 @@ static void write_spt(struct image *image, const char *filename) fprintf(fh, "%10.5f %10.5f\n", 0.0, 0.0); n = image_feature_count(image->features); - sptlines = malloc(sizeof(struct sptline)*n); /* Max possible size */ - - nPeaks = 0; for ( i=0; ifeatures, i); if ( f == NULL ) continue; @@ -214,27 +190,14 @@ static void write_spt(struct image *image, const char *filename) rx = xs + p->cnx; ry = ys + p->cny; - sptlines[i].x = ry*pix*fclen/p->clen/1000.0; - sptlines[i].y = -rx*pix*fclen/p->clen/1000.0; - sptlines[i].h = 1000.0; - sptlines[i].s = 10.0; - - nPeaks++; - - } - - qsort(sptlines, nPeaks, sizeof(struct sptline), compare_vals); - - for ( i=0; iclen/1000.0; + y = -rx*pix*fclen/p->clen/1000.0; fprintf(fh, "%10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", - sptlines[i].x, sptlines[i].y, 0.0, 0.0, - sptlines[i].h, sptlines[i].s); + x, y, 0.0, 0.0, 1000.0, 10.0); } - free(sptlines); - fprintf(fh,"%10.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", -999.0,-999.0,-999.0,-999.0,-999.0,-999.0); fclose(fh); -- cgit v1.2.3