diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-08-28 03:08:01 -0700 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:37 +0100 |
commit | 4f9b4954e3596b51540237c93174502d86204fee (patch) | |
tree | edff09c06de8d503fa9f9d7491221a77dc57c427 /src | |
parent | 464265dddc025f9f1d65715a6a2e80b988c3935b (diff) |
Don't assume width of peak table
Diffstat (limited to 'src')
-rw-r--r-- | src/hdf5-file.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 4ec11e75..7d221387 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -97,6 +97,7 @@ int get_peaks(struct image *image, struct hdfile *f) int i; float *buf; herr_t r; + int tw; dh = H5Dopen2(f->fh, "/processing/hitfinder/peakinfo", H5P_DEFAULT); @@ -124,7 +125,8 @@ int get_peaks(struct image *image, struct hdfile *f) H5Sget_simple_extent_dims(sh, size, max_size); - if ( size[1] != 3 ) { + tw = size[1]; + if ( (tw != 3) && (tw != 4) ) { H5Sclose(sh); H5Dclose(dh); ERROR("Peak list has the wrong dimensions.\n"); @@ -155,9 +157,9 @@ int get_peaks(struct image *image, struct hdfile *f) float fs, ss, val; struct panel *p; - fs = buf[3*i+0]; - ss = buf[3*i+1]; - val = buf[3*i+2]; + fs = buf[tw*i+0]; + ss = buf[tw*i+1]; + val = buf[tw*i+2]; p = find_panel(image->det, fs, ss); if ( p == NULL ) continue; |