aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5-file.c
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 /src/hdf5-file.c
parent3f4cf9279f0ff766448e3308d49e5cae58b6ef61 (diff)
parent765e6971f3c278374c32c89f63308b70915709ab (diff)
Merge branch 'master' of git.bitwiz.org.uk:crystfel
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r--src/hdf5-file.c11
1 files changed, 10 insertions, 1 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);