diff options
author | Thomas White <taw@physics.org> | 2011-09-06 12:00:40 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:37 +0100 |
commit | dcd0a59fe7d3a1a2ae509ac19b35134afb3c3526 (patch) | |
tree | 626146c17d8be782401986542673a97a5117f3af /src | |
parent | 4f9b4954e3596b51540237c93174502d86204fee (diff) |
Add --hdf5-peaks parameter to indexamajig and assemble_detector
Conflicts:
contrib/assemble_detector.c
Diffstat (limited to 'src')
-rw-r--r-- | src/hdf5-file.c | 9 | ||||
-rw-r--r-- | src/hdf5-file.h | 2 | ||||
-rw-r--r-- | src/indexamajig.c | 22 |
3 files changed, 23 insertions, 10 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 7d221387..b43297ec 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -89,7 +89,7 @@ int hdfile_set_image(struct hdfile *f, const char *path) } -int get_peaks(struct image *image, struct hdfile *f) +int get_peaks(struct image *image, struct hdfile *f, const char *p) { hid_t dh, sh; hsize_t size[2]; @@ -99,12 +99,9 @@ int get_peaks(struct image *image, struct hdfile *f) herr_t r; int tw; - dh = H5Dopen2(f->fh, "/processing/hitfinder/peakinfo", H5P_DEFAULT); - - if ( dh < 0 ) dh = H5Dopen2(f->fh, "/data/peakinfo", H5P_DEFAULT); - + dh = H5Dopen2(f->fh, p, H5P_DEFAULT); if ( dh < 0 ) { - ERROR("No peak list found!\n"); + ERROR("Peak list (%s) not found.\n", p); return 1; } diff --git a/src/hdf5-file.h b/src/hdf5-file.h index 412fe270..c0431dc6 100644 --- a/src/hdf5-file.h +++ b/src/hdf5-file.h @@ -39,7 +39,7 @@ extern int hdfile_set_first_image(struct hdfile *f, const char *group); extern void hdfile_close(struct hdfile *f); extern char *hdfile_get_string_value(struct hdfile *f, const char *name); -extern int get_peaks(struct image *image, struct hdfile *f); +extern int get_peaks(struct image *image, struct hdfile *f, const char *p); extern double get_value(struct hdfile *f, const char *name); #endif /* HDF5_H */ diff --git a/src/indexamajig.c b/src/indexamajig.c index e69025e0..c94ad959 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -75,6 +75,7 @@ struct static_index_args int cellr; struct beam_params *beam; const char *element; + const char *hdf5_peak_path; /* Output stream */ pthread_mutex_t *output_mutex; /* Protects the output stream */ @@ -142,8 +143,9 @@ static void show_help(const char *s) " --peaks=<method> Use 'method' for finding peaks. Choose from:\n" " zaef : Use Zaefferer (2000) gradient detection.\n" " This is the default method.\n" -" hdf5 : Get from /processing/hitfinder/peakinfo\n" -" in the HDF5 file.\n" +" hdf5 : Get from a table in HDF5 file.\n" +" --hdf5-peaks=<p> Find peaks table in HDF5 file here.\n" +" Default: /processing/hitfinder/peakinfo\n" "\n\n" "You can control what information is included in the output stream using\n" "' --record=<flag1>,<flag2>,<flag3>' and so on. Possible flags are:\n\n" @@ -294,7 +296,9 @@ static void process_image(void *pp, int cookie) { case PEAK_HDF5 : /* Get peaks from HDF5 */ - if ( get_peaks(&image, hdfile) ) { + if ( get_peaks(&image, hdfile, + pargs->static_args.hdf5_peak_path) ) + { ERROR("Failed to get peaks from HDF5 file.\n"); } break; @@ -527,6 +531,7 @@ int main(int argc, char *argv[]) int cpu_groupsize = 1; int cpu_offset = 0; char *endptr; + char *hdf5_peak_path = NULL; /* Long options */ const struct option longopts[] = { @@ -560,6 +565,7 @@ int main(int argc, char *argv[]) {"cpuoffset", 1, NULL, 8}, {"bg-sub", 0, &config_bgsub, 1}, /* Compat */ {"no-bg-sub", 0, &config_bgsub, 0}, + {"hdf5-peaks", 1, NULL, 9}, {0, 0, NULL, 0} }; @@ -670,6 +676,10 @@ int main(int argc, char *argv[]) } break; + case 9 : + hdf5_peak_path = strdup(optarg); + break; + case 0 : break; @@ -714,6 +724,10 @@ int main(int argc, char *argv[]) } free(outfile); + if ( hdf5_peak_path == NULL ) { + hdf5_peak_path = strdup("/processing/hitfinder/peakinfo"); + } + if ( speaks == NULL ) { speaks = strdup("zaef"); STATUS("You didn't specify a peak detection method.\n"); @@ -879,6 +893,7 @@ int main(int argc, char *argv[]) qargs.static_args.beam = beam; qargs.static_args.element = element; qargs.static_args.stream_flags = stream_flags; + qargs.static_args.hdf5_peak_path = hdf5_peak_path; qargs.fh = fh; qargs.prefix = prefix; @@ -901,6 +916,7 @@ int main(int argc, char *argv[]) free_detector_geometry(det); free(beam); free(element); + free(hdf5_peak_path); cell_free(cell); if ( fh != stdin ) fclose(fh); if ( ofh != stdout ) fclose(ofh); |