aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-09-20 16:38:18 +0200
committerThomas White <taw@physics.org>2023-09-20 17:20:21 +0200
commite38006669e39e695b9b3aac97f57326b311b4c5d (patch)
tree9610accfcb455b3db2e40030309d10e5104a57da /src
parent4e627586749b356b95912e073bb24b16bea1c938 (diff)
indexamajig: Add --mille-dir
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c2
-rw-r--r--src/indexamajig.c17
-rw-r--r--src/process_image.h1
3 files changed, 19 insertions, 1 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 27e33b8f..be13465c 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -368,7 +368,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
mille = NULL;
if ( iargs->mille ) {
char tmp[64];
- snprintf(tmp, 63, "mille-data-%i.bin", cookie);
+ snprintf(tmp, 63, "%s/mille-data-%i.bin", iargs->milledir, cookie);
mille = crystfel_mille_new(tmp);
}
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 7f5504cd..ef25e396 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -726,6 +726,11 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
args->iargs.mille = 1;
break;
+ case 417 :
+ free(args->iargs.milledir);
+ args->iargs.milledir = strdup(arg);
+ break;
+
/* ---------- Integration ---------- */
case 501 :
@@ -971,6 +976,7 @@ int main(int argc, char *argv[])
args.iargs.n_threads = 1;
args.iargs.data_format = DATA_SOURCE_TYPE_UNKNOWN;
args.iargs.mille = 0;
+ args.iargs.milledir = strdup(".");
argp_program_version_hook = show_version;
@@ -1092,6 +1098,8 @@ int main(int argc, char *argv[])
"Estimate of the camera length, in metres."},
{"mille", 416, NULL, 0,
"Generate data for detector geometry refinement using Millepede"},
+ {"mille-dir", 417, "dirname", 0,
+ "Save Millepede data in folder"},
{NULL, 0, 0, OPTION_DOC, "Integration options:", 5},
{"integration", 501, "method", OPTION_NO_USAGE, "Integration method"},
@@ -1419,6 +1427,15 @@ int main(int argc, char *argv[])
free(args.outfile);
free(args.indm_str);
+ r = mkdir(args.iargs.milledir, S_IRWXU);
+ if ( r ) {
+ if ( errno != EEXIST ) {
+ ERROR("Failed to create folder for Millepede data: %s\n",
+ strerror(errno));
+ exit(1);
+ }
+ }
+
gsl_set_error_handler_off();
struct pf8_private_data *pf8_data = NULL;
diff --git a/src/process_image.h b/src/process_image.h
index eabd425a..50abbaa8 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -75,6 +75,7 @@ struct index_args
float clen_estimate;
int n_threads;
int mille;
+ char *milledir;
/* Integration */
IntegrationMethod int_meth;