gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master c6b02c3: Type scaling/correction only done whe


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c6b02c3: Type scaling/correction only done when necessary
Date: Sun, 25 Jun 2017 10:09:21 -0400 (EDT)

branch: master
commit c6b02c33a5a8a7ca598a1b0a01e328351dfeb760
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Type scaling/correction only done when necessary
    
    In commit ea821eb (`BZERO and BSCALE used to determine type of input'), we
    applied a correction to the expected type of the dataset when the `BZERO'
    and `BSCALE' were present. But they might also be set (for example to 0 and
    1 respectively). In such cases, no correction must be done.
    
    From this commit onward, when the scale is `1' and none of the standard
    `BZERO' values are given for the specific type, this function won't
    actually do anything. Since that commit, it would abort with an error of
    unrecognized data type for example when the image was a `float32' type with
    `BZERO=0' and `BSCALE=1'.
---
 lib/fits.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/fits.c b/lib/fits.c
index ef1f328..da89dc8 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -498,9 +498,11 @@ fits_type_correct(int *type, double bscale, double bzero)
         {*type = GAL_TYPE_UINT64; tofloat=0;}
       break;
 
-    default:
-      error(EXIT_FAILURE, 0, "%s: type code %d not recognized", __func__,
-            *type);
+    /* For the other types (when `BSCALE=1.0f'), currently no correction is
+       necessary, maybe later we can check if the scales are integers and
+       set the integer output type to the smallest type that can allow the
+       scaled values. */
+    default: tofloat=0;
     }
 
   /* If the type must be a float, then do the conversion. */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]