You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/sci-misc/fitscut/files/fitscut-1.4.4-fix-asinh.patch

34 lines
1.2 KiB

Author: Ole Streicher <olebole@debian.org>
Description: Avoid NaN in asinh calculation.
Also, ignore NaN in histogram creation.
--- a/histogram.c
+++ b/histogram.c
@@ -83,8 +83,10 @@
ind = 0;
else if (value > dmax)
ind = length-1;
- else
+ else if (isfinite(value))
ind = ceil ((value-dmin) / binsize);
+ else
+ continue;
hist[ind] += 1.0;
}
}
--- a/image_scale.c
+++ b/image_scale.c
@@ -326,8 +326,11 @@
if (t > maxval)
maxval = t;
}
-
- weight = asinh (sum * nonlinearity) / (nonlinearity * sum);
+ if (sum * nonlinearity == 0.0) {
+ weight = 1.0;
+ } else {
+ weight = asinh (sum * nonlinearity) / (nonlinearity * sum);
+ }
for (k = 0; k < Image->channels; k++) {
if (Image->data[k] == NULL)
continue;