aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog40
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac1
-rw-r--r--doc/examples/Eiger16M-binning2-nativefiles.geom55
-rw-r--r--doc/man/compare_hkl.14
-rw-r--r--libcrystfel/src/asdf.c2
-rw-r--r--libcrystfel/src/cell-utils.c6
-rw-r--r--libcrystfel/src/cell.c10
-rw-r--r--libcrystfel/src/detector.c7
-rw-r--r--libcrystfel/src/events.c3
-rw-r--r--libcrystfel/src/image.c1
-rw-r--r--libcrystfel/src/index.c391
-rw-r--r--libcrystfel/src/index.h26
-rw-r--r--libcrystfel/src/reflist-utils.c2
-rw-r--r--libcrystfel/src/statistics.c1
-rw-r--r--libcrystfel/src/stream.c8
-rw-r--r--scripts/turbo-index-lsf (renamed from scripts/turbo-index)5
-rwxr-xr-xscripts/turbo-index-slurm85
-rw-r--r--src/cell_explorer.c11
-rw-r--r--src/compare_hkl.c30
-rw-r--r--src/geoptimiser.c2
-rw-r--r--src/get_hkl.c4
-rw-r--r--src/im-sandbox.c2
-rw-r--r--src/indexamajig.c67
-rw-r--r--src/merge.c5
-rw-r--r--src/partialator.c6
-rw-r--r--src/process_hkl.c3
-rw-r--r--src/process_image.c3
-rw-r--r--src/process_image.h3
29 files changed, 540 insertions, 248 deletions
diff --git a/ChangeLog b/ChangeLog
index 86788368..4d9dec0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+Changes in this development version
+-----------------------------------
+
+- indexamajig: Hung worker processes will now be detected and killed.
+- Detector panels no longer need to be perpendicular to the X-ray beam.
+- Detector "rail" direction ("camera length" axis) no longer needs to be along
+ the X-ray beam direction.
+- Lattice parameters are now checked after prediction refinement as well as before.
+- Multi-event HDF5 files can now contain peak lists.
+- The peak list location can now be given in geometry file (instead of --hdf5-peaks)
+- The number of detector units per photon (rather than per eV) can now be
+ specified in the geometry file.
+- indexamajig: Small changes to how peaks from HDF5 files are checked.
+- compare_hkl --fom=d1sig and d2sig were fixed.
+- compare_hkl --min-measurements was added.
+- New polarisation correction.
+- Reflection data files now contain audit information (CrystFEL version number
+ and command line parameters).
+- Improvements to enumeration of events in multi-event files
+- scripts/detector-shift: Show a heat map, handle different panel resolutions
+ correctly
+- Add scripts/move-entire-detector, scripts/split-by-mask and
+ scripts/peakogram-stream
+- scripts/turbo-index was renamed to turbo-index-lsf, and turbo-index-slurm
+ was added.
+- An example geometry file for Eiger was added.
+- Multiple bug fixes for asdf indexing
+- cell_explorer: Fixed invisible Greek letters on some systems
+- Mask paths with fewer placeholders than data paths (e.g. some SACLA files)
+ are now handled properly.
+- cell_explorer: Added "Save cell" function.
+- pattern_sim: Multiple bug fixes.
+- geoptimiser: Multiple bug fixes.
+- partialator: Fixes for some edge case bugs.
+- indexamajig: Fix files left open when using XDS indexing.
+- {check,compare}_hkl: Add warnings for potentially silly option choices.
+- Remove "data slab" from detector data handling (simplifies internal data
+ structures a lot).
+
+
CrystFEL version 0.6.2, 21st March 2016
---------------------------------------
diff --git a/Makefile.am b/Makefile.am
index eb10db9c..49bb9fc8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,7 @@ crystfeldoc_DATA = doc/twin-calculator.pdf doc/examples/lcls-dec.geom \
doc/examples/cspad-cxiformat.geom \
doc/examples/pilatus.geom \
doc/examples/cell-example.cell \
+ doc/examples/Eiger16M-binning2-nativefiles.geom \
doc/hitrate.html doc/hitrate.png
EXTRA_DIST += $(crystfeldoc_DATA) doc/twin-calculator.odt \
@@ -180,9 +181,9 @@ script_DATA = scripts/alternate-stream scripts/cell-please \
scripts/find-pairs scripts/plot-cc-and-scale.R \
scripts/ave-resolution scripts/crystal-frame-number \
scripts/plot-radius-resolution \
- scripts/detector-shift scripts/turbo-index \
+ scripts/detector-shift scripts/turbo-index-lsf \
scripts/gaincal-to-saturation-map scripts/move-entire-detector \
- scripts/split-by-mask
+ scripts/split-by-mask scripts/turbo-index-slurm
EXTRA_DIST += $(script_DATA)
diff --git a/configure.ac b/configure.ac
index 8044a145..a570abe4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,7 @@ AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
gl_EARLY
AM_PROG_CC_C_O
+AC_PROG_CC_C99
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
diff --git a/doc/examples/Eiger16M-binning2-nativefiles.geom b/doc/examples/Eiger16M-binning2-nativefiles.geom
new file mode 100644
index 00000000..0a53a74e
--- /dev/null
+++ b/doc/examples/Eiger16M-binning2-nativefiles.geom
@@ -0,0 +1,55 @@
+; Example geometry file for Eiger 16M detector, using its native file format
+; and binning 2.
+
+; Camera length (in m) and photon energy (eV)
+clen = 0.1
+photon_energy = 22000
+
+; adu_per_photon needs a relatively recent CrystFEL version. If your version is
+; older, change it to adu_per_eV and set it to one over the photon energy in eV
+adu_per_photon = 1
+res = 13333.3 ; 75 micron pixel size
+
+; These lines describe the data layout for the Eiger native multi-event files
+dim0 = %
+dim1 = ss
+dim2 = fs
+data = /entry/data/data
+
+; Mask out strips between panels
+bad_v0/min_fs = 1030
+bad_v0/min_ss = 0
+bad_v0/max_fs = 1039
+bad_v0/max_ss = 2166
+
+bad_h0/min_fs = 0
+bad_h0/min_ss = 514
+bad_h0/max_fs = 2069
+bad_h0/max_ss = 550
+
+bad_h1/min_fs = 0
+bad_h1/min_ss = 1065
+bad_h1/max_fs = 2069
+bad_h1/max_ss = 1101
+
+bad_h2/min_fs = 0
+bad_h2/min_ss = 1616
+bad_h2/max_fs = 2069
+bad_h2/max_ss = 1652
+
+; Uncomment these lines if you have a separate bad pixel map (recommended!)
+;mask_file = eiger-badmap.h5
+;mask = /data/data
+;mask_good = 0x0
+;mask_bad = 0x1
+
+; corner_{x,y} set the position of the corner of the detector (in pixels)
+; relative to the beam
+panel0/min_fs = 0
+panel0/min_ss = 0
+panel0/max_fs = 2069
+panel0/max_ss = 2166
+panel0/corner_x = -1000.0
+panel0/corner_y = -1000.0
+panel0/fs = x
+panel0/ss = y
diff --git a/doc/man/compare_hkl.1 b/doc/man/compare_hkl.1
index 8e464d12..30fcd93e 100644
--- a/doc/man/compare_hkl.1
+++ b/doc/man/compare_hkl.1
@@ -72,9 +72,9 @@ Note that this figure of merit compares measurements within one data set, so it
The ratio of Rano to Rsplit, as defined above.
.IP "\fBd1sig\fR and \fBd2sig\fR"
.PD
-The fraction of differences between intensities which are within one times (for \fBd1sig\fR) and two times (for \fBd2sig\fR) the mean of the corresponding sigma(I) values.
+The fraction of differences between intensities which are within one times (for \fBd1sig\fR) and two times (for \fBd2sig\fR) the combination of the corresponding sigma(I) values.
.PP
-I1 and I2 are the intensities of the same reflection in both reflection lists. The scale factor, k, is given by sum(I1*i2) / sum(I2^2), unless you use \fB-u\fR.
+I1 and I2 are the intensities of the same reflection in both reflection lists. The two sets of reflections will be put on a common scale (linear and Debye-Waller terms) unless you use \fB-u\fR.
.RE
.PD 0
diff --git a/libcrystfel/src/asdf.c b/libcrystfel/src/asdf.c
index 49917ad9..033688ba 100644
--- a/libcrystfel/src/asdf.c
+++ b/libcrystfel/src/asdf.c
@@ -28,8 +28,6 @@
*
*/
-#define _ISOC99_SOURCE
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 69d4174a..84a14b5c 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -273,6 +273,12 @@ void cell_print(UnitCell *cell)
STATUS("c* = %10.3e %10.3e %10.3e m^-1 (modulus %10.3e m^-1)\n",
csx, csy, csz, modulus(csx, csy, csz));
+ STATUS("alpha* = %6.2f deg, beta* = %6.2f deg, "
+ "gamma* = %6.2f deg\n",
+ rad2deg(angle_between(bsx, bsy, bsz, csx, csy, csz)),
+ rad2deg(angle_between(asx, asy, asz, csx, csy, csz)),
+ rad2deg(angle_between(asx, asy, asz, bsx, bsy, bsz)));
+
STATUS("Cell representation is %s.\n", cell_rep(cell));
} else {
diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c
index ec591e24..3de61073 100644
--- a/libcrystfel/src/cell.c
+++ b/libcrystfel/src/cell.c
@@ -460,10 +460,12 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c,
case CELL_REP_RECIP:
/* Convert reciprocal -> crystallographic.
* Start by converting reciprocal -> cartesian */
- cell_invert(cell->axs, cell->ays, cell->azs,
- cell->bxs, cell->bys, cell->bzs,
- cell->cxs, cell->cys, cell->czs,
- &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz);
+ if ( cell_invert(cell->axs, cell->ays, cell->azs,
+ cell->bxs, cell->bys, cell->bzs,
+ cell->cxs, cell->cys, cell->czs,
+ &ax, &ay, &az,
+ &bx, &by, &bz,
+ &cx, &cy, &cz) ) return 1;
/* Now convert cartesian -> crystallographic */
*a = modulus(ax, ay, az);
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 8c98f79e..52e4c330 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -31,8 +31,6 @@
*
*/
-#define _ISOC99_SOURCE
-#define _GNU_SOURCE
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
@@ -2004,6 +2002,11 @@ double largest_q(struct image *image)
struct rvec q;
double tt;
+ if ( image->det == NULL ) {
+ ERROR("No detector geometry. assuming detector is infinite!\n");
+ return INFINITY;
+ }
+
q = get_q_for_panel(image->det->furthest_out_panel,
image->det->furthest_out_fs,
image->det->furthest_out_ss,
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c
index 0f170bb5..8e4eb861 100644
--- a/libcrystfel/src/events.c
+++ b/libcrystfel/src/events.c
@@ -27,9 +27,6 @@
*
*/
-#define _ISOC99_SOURCE
-#define _GNU_SOURCE
-
#include "events.h"
#include "utils.h"
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 7bb4cede..09f4958d 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -27,7 +27,6 @@
*
*/
-#define _ISOC99_SOURCE
#include <stdlib.h>
#include <assert.h>
#include <math.h>
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index a2fdb861..028ba5e9 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -58,6 +58,17 @@
#include "predict-refine.h"
+struct _indexingprivate
+{
+ UnitCell *target_cell;
+ float tolerance[4];
+
+ int n_methods;
+ IndexingMethod *methods;
+ void **engine_private;
+};
+
+
static int debug_index(struct image *image)
{
Crystal *cr = crystal_new();
@@ -71,74 +82,105 @@ static int debug_index(struct image *image)
}
-IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
- struct detector *det, float *ltl,
- const char *options)
+static void *prepare_method(IndexingMethod *m, UnitCell *cell,
+ struct detector *det, float *ltl,
+ const char *options)
{
- int n;
- int nm = 0;
- IndexingPrivate **iprivs;
+ char *str;
+ IndexingMethod in = *m;
+ void *priv = NULL;
- while ( indm[nm] != INDEXING_NONE ) nm++;
- iprivs = malloc((nm+1) * sizeof(IndexingPrivate *));
+ switch ( *m & INDEXING_METHOD_MASK ) {
- for ( n=0; n<nm; n++ ) {
+ case INDEXING_DIRAX :
+ priv = dirax_prepare(m, cell, det, ltl);
+ break;
- int i;
- IndexingMethod in;
- char *str;
+ case INDEXING_ASDF :
+ priv = asdf_prepare(m, cell, det, ltl);
+ break;
- in = indm[n];
+ case INDEXING_MOSFLM :
+ priv = mosflm_prepare(m, cell, det, ltl);
+ break;
- switch ( indm[n] & INDEXING_METHOD_MASK ) {
+ case INDEXING_XDS :
+ priv = xds_prepare(m, cell, det, ltl);
+ break;
- case INDEXING_DIRAX :
- iprivs[n] = dirax_prepare(&indm[n], cell, det, ltl);
- break;
+ case INDEXING_DEBUG :
+ priv = (IndexingPrivate *)strdup("Hello!");
+ break;
- case INDEXING_ASDF :
- iprivs[n] = asdf_prepare(&indm[n], cell, det, ltl);
- break;
+ case INDEXING_FELIX :
+ priv = felix_prepare(m, cell, det, ltl, options);
+ break;
- case INDEXING_MOSFLM :
- iprivs[n] = mosflm_prepare(&indm[n], cell, det, ltl);
- break;
+ default :
+ ERROR("Don't know how to prepare indexing method %i\n", *m);
+ break;
- case INDEXING_XDS :
- iprivs[n] = xds_prepare(&indm[n], cell, det, ltl);
- break;
+ }
- case INDEXING_DEBUG :
- iprivs[n] = (IndexingPrivate *)strdup("Hello!");
- break;
+ str = indexer_str(*m);
- case INDEXING_FELIX :
- iprivs[n] = felix_prepare(&indm[n], cell, det, ltl,
- options);
- break;
+ if ( priv == NULL ) {
+ ERROR("Failed to prepare indexing method %s\n", str);
+ free(str);
+ return NULL;
+ }
- default :
- ERROR("Don't know how to prepare indexing method %i\n",
- indm[n]);
- break;
+ STATUS("Prepared indexing method %s\n", str);
+ free(str);
- }
+ if ( in != *m ) {
+ ERROR("Note: flags were altered to take into account "
+ "the information provided and/or the limitations "
+ "of the indexing method.\nPlease check the "
+ "methods listed above carefully.\n");
+ }
+
+ return priv;
+}
- if ( iprivs[n] == NULL ) return NULL;
- str = indexer_str(indm[n]);
- STATUS("Prepared indexing method %i: %s\n", n, str);
- free(str);
+IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell,
+ struct detector *det, float *ltl,
+ int no_refine, const char *options)
+{
+ int i, n;
+ char **method_strings;
+ IndexingPrivate *ipriv;
- if ( in != indm[n] ) {
- ERROR("Note: flags were altered to take into account "
- "the information provided and/or the limitations "
- "of the indexing method.\nPlease check the "
- "methods listed above carefully.\n");
- }
+ /* Parse indexing methods */
+ n = assplode(method_list, ",", &method_strings, ASSPLODE_NONE);
+
+ IndexingMethod *methods = malloc(n * sizeof(IndexingMethod));
+ if ( methods == NULL ) {
+ ERROR("Failed to allocate indexing method list\n");
+ return NULL;
+ }
+
+ for ( i=0; i<n; i++ ) {
+ methods[i] = get_indm_from_string(method_strings[i]);
+ }
- for ( i=0; i<n; i++ ) {
- if ( indm[i] == indm[n] ) {
+ ipriv = malloc(sizeof(struct _indexingprivate));
+ if ( ipriv == NULL ) {
+ ERROR("Failed to allocate indexing data\n");
+ return NULL;
+ }
+
+ ipriv->engine_private = malloc((n+1) * sizeof(void *));
+
+ for ( i=0; i<n; i++ ) {
+
+ int j;
+
+ ipriv->engine_private[i] = prepare_method(&methods[i], cell,
+ det, ltl, options);
+ for ( j=0; j<i; j++ ) {
+ if ( methods[i] == methods[j] ) {
ERROR("Duplicate indexing method.\n");
ERROR("Have you specified some flags which "
"aren't accepted by one of your "
@@ -147,55 +189,62 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
}
}
+ }
+ ipriv->methods = methods;
+ ipriv->n_methods = n;
+
+ if ( cell != NULL ) {
+ ipriv->target_cell = cell_new_from_cell(cell);
+ } else {
+ ipriv->target_cell = NULL;
}
- iprivs[n] = NULL;
+ for ( i=0; i<4; i++ ) ipriv->tolerance[i] = ltl[i];
- return iprivs;
+ return ipriv;
}
-void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs)
+void cleanup_indexing(IndexingPrivate *ipriv)
{
- int n = 0;
+ int n;
- if ( indms == NULL ) return; /* Nothing to do */
- if ( privs == NULL ) return; /* Nothing to do */
+ if ( ipriv == NULL ) return; /* Nothing to do */
- while ( indms[n] != INDEXING_NONE ) {
+ for ( n=0; n<ipriv->n_methods; n++ ) {
- switch ( indms[n] & INDEXING_METHOD_MASK ) {
+ switch ( ipriv->methods[n] & INDEXING_METHOD_MASK ) {
case INDEXING_NONE :
break;
case INDEXING_DIRAX :
- dirax_cleanup(privs[n]);
+ dirax_cleanup(ipriv->engine_private[n]);
break;
case INDEXING_ASDF :
- asdf_cleanup(privs[n]);
+ asdf_cleanup(ipriv->engine_private[n]);
break;
case INDEXING_MOSFLM :
- mosflm_cleanup(privs[n]);
+ mosflm_cleanup(ipriv->engine_private[n]);
break;
case INDEXING_XDS :
- xds_cleanup(privs[n]);
+ xds_cleanup(ipriv->engine_private[n]);
break;
case INDEXING_FELIX :
- felix_cleanup(privs[n]);
+ felix_cleanup(ipriv->engine_private[n]);
break;
case INDEXING_DEBUG :
- free(privs[n]);
+ free(ipriv->engine_private[n]);
break;
default :
ERROR("Don't know how to clean up indexing method %i\n",
- indms[n]);
+ ipriv->methods[n]);
break;
}
@@ -204,8 +253,10 @@ void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs)
}
- free(indms);
- free(privs);
+ free(ipriv->methods);
+ free(ipriv->engine_private);
+ cell_free(ipriv->target_cell);
+ free(ipriv);
}
@@ -234,7 +285,7 @@ void map_all_peaks(struct image *image)
/* Return non-zero for "success" */
static int try_indexer(struct image *image, IndexingMethod indm,
- IndexingPrivate *ipriv)
+ IndexingPrivate *ipriv, void *mpriv)
{
int i, r;
int n_bad = 0;
@@ -245,19 +296,19 @@ static int try_indexer(struct image *image, IndexingMethod indm,
return 0;
case INDEXING_DIRAX :
- r = run_dirax(image, ipriv);
+ r = run_dirax(image, mpriv);
break;
case INDEXING_ASDF :
- r = run_asdf(image, ipriv);
+ r = run_asdf(image, mpriv);
break;
case INDEXING_MOSFLM :
- r = run_mosflm(image, ipriv);
+ r = run_mosflm(image, mpriv);
break;
case INDEXING_XDS :
- r = run_xds(image, ipriv);
+ r = run_xds(image, mpriv);
break;
case INDEXING_DEBUG :
@@ -265,7 +316,7 @@ static int try_indexer(struct image *image, IndexingMethod indm,
break;
case INDEXING_FELIX :
- r = felix_index(image, ipriv);
+ r = felix_index(image, mpriv);
break;
default :
@@ -283,11 +334,34 @@ static int try_indexer(struct image *image, IndexingMethod indm,
crystal_set_mosaicity(cr, 0.0);
/* Prediction refinement if requested */
- if ( (indm & INDEXING_REFINE)
- && (refine_prediction(image, cr) != 0) )
- {
- crystal_set_user_flag(cr, 1);
- n_bad++;
+ if ( indm & INDEXING_REFINE ) {
+
+ UnitCell *out;
+
+ if ( refine_prediction(image, cr) ) {
+ crystal_set_user_flag(cr, 1);
+ n_bad++;
+ }
+
+ if ( (indm & INDEXING_CHECK_CELL_COMBINATIONS)
+ || (indm & INDEXING_CHECK_CELL_AXES) )
+ {
+
+ /* Check that the cell parameters are still
+ * within the tolerance */
+ out = match_cell(crystal_get_cell(cr),
+ ipriv->target_cell, 0,
+ ipriv->tolerance, 0);
+
+ if ( out == NULL ) {
+ crystal_set_user_flag(cr, 1);
+ n_bad++;
+ }
+
+ cell_free(out);
+
+ }
+
}
}
@@ -421,20 +495,18 @@ static int finished_retry(IndexingMethod indm, int r, struct image *image)
}
}
-void index_pattern(struct image *image,
- IndexingMethod *indms, IndexingPrivate **iprivs)
+void index_pattern(struct image *image, IndexingPrivate *ipriv)
{
- index_pattern_2(image, indms, iprivs, NULL);
+ index_pattern_2(image, ipriv, NULL);
}
-void index_pattern_2(struct image *image, IndexingMethod *indms,
- IndexingPrivate **iprivs, int *ping)
+void index_pattern_2(struct image *image, IndexingPrivate *ipriv, int *ping)
{
int n = 0;
ImageFeatureList *orig;
- if ( indms == NULL ) return;
+ if ( ipriv == NULL ) return;
map_all_peaks(image);
image->crystals = NULL;
@@ -442,7 +514,7 @@ void index_pattern_2(struct image *image, IndexingMethod *indms,
orig = image->features;
- while ( indms[n] != INDEXING_NONE ) {
+ for ( n=0; n<ipriv->n_methods; n++ ) {
int done = 0;
int r;
@@ -453,10 +525,11 @@ void index_pattern_2(struct image *image, IndexingMethod *indms,
do {
- r = try_indexer(image, indms[n], iprivs[n]);
+ r = try_indexer(image, ipriv->methods[n],
+ ipriv, ipriv->engine_private[n]);
success += r;
ntry++;
- done = finished_retry(indms[n], r, image);
+ done = finished_retry(ipriv->methods[n], r, image);
if ( ntry > 5 ) done = 1;
if ( ping != NULL ) (*ping)++;
@@ -468,11 +541,14 @@ void index_pattern_2(struct image *image, IndexingMethod *indms,
* crystals with a different indexing method) */
if ( success ) break;
- n++;
+ }
+ if ( n < ipriv->n_methods ) {
+ image->indexed_by = ipriv->methods[n];
+ } else {
+ image->indexed_by = INDEXING_NONE;
}
- image->indexed_by = indms[n];
image->features = orig;
}
@@ -639,97 +715,118 @@ char *indexer_str(IndexingMethod indm)
}
-IndexingMethod *build_indexer_list(const char *str)
+static IndexingMethod warn_method(const char *str)
+{
+ ERROR("Indexing method must contain exactly one engine name: '%s'\n",
+ str);
+ return INDEXING_ERROR;
+}
+
+
+IndexingMethod get_indm_from_string(const char *str)
{
int n, i;
- char **methods;
- IndexingMethod *list;
- int nmeth = 0;
+ char **bits;
+ IndexingMethod method = INDEXING_NONE;
+ int have_method = 0;
- n = assplode(str, ",-", &methods, ASSPLODE_NONE);
- list = malloc((n+1)*sizeof(IndexingMethod));
+ n = assplode(str, "-", &bits, ASSPLODE_NONE);
- nmeth = -1; /* So that the first method is #0 */
for ( i=0; i<n; i++ ) {
- if ( strcmp(methods[i], "dirax") == 0) {
- list[++nmeth] = INDEXING_DEFAULTS_DIRAX;
+ if ( strcmp(bits[i], "dirax") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEFAULTS_DIRAX;
+ have_method = 1;
- } else if ( strcmp(methods[i], "asdf") == 0) {
- list[++nmeth] = INDEXING_DEFAULTS_ASDF;
+ } else if ( strcmp(bits[i], "asdf") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEFAULTS_ASDF;
+ have_method = 1;
- } else if ( strcmp(methods[i], "mosflm") == 0) {
- list[++nmeth] = INDEXING_DEFAULTS_MOSFLM;
+ } else if ( strcmp(bits[i], "mosflm") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEFAULTS_MOSFLM;
+ have_method = 1;
- } else if ( strcmp(methods[i], "xds") == 0) {
- list[++nmeth] = INDEXING_DEFAULTS_XDS;
+ } else if ( strcmp(bits[i], "xds") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEFAULTS_XDS;
+ have_method = 1;
- } else if ( strcmp(methods[i], "felix") == 0) {
- list[++nmeth] = INDEXING_DEFAULTS_FELIX;
+ } else if ( strcmp(bits[i], "felix") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEFAULTS_FELIX;
+ have_method = 1;
- } else if ( strcmp(methods[i], "none") == 0) {
- list[++nmeth] = INDEXING_NONE;
+ } else if ( strcmp(bits[i], "none") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_NONE;
+ have_method = 1;
- } else if ( strcmp(methods[i], "simulation") == 0) {
- list[++nmeth] = INDEXING_SIMULATION;
- return list;
+ } else if ( strcmp(bits[i], "simulation") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_SIMULATION;
+ return method;
- } else if ( strcmp(methods[i], "debug") == 0) {
- list[++nmeth] = INDEXING_DEBUG;
- return list;
+ } else if ( strcmp(bits[i], "debug") == 0) {
+ if ( have_method ) return warn_method(str);
+ method = INDEXING_DEBUG;
+ return method;
- } else if ( strcmp(methods[i], "raw") == 0) {
- list[nmeth] = set_raw(list[nmeth]);
+ } else if ( strcmp(bits[i], "raw") == 0) {
+ method = set_raw(method);
- } else if ( strcmp(methods[i], "bad") == 0) {
- list[nmeth] = set_bad(list[nmeth]);
+ } else if ( strcmp(bits[i], "bad") == 0) {
+ method = set_bad(method);
- } else if ( strcmp(methods[i], "comb") == 0) {
- list[nmeth] = set_comb(list[nmeth]); /* Default */
+ } else if ( strcmp(bits[i], "comb") == 0) {
+ method = set_comb(method); /* Default */
- } else if ( strcmp(methods[i], "axes") == 0) {
- list[nmeth] = set_axes(list[nmeth]);
+ } else if ( strcmp(bits[i], "axes") == 0) {
+ method = set_axes(method);
- } else if ( strcmp(methods[i], "latt") == 0) {
- list[nmeth] = set_lattice(list[nmeth]);
+ } else if ( strcmp(bits[i], "latt") == 0) {
+ method = set_lattice(method);
- } else if ( strcmp(methods[i], "nolatt") == 0) {
- list[nmeth] = set_nolattice(list[nmeth]);
+ } else if ( strcmp(bits[i], "nolatt") == 0) {
+ method = set_nolattice(method);
- } else if ( strcmp(methods[i], "cell") == 0) {
- list[nmeth] = set_cellparams(list[nmeth]);
+ } else if ( strcmp(bits[i], "cell") == 0) {
+ method = set_cellparams(method);
- } else if ( strcmp(methods[i], "nocell") == 0) {
- list[nmeth] = set_nocellparams(list[nmeth]);
+ } else if ( strcmp(bits[i], "nocell") == 0) {
+ method = set_nocellparams(method);
- } else if ( strcmp(methods[i], "retry") == 0) {
- list[nmeth] |= INDEXING_RETRY;
+ } else if ( strcmp(bits[i], "retry") == 0) {
+ method |= INDEXING_RETRY;
- } else if ( strcmp(methods[i], "noretry") == 0) {
- list[nmeth] &= ~INDEXING_RETRY;
+ } else if ( strcmp(bits[i], "noretry") == 0) {
+ method &= ~INDEXING_RETRY;
- } else if ( strcmp(methods[i], "multi") == 0) {
- list[nmeth] |= INDEXING_MULTI;
+ } else if ( strcmp(bits[i], "multi") == 0) {
+ method |= INDEXING_MULTI;
- } else if ( strcmp(methods[i], "nomulti") == 0) {
- list[nmeth] &= ~INDEXING_MULTI;
+ } else if ( strcmp(bits[i], "nomulti") == 0) {
+ method &= ~INDEXING_MULTI;
- } else if ( strcmp(methods[i], "refine") == 0) {
- list[nmeth] |= INDEXING_REFINE;
+ } else if ( strcmp(bits[i], "refine") == 0) {
+ method |= INDEXING_REFINE;
- } else if ( strcmp(methods[i], "norefine") == 0) {
- list[nmeth] &= ~INDEXING_REFINE;
+ } else if ( strcmp(bits[i], "norefine") == 0) {
+ method &= ~INDEXING_REFINE;
} else {
ERROR("Bad list of indexing methods: '%s'\n", str);
- return NULL;
+ return INDEXING_ERROR;
}
- free(methods[i]);
+ free(bits[i]);
}
- free(methods);
- list[++nmeth] = INDEXING_NONE;
+ free(bits);
+
+ if ( !have_method ) return warn_method(str);
- return list;
+ return method;
}
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index e5f7764a..8ce553ae 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -84,7 +84,7 @@
* @INDEXING_USE_LATTICE_TYPE: Use lattice type and centering information to
* guide the indexing process.
* @INDEXING_USE_CELL_PARAMETERS: Use the unit cell parameters to guide the
- * indexingprocess.
+ * indexing process.
* @INDEXING_RETRY: If the indexer doesn't succeed, delete the weakest peaks
* and try again.
* @INDEXING_MULTI: If the indexer succeeds, delete the peaks explained by the
@@ -108,6 +108,8 @@ typedef enum {
INDEXING_DEBUG = 7,
INDEXING_ASDF = 8,
+ INDEXING_ERROR = 255, /* Unrecognised indexing engine */
+
/* Bits at the top of the IndexingMethod are flags which modify the
* behaviour of the indexer. */
INDEXING_CHECK_CELL_COMBINATIONS = 256,
@@ -136,28 +138,28 @@ extern "C" {
* IndexingPrivate:
*
* This is an opaque data structure containing information needed by the
- * indexing method.
+ * indexing system.
**/
-typedef void *IndexingPrivate;
+typedef struct _indexingprivate IndexingPrivate;
-extern IndexingMethod *build_indexer_list(const char *str);
+/* Convert indexing methods to/from text */
extern char *indexer_str(IndexingMethod indm);
+extern IndexingMethod get_indm_from_string(const char *method);
#include "detector.h"
#include "cell.h"
#include "image.h"
-extern IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell,
- struct detector *det, float *ltl,
- const char *options);
+extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell,
+ struct detector *det, float *ltl,
+ int no_refine, const char *options);
-extern void index_pattern(struct image *image,
- IndexingMethod *indms, IndexingPrivate **iprivs);
+extern void index_pattern(struct image *image, IndexingPrivate *ipriv);
-extern void index_pattern_2(struct image *image, IndexingMethod *indms,
- IndexingPrivate **iprivs, int *ping);
+extern void index_pattern_2(struct image *image, IndexingPrivate *ipriv,
+ int *ping);
-extern void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs);
+extern void cleanup_indexing(IndexingPrivate *ipriv);
#ifdef __cplusplus
}
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index 4621f4f4..380a1b8a 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -27,8 +27,6 @@
*
*/
-#define _ISOC99_SOURCE
-#define _GNU_SOURCE
#include <math.h>
#include <stdio.h>
#include <assert.h>
diff --git a/libcrystfel/src/statistics.c b/libcrystfel/src/statistics.c
index 56273fdb..ccf35194 100644
--- a/libcrystfel/src/statistics.c
+++ b/libcrystfel/src/statistics.c
@@ -30,7 +30,6 @@
#include <config.h>
#endif
-#define _ISOC99_SOURCE
#include <math.h>
#include <stdlib.h>
#include <gsl/gsl_errno.h>
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index e858172e..17da74b2 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -1196,13 +1196,9 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf)
}
if ( strncmp(line, "indexed_by = ", 13) == 0 ) {
- IndexingMethod *list;
- list = build_indexer_list(line+13);
- if ( list == NULL ) {
+ image->indexed_by = get_indm_from_string(line+13);
+ if ( image->indexed_by == INDEXING_ERROR ) {
ERROR("Failed to read indexer list\n");
- } else {
- image->indexed_by = list[0];
- free(list);
}
}
diff --git a/scripts/turbo-index b/scripts/turbo-index-lsf
index c11f521e..00e4ec15 100644
--- a/scripts/turbo-index
+++ b/scripts/turbo-index-lsf
@@ -3,9 +3,9 @@
RUN=$1
NOSAMPLE=`echo $RUN | sed -e 's/\-.*$//'`
-GEOM=<name of geometry file>
+GEOM=my.geom # Name of your geometry file
-find <path to CXI files>/$RUN -name '*.cxi' > files-${RUN}.lst
+find /path/to/CXI/files/$RUN -name '*.cxi' > files-${RUN}.lst # Set location of files
list_events -i files-${RUN}.lst -g $GEOM -o events-${RUN}.lst
wc -l events-${RUN}.lst
rm -f split-events-${RUN}.lst files-${RUN}.lst
@@ -18,6 +18,7 @@ for FILE in split-events-${RUN}.lst*; do
NAME=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${NOSAMPLE}-/"`
echo "$NAME: $FILE ---> $STREAM"
+ # Set indexing parameters here
bsub -q psanaq -o $NAME.log -J $NAME -n 12 -R "span[hosts=1]" \
indexamajig \
-i $FILE -o $STREAM -j 32 -g $GEOM --peaks=cxi
diff --git a/scripts/turbo-index-slurm b/scripts/turbo-index-slurm
new file mode 100755
index 00000000..a0f1bec5
--- /dev/null
+++ b/scripts/turbo-index-slurm
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Split a large indexing job into many small tasks and submit using SLURM
+
+# ./turbo-index my-files.lst label my.geom /location/for/streams
+
+# Copyright © 2016-2017 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
+#
+# Authors:
+# 2016 Steve Aplin <steve.aplin@desy.de>
+# 2016-2017 Thomas White <taw@physics.org>
+
+SPLIT=1000 # Size of job chunks
+MAIL=you@example.org # Email address for SLURM notifications
+
+INPUT=$1
+RUN=$2
+GEOM=$3
+STREAMDIR=$4
+
+# Set up environment here if necessary
+#source /path/to/crystfel/setup.sh
+
+# Generate event list from file above
+list_events -i $INPUT -g $GEOM -o events-${RUN}.lst
+if [ $? != 0 ]; then
+ echo "list_events failed"
+ exit 1
+fi
+# If you are using single-event files instead of multi-event ("CXI") ones,
+# comment out the above lines and uncomment the following one:
+#cp $INPUT events-${RUN}.lst
+
+# Count total number of events
+wc -l events-${RUN}.lst
+
+# Split the events up, will create files with $SPLIT lines
+split -a 3 -d -l $SPLIT events-${RUN}.lst split-events-${RUN}.lst
+
+# Clean up
+rm -f events-${RUN}.lst
+
+# Loop over the event list files, and submit a batch job for each of them
+for FILE in split-events-${RUN}.lst*; do
+
+ # Stream file is the output of crystfel
+ STREAM=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${RUN}.stream/"`
+
+ # Job name
+ NAME=`echo $FILE | sed -e "s/split-events-${RUN}.lst/${RUN}-/"`
+
+ echo "$NAME: $FILE ---> $STREAM"
+
+ SLURMFILE="${NAME}.sh"
+
+ echo "#!/bin/sh" > $SLURMFILE
+ echo >> $SLURMFILE
+
+ echo "#SBATCH --partition=mypartition" >> $SLURMFILE # Set your partition here
+ echo "#SBATCH --time=01:00:00" >> $SLURMFILE
+ echo "#SBATCH --nodes=1" >> $SLURMFILE
+ echo "#SBATCH --nice=100" >> $SLURMFILE # Set priority very low to allow other jobs through
+ echo >> $SLURMFILE
+
+ echo "#SBATCH --workdir $PWD" >> $SLURMFILE
+ echo "#SBATCH --job-name $NAME" >> $SLURMFILE
+ echo "#SBATCH --output $NAME-%N-%j.out" >> $SLURMFILE
+ echo "#SBATCH --error $NAME-%N-%j.err" >> $SLURMFILE
+ echo "#SBATCH --mail-type END" >> $SLURMFILE
+ echo "#SBATCH --mail-user $MAIL" >> $SLURMFILE
+ echo >> $SLURMFILE
+
+ echo "#source /path/to/crystfel/setup.sh" >> $SLURMFILE # Set up environment here (again) if necessary
+ echo >> $SLURMFILE
+
+ command="indexamajig -i $FILE -o $STREAMDIR/$STREAM"
+ command="$command -j \`nproc\` -g $GEOM"
+ #command="$command --peaks=zaef" # Indexing parameters here
+
+ echo $command >> $SLURMFILE
+
+ sbatch $SLURMFILE
+
+done
diff --git a/src/cell_explorer.c b/src/cell_explorer.c
index c8bbb069..f6c2c590 100644
--- a/src/cell_explorer.c
+++ b/src/cell_explorer.c
@@ -658,7 +658,9 @@ static void scan_cells(CellWindow *w)
if ( ignore ) continue;
- cell_get_parameters(cells[i], &a, &b, &c, &al, &be, &ga);
+ if ( cell_get_parameters(cells[i], &a, &b, &c, &al, &be, &ga) ) {
+ continue;
+ }
a *= 1e10; b *= 1e10; c *= 1e10;
al = rad2deg(al); be = rad2deg(be); ga = rad2deg(ga);
@@ -719,7 +721,10 @@ static void scan_minmax(CellWindow *w)
int j;
int found = 0;
- cell_get_parameters(w->cells[i], &a, &b, &c, &al, &be, &ga);
+ if ( cell_get_parameters(w->cells[i], &a, &b, &c, &al, &be, &ga) ) {
+ ERROR("Cell %i is bad\n", i);
+ continue;
+ }
a *= 1e10; b *= 1e10; c *= 1e10;
al = rad2deg(al); be = rad2deg(be); ga = rad2deg(ga);
@@ -1555,6 +1560,8 @@ int main(int argc, char *argv[])
return 1;
}
+ gsl_set_error_handler_off();
+
w.cells = NULL;
w.indms = NULL;
w.n_cells = 0;
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 51e51dc9..81f12c94 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -286,13 +286,13 @@ static void add_to_fom(struct fom_context *fctx, double i1, double i2,
break;
case FOM_D1SIG :
- if ( fabs(i1-i2) < (sig1+sig2)/2.0 ) {
+ if ( fabs(i1-i2) < sqrt(sig1*sig1 + sig2*sig2) ) {
fctx->n_within[bin]++;
}
break;
case FOM_D2SIG :
- if ( fabs(i1-i2) < sig1+sig2 ) { /* = 2 * (sig1+sig2)/2 */
+ if ( fabs(i1-i2) < 2.0*sqrt(sig1*sig1 + sig2*sig2) ) {
fctx->n_within[bin]++;
}
break;
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
char *bfile = NULL;
char *sym_str = NULL;
SymOpList *sym;
- int ncom, nrej, nneg, nres, nbij, ncen;
+ int ncom, nrej, nmul, nneg, nres, nbij, ncen;
RefList *list1_acc;
RefList *list2_acc;
RefList *list1;
@@ -1149,6 +1149,7 @@ int main(int argc, char *argv[])
double min_I = +INFINITY;
double max_I = -INFINITY;
float highres, lowres;
+ int mul_cutoff = 0;
/* Long options */
const struct option longopts[] = {
@@ -1164,6 +1165,7 @@ int main(int argc, char *argv[])
{"shell-file", 1, NULL, 7},
{"highres", 1, NULL, 8},
{"lowres", 1, NULL, 9},
+ {"min-measurements", 1, NULL, 11},
{"ignore-negs", 0, &config_ignorenegs, 1},
{"zero-negs", 0, &config_zeronegs, 1},
{"intensity-shells", 0, &config_intshells, 1},
@@ -1260,6 +1262,13 @@ int main(int argc, char *argv[])
rmin_fix = 1.0 / (lowres/1e10);
break;
+ case 11 :
+ if ( sscanf(optarg, "%i", &mul_cutoff) != 1 ) {
+ ERROR("Invalid value for --min-measurements\n");
+ return 1;
+ }
+ break;
+
case '?' :
break;
@@ -1413,6 +1422,7 @@ int main(int argc, char *argv[])
/* Select reflections to be used */
ncom = 0;
nrej = 0;
+ nmul = 0;
nneg = 0;
nres = 0;
nbij = 0;
@@ -1426,6 +1436,7 @@ int main(int argc, char *argv[])
signed int h, k, l;
double val1, val2;
double esd1, esd2;
+ int mul1, mul2;
Reflection *refl2;
Reflection *refl1_acc;
Reflection *refl2_acc;
@@ -1441,6 +1452,9 @@ int main(int argc, char *argv[])
esd1 = get_esd_intensity(refl1);
esd2 = get_esd_intensity(refl2);
+ mul1 = get_redundancy(refl1);
+ mul2 = get_redundancy(refl2);
+
if ( (val1 < sigma_cutoff * esd1)
|| (val2 < sigma_cutoff * esd2) )
{
@@ -1453,6 +1467,11 @@ int main(int argc, char *argv[])
continue;
}
+ if ( (mul1 < mul_cutoff) || (mul2 < mul_cutoff) ) {
+ nmul++;
+ continue;
+ }
+
if ( config_zeronegs ) {
int d = 0;
if ( val1 < 0.0 ) {
@@ -1544,6 +1563,11 @@ int main(int argc, char *argv[])
" negative intensities which were set to zero.\n", nneg);
}
+ if ( nmul > 0 ) {
+ STATUS("%i reflection pairs rejected because either or both"
+ " versions had too few measurements.\n", nmul);
+ }
+
if ( nres > 0 ) {
STATUS("%i reflection pairs rejected because either or both"
" versions were outside the resolution range.\n", nres);
diff --git a/src/geoptimiser.c b/src/geoptimiser.c
index e0337358..4ba2c5d0 100644
--- a/src/geoptimiser.c
+++ b/src/geoptimiser.c
@@ -2488,8 +2488,10 @@ int main(int argc, char *argv[])
}
#ifdef HAVE_SAVE_TO_PNG
+#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();
#endif
+#endif
ret_val = optimize_geometry(gparams, det, quadrants, connected);
diff --git a/src/get_hkl.c b/src/get_hkl.c
index d6efe747..77f34da2 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -98,7 +98,9 @@ static void show_help(const char *s)
static void copy_notes(RefList *out, RefList *in)
{
- reflist_add_notes(out, reflist_get_notes(in));
+ if ( reflist_get_notes(in) != NULL ) {
+ reflist_add_notes(out, reflist_get_notes(in));
+ }
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index f5493453..2dabf3e9 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -372,7 +372,7 @@ static void run_work(const struct index_args *iargs, Stream *st,
}
time_accounts_set(taccs, TACC_FINALCLEANUP);
- cleanup_indexing(iargs->indm, iargs->ipriv);
+ cleanup_indexing(iargs->ipriv);
free_detector_geometry(iargs->det);
free(iargs->hdf5_peak_path);
free_copy_hdf5_field_list(iargs->copyme);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ef803931..6300f7ff 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -3,13 +3,13 @@
*
* Index patterns, output hkl+intensity etc.
*
- * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Richard Kirian
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2010-2015 Thomas White <taw@physics.org>
+ * 2010-2017 Thomas White <taw@physics.org>
* 2011 Richard Kirian
* 2012 Lorenzo Galli
* 2012 Chunhong Yoon
@@ -202,8 +202,6 @@ int main(int argc, char *argv[])
int config_checkprefix = 1;
int config_basename = 0;
int integrate_saturated = 0;
- IndexingMethod *indm;
- IndexingPrivate **ipriv;
char *indm_str = NULL;
char *cellfile = NULL;
char *prefix = NULL;
@@ -262,7 +260,6 @@ int main(int argc, char *argv[])
ERROR("Couldn't allocate HDF5 field list.\n");
return 1;
}
- iargs.indm = NULL; /* No default */
iargs.ipriv = NULL; /* No default */
iargs.int_meth = integration_method("rings-nocen-nosat-nograd", NULL);
iargs.push_res = 0.0;
@@ -644,35 +641,6 @@ int main(int argc, char *argv[])
iargs.hdf5_peak_path = command_line_peak_path;
}
- /* Parse indexing methods */
- if ( indm_str == NULL ) {
-
- STATUS("You didn't specify an indexing method, so I won't try "
- " to index anything.\n"
- "If that isn't what you wanted, re-run with"
- " --indexing=<methods>.\n");
- indm = NULL;
-
- } else {
-
- int i = 0;
-
- indm = build_indexer_list(indm_str);
- if ( indm == NULL ) {
- ERROR("Invalid indexer list '%s'\n", indm_str);
- return 1;
- }
- free(indm_str);
-
- /* If --no-refine, unset the refinement flag on all methods */
- if ( no_refine ) {
- while ( indm[i] != INDEXING_NONE ) {
- indm[i] &= ~INDEXING_REFINE;
- i++;
- }
- }
- }
-
/* Parse integration method */
if ( int_str != NULL ) {
@@ -808,23 +776,30 @@ int main(int argc, char *argv[])
}
free(outfile);
- /* Prepare the indexer */
- if ( indm != NULL ) {
- ipriv = prepare_indexing(indm, iargs.cell, iargs.det,
- iargs.tols, iargs.felix_options);
- if ( ipriv == NULL ) {
- ERROR("Failed to prepare indexing.\n");
+ /* Prepare the indexing system */
+ if ( indm_str == NULL ) {
+
+ STATUS("You didn't specify an indexing method, so I won't try "
+ " to index anything.\n"
+ "If that isn't what you wanted, re-run with"
+ " --indexing=<methods>.\n");
+ iargs.ipriv = NULL;
+
+ } else {
+
+ iargs.ipriv = setup_indexing(indm_str, iargs.cell, iargs.det,
+ iargs.tols, no_refine,
+ iargs.felix_options);
+ if ( iargs.ipriv == NULL ) {
+ ERROR("Failed to set up indexing system\n");
return 1;
}
- } else {
- ipriv = NULL;
+ free(indm_str);
+
}
gsl_set_error_handler_off();
- iargs.indm = indm;
- iargs.ipriv = ipriv;
-
create_sandbox(&iargs, n_proc, prefix, config_basename, fh,
st, tempdir);
@@ -836,7 +811,7 @@ int main(int argc, char *argv[])
free_detector_geometry(iargs.det);
free(iargs.hdf5_peak_path);
close_stream(st);
- cleanup_indexing(indm, ipriv);
+ cleanup_indexing(iargs.ipriv);
return 0;
}
diff --git a/src/merge.c b/src/merge.c
index 8d1fae0f..9734c469 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -237,10 +237,7 @@ RefList *merge_intensities(Crystal **crystals, int n, int n_threads,
Reflection *refl;
RefListIterator *iter;
- if ( n == 0 ) {
- ERROR("No crystals!\n");
- return NULL;
- }
+ if ( n == 0 ) return NULL;
full = reflist_new();
diff --git a/src/partialator.c b/src/partialator.c
index 09feebb4..569145e8 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -191,6 +191,12 @@ static void write_split(Crystal **crystals, int n_crystals, const char *outfile,
snprintf(tmp, 1024, "%s1", outfile);
split = merge_intensities(crystals1, n_crystals1, nthreads,
pmodel, min_measurements, push_res, 1);
+
+ if ( split == NULL ) {
+ ERROR("Not enough crystals for two way split!\n");
+ return;
+ }
+
STATUS("Writing two-way split to %s ", tmp);
write_reflist_2(tmp, split, sym);
reflist_free(split);
diff --git a/src/process_hkl.c b/src/process_hkl.c
index d2cf640b..301bc6e4 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -287,7 +287,8 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
if ( isnan(scale) ) return 1;
if ( scale <= 0.0 ) return 1;
if ( stat != NULL ) {
- fprintf(stat, "%s %f %f\n", image->filename, scale, cc);
+ fprintf(stat, "%s %s %f %f\n", image->filename,
+ get_event_string(image->event), scale, cc);
}
} else {
diff --git a/src/process_image.c b/src/process_image.c
index d54e5a79..e6e6d22a 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -241,8 +241,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
/* Index the pattern */
time_accounts_set(taccs, TACC_INDEXING);
- index_pattern_2(&image, iargs->indm, iargs->ipriv,
- &sb_shared->pings[cookie]);
+ index_pattern_2(&image, iargs->ipriv, &sb_shared->pings[cookie]);
r = chdir(rn);
if ( r ) {
diff --git a/src/process_image.h b/src/process_image.h
index 2ac48b83..bc8b31fd 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -62,8 +62,7 @@ struct index_args
float min_snr;
int check_hdf5_snr;
struct detector *det;
- IndexingMethod *indm;
- IndexingPrivate **ipriv;
+ IndexingPrivate *ipriv;
int peaks; /* Peak detection method */
float tols[4];
struct beam_params *beam;