aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-08-10 12:09:33 +0200
committerThomas White <taw@physics.org>2016-08-10 12:09:33 +0200
commitdd5d51821a47a822a3c707143ff3979e566cfbbb (patch)
tree801edd7e95df6e93ae7d1319171c024e8e047bd5
parent838283a04af3338799acdd5eba79ce3b3042635a (diff)
Allow peak table location to be given in geometry file
-rw-r--r--doc/man/crystfel_geometry.54
-rw-r--r--doc/reference/libcrystfel/CrystFEL-sections.txt1
-rw-r--r--libcrystfel/src/detector.c18
-rw-r--r--libcrystfel/src/detector.h4
-rw-r--r--src/indexamajig.c30
5 files changed, 44 insertions, 13 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5
index 7588bde6..ed3b6a68 100644
--- a/doc/man/crystfel_geometry.5
+++ b/doc/man/crystfel_geometry.5
@@ -285,6 +285,10 @@ the second value in the data block to the second event in the file, etc. See als
Sometimes the photon energy value recorded in an HDF5 file differs from the true photon energy value by a multiplication factor. This property defines a correction factor that is applied by the CrystFEL programs. The photon energy value read from a file is multiplied by the value of this property if the property is defined in the geometry file.
+.SH PEAK INFO LOCATION
+
+Finally, the geometry file can include information about where to look in the HDF5 or CXI files for the table of peak positions. CrystFEL can use these peak locations for indexing. Simply include \fBpeak_info_location\fR = \fIlocation\fR, where \fIlocation\fR could be something like /processing/hitfinder/peakinfo. A peak location given on the indexamajig command line, e.g. \fB--hdf5-peaks=/some/location\fR, has priority over the location in the geometry file. If neither the geometry file nor the command line specify a location, the default is \fB/processing/hitfinder/peakinfo\fR when \fB--peaks=hdf5\fR is used, and \fB/entry_1/result_1\fR when \fB--peaks=cxi\fR is used.
+
.SH AUTHOR
This page was written by Thomas White and Valerio Mariani.
diff --git a/doc/reference/libcrystfel/CrystFEL-sections.txt b/doc/reference/libcrystfel/CrystFEL-sections.txt
index 57f508c4..4cd922d2 100644
--- a/doc/reference/libcrystfel/CrystFEL-sections.txt
+++ b/doc/reference/libcrystfel/CrystFEL-sections.txt
@@ -354,6 +354,7 @@ copy_geom
fill_in_values
free_detector_geometry
get_detector_geometry
+get_detector_geometry_2
write_detector_geometry
write_detector_geometry_2
find_panel
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index f90e1a92..4262f4be 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -1051,7 +1051,7 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam,
const char *key, const char *val,
struct rg_definition ***rg_defl,
struct rgc_definition ***rgc_defl, int *n_rg_defs,
- int *n_rgc_defs)
+ int *n_rgc_defs, char **hdf5_peak_path)
{
if ( strcmp(key, "mask_bad") == 0 ) {
@@ -1091,6 +1091,11 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam,
beam->photon_energy_scale = atof(val);
}
+ } else if ( strcmp(key, "peak_info_location") == 0 ) {
+ if ( hdf5_peak_path != NULL ) {
+ *hdf5_peak_path = strdup(val);
+ }
+
} else if (strncmp(key, "rigid_group", 11) == 0
&& strncmp(key, "rigid_group_collection", 22) != 0 ) {
@@ -1179,10 +1184,17 @@ static void find_min_max_d(struct detector *det)
}
}
-
struct detector *get_detector_geometry(const char *filename,
struct beam_params *beam)
{
+ return get_detector_geometry_2(filename, beam, NULL);
+}
+
+
+struct detector *get_detector_geometry_2(const char *filename,
+ struct beam_params *beam,
+ char **hdf5_peak_path)
+{
FILE *fh;
struct detector *det;
char *rval;
@@ -1301,7 +1313,7 @@ struct detector *get_detector_geometry(const char *filename,
/* This was a top-level option, not handled above. */
parse_toplevel(det, beam, bits[0], bits[2], &rg_defl,
&rgc_defl, &n_rg_definitions,
- &n_rgc_definitions);
+ &n_rgc_definitions, hdf5_peak_path);
for ( i=0; i<n1; i++ ) free(bits[i]);
free(bits);
for ( i=0; i<n2; i++ ) free(path[i]);
diff --git a/libcrystfel/src/detector.h b/libcrystfel/src/detector.h
index 61fc4901..04e3c1ec 100644
--- a/libcrystfel/src/detector.h
+++ b/libcrystfel/src/detector.h
@@ -212,6 +212,10 @@ extern int panel_number(struct detector *det, struct panel *p);
extern struct detector *get_detector_geometry(const char *filename,
struct beam_params *beam);
+extern struct detector *get_detector_geometry_2(const char *filename,
+ struct beam_params *beam,
+ char **hdf5_peak_path);
+
extern void free_detector_geometry(struct detector *det);
extern struct detector *simple_geometry(const struct image *image, int w, int h);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9b32900f..a1997b9e 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -200,6 +200,7 @@ int main(int argc, char *argv[])
int have_push_res = 0;
int len;
int no_refine = 0;
+ char *command_line_peak_path = NULL;
/* Defaults */
iargs.cell = NULL;
@@ -394,8 +395,8 @@ int main(int argc, char *argv[])
break;
case 9 :
- free(iargs.hdf5_peak_path);
- iargs.hdf5_peak_path = strdup(optarg);
+ free(command_line_peak_path);
+ command_line_peak_path = strdup(optarg);
break;
case 10 :
@@ -549,13 +550,6 @@ int main(int argc, char *argv[])
return 1;
}
free(speaks);
- if ( iargs.hdf5_peak_path == NULL ) {
- if ( iargs.peaks == PEAK_HDF5 ) {
- iargs.hdf5_peak_path = strdup("/processing/hitfinder/peakinfo");
- } else if ( iargs.peaks == PEAK_CXI ) {
- iargs.hdf5_peak_path = strdup("/entry_1/result_1");
- }
- }
/* Check prefix (if given) */
if ( prefix == NULL ) {
@@ -573,7 +567,8 @@ int main(int argc, char *argv[])
}
/* Load detector geometry */
- iargs.det = get_detector_geometry(geom_filename, iargs.beam);
+ iargs.det = get_detector_geometry_2(geom_filename, iargs.beam,
+ &iargs.hdf5_peak_path);
if ( iargs.det == NULL ) {
ERROR("Failed to read detector geometry from '%s'\n",
geom_filename);
@@ -581,6 +576,21 @@ int main(int argc, char *argv[])
}
add_geom_beam_stuff_to_copy_hdf5(iargs.copyme, iargs.det, iargs.beam);
+ /* If no peak path from geometry file, use these (but see later) */
+ if ( iargs.hdf5_peak_path == NULL ) {
+ if ( iargs.peaks == PEAK_HDF5 ) {
+ iargs.hdf5_peak_path = strdup("/processing/hitfinder/peakinfo");
+ } else if ( iargs.peaks == PEAK_CXI ) {
+ iargs.hdf5_peak_path = strdup("/entry_1/result_1");
+ }
+ }
+
+ /* If an HDF5 peak path was given on the command line, use it */
+ if ( command_line_peak_path != NULL ) {
+ free(iargs.hdf5_peak_path);
+ iargs.hdf5_peak_path = command_line_peak_path;
+ }
+
/* Parse indexing methods */
if ( indm_str == NULL ) {