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

get_hkl: Read intensities from file if requested

parent 2059ec75
......@@ -37,9 +37,11 @@ static void show_help(const char *s)
" -t, --template=<filename> Only include reflections mentioned in file.\n"
" --poisson Simulate Poisson samples.\n"
" --twin Generate twinned data.\n"
" -o --output=<filename> Output filename (default: stdout).\n"
" -o, --output=<filename> Output filename (default: stdout).\n"
" --zone-axis Generate hk0 intensities only (and add\n"
" Synth2D-style header.\n"
" -i, --intensities=<file> Read intensities from file instead of\n"
" calculating them from scratch.\n"
);
}
......@@ -110,6 +112,7 @@ int main(int argc, char *argv[])
char *output = NULL;
unsigned int *counts;
unsigned int *cts;
char *input = NULL;
signed int h, k, l;
/* Long options */
......@@ -120,11 +123,12 @@ int main(int argc, char *argv[])
{"output", 1, NULL, 'o'},
{"twin", 0, &config_twin, 1},
{"zone-axis", 0, &config_za, 1},
{"intensities", 1, NULL, 'i'},
{0, 0, NULL, 0}
};
/* Short options */
while ((c = getopt_long(argc, argv, "ht:o:", longopts, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "ht:o:i:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
......@@ -142,6 +146,11 @@ int main(int argc, char *argv[])
break;
}
case 'i' : {
input = strdup(optarg);
break;
}
case 0 : {
break;
}
......@@ -155,7 +164,12 @@ int main(int argc, char *argv[])
mol = load_molecule();
cts = new_list_count();
ideal_ref = get_reflections(mol, eV_to_J(1790.0), 1/(0.6e-9), cts);
if ( input == NULL ) {
ideal_ref = get_reflections(mol, eV_to_J(1790.0), 1/(0.6e-9), cts);
} else {
ideal_ref = read_reflections(input, cts);
free(input);
}
counts = new_list_count();
......
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