Commit dcd0a59f authored by Thomas White's avatar Thomas White
Browse files

Add --hdf5-peaks parameter to indexamajig and assemble_detector

Conflicts:

	contrib/assemble_detector.c
parent 4f9b4954
......@@ -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;
}
......
......@@ -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 */
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment