gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 854e4136: MakeCatalog: error when --frac-max n


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 854e4136: MakeCatalog: error when --frac-max not given for relevant columns
Date: Wed, 10 Jan 2024 14:05:33 -0500 (EST)

branch: master
commit 854e4136c0ed6315f6fd12b5913269316623f584
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    MakeCatalog: error when --frac-max not given for relevant columns
    
    Until now, when the user asked for any of the '--frac-max*-*' columns, but
    forgot to give fractions to '--frac-max', MakeCatalog would continue to the
    end! Furthermore, when asked for '--frac-max2-sum', the output column was
    called 'FRAC_MAX1_SUM'.
    
    With this commit, checks have been added for the following scenarios:
    
     - If '--frac-max' is not given (when those measurements are requested),
       MakeCatalog aborts with an error, guiding the user on how to progress.
    
     - If one value is given to '--frac-max', but the user asks for a second
       fraction's measurements, it aborts and guides on how to progress.
    
    Also, the problem with the wrong column name has been fixed. Furthermore,
    thanks to Raul Infante-Sainz, I noticed that we had not included the fix to
    bug #64825 in the 'NEWS' file; so that was also added.
    
    This bug was reported by Helena Domínguez Sánchez.
    
    This fixes bug #65149.
---
 NEWS                         |  4 ++++
 THANKS                       |  1 +
 bin/mkcatalog/columns.c      | 38 ++++++++++++++++++++++++++++++++++++--
 doc/announce-acknowledge.txt |  1 +
 4 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index c9060e42..637ba38f 100644
--- a/NEWS
+++ b/NEWS
@@ -210,6 +210,8 @@ See the end of the file for license conditions.
   - gal_wcs_write: as in 'gal_fits_img_write'.
 
 ** Bugs fixed
+  - bug #64825: astscript-fits-view only takes the last HDU provided;
+    reported by Teet Kuumta and fixed by Raul Infante-Sainz.
   - bug #64852: astscript-zeropoint: crash when input is in 0-th HDU;
     reported by 'danc' in https://savannah.gnu.org/support/?110952; fixed
     by Sepideh Eskandarlou.
@@ -229,6 +231,8 @@ See the end of the file for license conditions.
     '--customtable' of MakeProfile; reported by Sepideh Eskandarlou.
   - bug #65141: MakeCatalog crash when labled image is all blank; reported
     by Sepideh Eskandarlou.
+  - bug #65149: MakeCatalog '--frac-max*-*' measurements done without
+    '--frac-max'; reported by Helena Domínguez Sánchez.
 
 
 
diff --git a/THANKS b/THANKS
index 0baae919..57b817ce 100644
--- a/THANKS
+++ b/THANKS
@@ -62,6 +62,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Giulia Golini                        giulia.golini@gmail.com
     Guillaume Mahler                     guillaume.mahler@univ-lyon1.fr
     Hamed Altafi                         hamed.altafi2@gmail.com
+    Helena Domínguez Sánchez             hdominguez@cefca.es
     Hilderic Browne                      hilderic@storm.ca
     Ignacio Ruiz Cejudo                  igruiz04@ucm.es
     Ignacio Trujillo                     trujillo@iac.es
diff --git a/bin/mkcatalog/columns.c b/bin/mkcatalog/columns.c
index 435bf423..6e47ac54 100644
--- a/bin/mkcatalog/columns.c
+++ b/bin/mkcatalog/columns.c
@@ -238,7 +238,8 @@ columns_wcs_preparation(struct mkcatalogparams *p)
         break;
     }
 
-  /* Convert the high-level WCS columns to low-level ones. */
+  /* Other checks; including conversion of the high-level WCS columns to
+     low-level ones. */
   for(colcode=p->columnids; colcode!=NULL; colcode=colcode->next)
     switch(colcode->v)
       {
@@ -273,6 +274,39 @@ columns_wcs_preparation(struct mkcatalogparams *p)
         p->pixelarcsecsq=pixscale[0]*pixscale[1]*3600.0f*3600.0f;
         free(pixscale);
         break;
+
+      /* The '--frac-max-*' options. */
+      case UI_KEY_FRACMAX1SUM:
+      case UI_KEY_FRACMAX2SUM:
+      case UI_KEY_FRACMAX1AREA:
+      case UI_KEY_FRACMAX2AREA:
+      case UI_KEY_FRACMAX1RADIUS:
+      case UI_KEY_FRACMAX2RADIUS:
+
+        /* The '--frac-max' option should also be called. */
+        if(p->fracmax==NULL)
+          error(EXIT_FAILURE, 0, "the '--frac-max*-*' options should be "
+                "called with the '--frac-max' option (to specify what "
+                "fractions should be used). For example "
+                "'--frac-max=0.8,0.5' allows measurements at fractions "
+                "0.8 (for '--frac-max1-*' measurements) and 0.5 (for "
+                "'--frac-max2-*' measurements) of the maximum");
+
+        /* The second fraction values can only be used if there is a second
+           value. */
+        switch(colcode->v)
+          {
+          case UI_KEY_FRACMAX2SUM:
+          case UI_KEY_FRACMAX2AREA:
+          case UI_KEY_FRACMAX2RADIUS:
+            if(p->fracmax->size!=2)
+              error(EXIT_FAILURE, 0, "only one fraction is given to "
+                    "'--frac-max', but the second fraction's "
+                    "measurements are requested (for example "
+                    "'--frac-max2-sum'). Either give two fractions to "
+                    "'--frac-max' or use '--frac-max1-*' measurements");
+          }
+        break;
       }
 }
 
@@ -1956,7 +1990,7 @@ columns_define_alloc(struct mkcatalogparams *p)
         case UI_KEY_FRACMAX2SUM:
           name           = ( colcode->v==UI_KEY_FRACMAX1SUM
                              ? "FRAC_MAX1_SUM"
-                             : "FRAC_MAX1_SUM" );
+                             : "FRAC_MAX2_SUM" );
           unit           = MKCATALOG_NO_UNIT;
           otype          = GAL_TYPE_FLOAT32;
           ctype          = GAL_TYPE_FLOAT32;
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 54cb8bf2..9d16e6d4 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,6 +1,7 @@
 Alphabetically ordered list to acknowledge in the next release.
 
 Alberto Moreno Signes
+Helena Domínguez Sánchez
 Ignacio Ruiz Cejudo
 Rahna Payyasseri Thanduparackal
 Sepideh Eskandarlou



reply via email to

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