aboutsummaryrefslogtreecommitdiff
path: root/src/hrs-scaling.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-09 18:57:49 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:29 +0100
commit65305f9f5064f0537f365208b6b750e4e6d7a9cf (patch)
treeccdd16d57d5ea830514dd0a8f18d904e278e63f5 /src/hrs-scaling.c
parent6f5ef00f09246a40c3a504ec39f1b3b57f7a0a25 (diff)
Don't give NaN for shift
Diffstat (limited to 'src/hrs-scaling.c')
-rw-r--r--src/hrs-scaling.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c
index cbd54ee5..1d11e402 100644
--- a/src/hrs-scaling.c
+++ b/src/hrs-scaling.c
@@ -325,10 +325,18 @@ static double iterate_scale(struct image *images, int n,
} else {
shifts = gsl_vector_alloc(n);
for ( frame=0; frame<n; frame++ ) {
- double num, den;
+
+ double num, den, sh;
+
num = gsl_vector_get(v, frame);
den = gsl_matrix_get(M, frame, frame);
- gsl_vector_set(shifts, frame, num/den);
+ sh = num/den;
+
+ if ( isnan(sh) ) {
+ gsl_vector_set(shifts, frame, 0.0);
+ } else {
+ gsl_vector_set(shifts, frame, sh);
+ }
}
}