diff options
author | Thomas White <taw@bitwiz.org.uk> | 2012-01-26 17:25:02 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:44 +0100 |
commit | 5c92f43ff2fe510abbf24669cbcc724ef9f3fcc2 (patch) | |
tree | 83ece3be3d3aafc66af5774c6372426a5d6a8c35 /libcrystfel | |
parent | 0805d18e588976f9a62f4f8ca71ef58b81df34bd (diff) |
Fix peak height going into MOSFLM, fix bug in array bounds
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/mosflm.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index 886fbd56..f9638c75 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -178,9 +178,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; - double height = 100.0; - double sigma = 1.0; - int nPeaks = image_feature_count(image->features); + int n, nPeaks; struct sptline *sptlines; fh = fopen(filename, "w"); @@ -193,9 +191,11 @@ static void write_spt(struct image *image, const char *filename) fprintf(fh, "%10d %10d\n", 1, 1); fprintf(fh, "%10.5f %10.5f\n", 0.0, 0.0); - sptlines = malloc(sizeof(struct sptline)*nPeaks); + n = image_feature_count(image->features); + sptlines = malloc(sizeof(struct sptline)*n); /* Max possible size */ - for ( i=0; i<nPeaks; i++ ) { + nPeaks = 0; + for ( i=0; i<n; i++ ) { struct imagefeature *f; struct panel *p; @@ -208,7 +208,6 @@ static void write_spt(struct image *image, const char *filename) if ( p == NULL ) continue; pix = 1000.0/p->res; /* pixel size in mm */ - height = f->intensity; xs = (f->fs-p->min_fs)*p->fsx + (f->ss-p->min_ss)*p->ssx; ys = (f->fs-p->min_fs)*p->fsy + (f->ss-p->min_ss)*p->ssy; @@ -217,8 +216,10 @@ static void write_spt(struct image *image, const char *filename) sptlines[i].x = ry*pix*fclen/p->clen/1000.0; sptlines[i].y = -rx*pix*fclen/p->clen/1000.0; - sptlines[i].h = height; - sptlines[i].s = sigma/1000.0; + sptlines[i].h = 1000.0; + sptlines[i].s = 10.0; + + nPeaks++; } |