aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-03-14 11:24:57 +0100
committerThomas White <taw@physics.org>2012-03-14 11:24:57 +0100
commite9b593711b4c22ee8ce2b31a92162c7c9e448510 (patch)
tree2fa2feedbf123b25eb5f6f2a8cf15601b3887c66
parent86a4b85c49c6812ac7fca1129ebd486bddb3f1d8 (diff)
powder_plot: Catch trouble with resolution limits
-rw-r--r--src/powder_plot.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/powder_plot.c b/src/powder_plot.c
index 5423d759..9df4c301 100644
--- a/src/powder_plot.c
+++ b/src/powder_plot.c
@@ -661,8 +661,8 @@ static void show_help(const char *s)
" linear : linear (default)\n"
" wilson : even spacing in Wilson plots\n"
" volume : constant volume\n"
-" --max=n The maximum 1/d to be considered in plot.\n"
-" --min=n The minimum 1/d to be considered in plot.\n"
+" --max=n The maximum 1/d to be considered in plot.\n"
+" --min=n The minimum 1/d to be considered in plot.\n"
" -d, --data=<type> Use to select the kind of stream data in histogram.\n"
" Choose from:\n"
" reflection : uses peak positons from indexed\n"
@@ -695,6 +695,14 @@ static void show_help(const char *s)
}
+static void rlim_bailout()
+{
+ ERROR("Unable to automatically determine the resolution limits.\n");
+ ERROR("Try again with --min and --max.\n");
+ exit(1);
+}
+
+
int main(int argc, char *argv[])
{
FILE *fh = NULL;
@@ -1031,14 +1039,17 @@ int main(int argc, char *argv[])
/* get q range from Miller indices in hkl
file. */
if ((hist_info.q_min < 0.0) && (hist_info.q_max < 0.0)) {
+ if ( image.reflections == NULL ) rlim_bailout();
resolution_limits(image.reflections, cell,
&hist_info.q_min, &hist_info.q_max);
} else if (hist_info.q_min < 0.0) {
double dummy;
+ if ( image.reflections == NULL ) rlim_bailout();
resolution_limits(image.reflections, cell,
&hist_info.q_min, &dummy);
} else if (hist_info.q_max < 0.0) {
double dummy;
+ if ( image.reflections == NULL ) rlim_bailout();
resolution_limits(image.reflections, cell,
&dummy, &hist_info.q_max);
}
@@ -1052,8 +1063,8 @@ int main(int argc, char *argv[])
}
if ( hist_info.q_min >= hist_info.q_max ) {
- ERROR("the minimum 1/d value of: %e "
- "is greator then your max 1/d value of: %e\n",
+ ERROR("the minimum 1/d value (%e) "
+ "is greater then your max 1/d value (%e).\n",
hist_info.q_min, hist_info.q_max);
return 1;
}