aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-04-24 16:52:16 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:04 +0200
commit99849c8ed87a424a76e4826ed39ad65cacfaecfb (patch)
tree23c1b0f505527cf7550f65e0f004d505e2efe2a9 /src
parentc8fb149760f7a8ef4e018f22e79bcb48e1e3c444 (diff)
indexamajig: Hooks for Mille
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c14
-rw-r--r--src/indexamajig.c11
-rw-r--r--src/process_image.c7
-rw-r--r--src/process_image.h9
4 files changed, 32 insertions, 9 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index a91c6a87..c3f2ca70 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -69,6 +69,7 @@
#include "im-zmq.h"
#include "profile.h"
#include "im-asapo.h"
+#include "predict-refine.h"
struct sandbox
@@ -340,6 +341,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
int allDone = 0;
struct im_zmq *zmqstuff = NULL;
struct im_asapo *asapostuff = NULL;
+ Mille *mille;
if ( sb->profile ) {
profile_init();
@@ -363,6 +365,14 @@ static int run_work(const struct index_args *iargs, Stream *st,
}
}
+ if ( iargs->mille ) {
+ char tmp[64];
+ snprintf(tmp, 63, "mille-data-%i.bin", cookie);
+ mille = crystfel_mille_new(tmp, 1, 0);
+ } else {
+ mille = NULL;
+ }
+
while ( !allDone ) {
struct pattern_args pargs;
@@ -519,7 +529,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
profile_start("process-image");
process_image(iargs, &pargs, st, cookie, tmpdir, ser,
sb->shared, sb->shared->last_task[cookie],
- asapostuff);
+ asapostuff, mille);
profile_end("process-image");
}
@@ -536,6 +546,8 @@ static int run_work(const struct index_args *iargs, Stream *st,
free(pargs.event);
}
+ crystfel_mille_free(mille);
+
/* These are both no-ops if argument is NULL */
im_zmq_shutdown(zmqstuff);
im_asapo_shutdown(asapostuff);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 57e1e5fb..7f5504cd 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -3,13 +3,13 @@
*
* Index patterns, output hkl+intensity etc.
*
- * Copyright © 2012-2022 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2023 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
* Copyright © 2012 Richard Kirian
* Copyright © 2012 Lorenzo Galli
*
* Authors:
- * 2010-2022 Thomas White <taw@physics.org>
+ * 2010-2023 Thomas White <taw@physics.org>
* 2011 Richard Kirian
* 2012 Lorenzo Galli
* 2012 Chunhong Yoon
@@ -722,6 +722,10 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
}
break;
+ case 416 :
+ args->iargs.mille = 1;
+ break;
+
/* ---------- Integration ---------- */
case 501 :
@@ -966,6 +970,7 @@ int main(int argc, char *argv[])
args.iargs.clen_estimate = NAN;
args.iargs.n_threads = 1;
args.iargs.data_format = DATA_SOURCE_TYPE_UNKNOWN;
+ args.iargs.mille = 0;
argp_program_version_hook = show_version;
@@ -1085,6 +1090,8 @@ int main(int argc, char *argv[])
"Maximum number of threads allowed for indexing engines."},
{"camera-length-estimate", 415, "metres", 0,
"Estimate of the camera length, in metres."},
+ {"mille", 416, NULL, 0,
+ "Generate data for detector geometry refinement using Millepede"},
{NULL, 0, 0, OPTION_DOC, "Integration options:", 5},
{"integration", 501, "method", OPTION_NO_USAGE, "Integration method"},
diff --git a/src/process_image.c b/src/process_image.c
index 8acd3e86..4763646a 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -178,7 +178,8 @@ static struct image *file_wait_open_read(const char *filename,
void process_image(const struct index_args *iargs, struct pattern_args *pargs,
Stream *st, int cookie, const char *tmpdir,
int serial, struct sb_shm *sb_shared,
- char *last_task, struct im_asapo *asapostuff)
+ char *last_task, struct im_asapo *asapostuff,
+ Mille *mille)
{
struct image *image;
int i;
@@ -414,8 +415,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
/* Index the pattern */
set_last_task(last_task, "indexing");
profile_start("index");
- index_pattern_3(image, iargs->ipriv, &sb_shared->pings[cookie],
- last_task);
+ index_pattern_4(image, iargs->ipriv, &sb_shared->pings[cookie],
+ last_task, mille);
profile_end("index");
r = chdir(rn);
diff --git a/src/process_image.h b/src/process_image.h
index cca2f7d2..eabd425a 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -3,11 +3,11 @@
*
* The processing pipeline for one image
*
- * Copyright © 2012-2022 Deutsches Elektronen-Synchrotron DESY,
+ * Copyright © 2012-2023 Deutsches Elektronen-Synchrotron DESY,
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2010-2022 Thomas White <taw@physics.org>
+ * 2010-2023 Thomas White <taw@physics.org>
* 2014-2017 Valerio Mariani <valerio.mariani@desy.de>
* 2017-2018 Yaroslav Gevorkov <yaroslav.gevorkov@desy.de>
*
@@ -46,6 +46,7 @@ struct index_args;
#include "peaks.h"
#include "image.h"
#include "im-asapo.h"
+#include "predict-refine.h"
/* Information about the indexing process which is common to all patterns */
@@ -73,6 +74,7 @@ struct index_args
float wavelength_estimate;
float clen_estimate;
int n_threads;
+ int mille;
/* Integration */
IntegrationMethod int_meth;
@@ -115,7 +117,8 @@ extern void process_image(const struct index_args *iargs,
struct pattern_args *pargs, Stream *st,
int cookie, const char *tmpdir, int serial,
struct sb_shm *sb_shared, char *last_task,
- struct im_asapo *asapostuff);
+ struct im_asapo *asapostuff,
+ Mille *mille);
#endif /* PROCESS_IMAGE_H */