aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-05 10:19:52 +0200
committerThomas White <taw@bitwiz.org.uk>2010-06-05 10:19:52 +0200
commitea369696428af621a3acfd53791d9c98d4402584 (patch)
treeb1a30c1765a31fde97ee01dc15d17963bb56e4c0
parent3f4cf9279f0ff766448e3308d49e5cae58b6ef61 (diff)
parent765e6971f3c278374c32c89f63308b70915709ab (diff)
Merge branch 'master' of git.bitwiz.org.uk:crystfel
-rw-r--r--src/hdf5-file.c11
-rw-r--r--src/pattern_sim.c3
-rw-r--r--src/peaks.c14
-rw-r--r--src/peaks.h1
4 files changed, 25 insertions, 4 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index 4272cbe6..a5fc7d26 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -45,6 +45,9 @@ struct hdfile *hdfile_open(const char *filename)
f = malloc(sizeof(struct hdfile));
if ( f == NULL ) return NULL;
+ /* Please stop spamming my terminal */
+ H5Eset_auto(H5E_DEFAULT, NULL, NULL);
+
f->fh = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
if ( f->fh < 0 ) {
ERROR("Couldn't open file: %s\n", filename);
@@ -239,6 +242,11 @@ static void debodge_saturation(struct hdfile *f, struct image *image)
dh = H5Dopen(f->fh, "/processing/hitfinder/peakinfo_saturated",
H5P_DEFAULT);
+ if ( dh < 0 ) {
+ ERROR("Couldn't open saturation table.\n");
+ return;
+ }
+
sh = H5Dget_space(dh);
if ( sh < 0 ) {
H5Dclose(dh);
@@ -341,6 +349,7 @@ int hdf5_read(struct hdfile *f, struct image *image)
mask_dh = H5Dopen(f->fh, "/processing/hitfinder/masks", H5P_DEFAULT);
if ( mask_dh <= 0 ) {
ERROR("Couldn't open flags\n");
+ image->flags = NULL;
} else {
flags = malloc(sizeof(uint16_t)*f->nx*f->ny);
r = H5Dread(mask_dh, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL,
@@ -351,8 +360,8 @@ int hdf5_read(struct hdfile *f, struct image *image)
} else {
image->flags = flags;
}
+ H5Dclose(mask_dh);
}
- H5Dclose(mask_dh);
/* Read wavelength from file */
image->lambda = get_wavelength(f);
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 */