diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pattern_sim.c | 3 | ||||
-rw-r--r-- | src/peaks.c | 14 | ||||
-rw-r--r-- | src/peaks.h | 1 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c index 130b6681..39931bdb 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -320,6 +320,8 @@ int main(int argc, char *argv[]) image.lambda = ph_en_to_lambda(eV_to_J(PHOTON_ENERGY)); /* Wavelength */ cell = load_cell_from_pdb(filename); image.filename = NULL; + image.features = NULL; + image.flags = NULL; #include "geometry-lcls.tmp" @@ -382,6 +384,7 @@ int main(int argc, char *argv[]) record_image(&image, !config_nonoise); if ( config_nearbragg ) { + find_projected_peaks(&image, cell); output_intensities(&image, cell, NULL, 1); } diff --git a/src/peaks.c b/src/peaks.c index c6b79d25..68482e94 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -167,6 +167,9 @@ static int integrate_peak(struct image *image, int xp, int yp, } p = find_panel(&image->det, x+xp, y+yp); + if ( p == NULL ) { + return 1; + } /* Area of one pixel */ pix_area = pow(1.0/p->res, 2.0); @@ -396,7 +399,7 @@ void dump_peaks(struct image *image, pthread_mutex_t *mutex) } -static int find_projected_peaks(struct image *image, UnitCell *cell) +int find_projected_peaks(struct image *image, UnitCell *cell) { int x, y; double ax, ay, az; @@ -561,8 +564,13 @@ void output_intensities(struct image *image, UnitCell *cell, struct imagefeature *f; /* Wait.. is there a really close feature which was detected? */ - f = image_feature_closest(image->features, hits[i].x, hits[i].y, - &d, &idx); + if ( image->features != NULL ) { + f = image_feature_closest(image->features, + hits[i].x, hits[i].y, + &d, &idx); + } else { + f = NULL; + } if ( (f != NULL) && (d < PEAK_REALLY_CLOSE) ) { int r; diff --git a/src/peaks.h b/src/peaks.h index 10cf5b0a..3335761c 100644 --- a/src/peaks.h +++ b/src/peaks.h @@ -24,5 +24,6 @@ extern void dump_peaks(struct image *image, pthread_mutex_t *mutex); extern void output_intensities(struct image *image, UnitCell *cell, pthread_mutex_t *mutex, int unpolar); extern int peak_sanity_check(struct image *image, UnitCell *cell); +extern int find_projected_peaks(struct image *image, UnitCell *cell); #endif /* PEAKS_H */ |