gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 62738cc: MakeProfiles only checking validity o


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 62738cc: MakeProfiles only checking validity of column when relevant
Date: Thu, 16 Aug 2018 18:36:59 -0400 (EDT)

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

    MakeProfiles only checking validity of column when relevant
    
    When unreasonable values are given (for example a radius equal or smaller
    than zero to certain column values MakeProfiles aborts with a notice to the
    users. This is a good warning and can help avoid unexpected behavior (for
    example the user specifying a column by mistake).
    
    But when the profile doesn't need a parameter, such checks only cause
    confusion (for example for a point profile, which never uses the radius,
    axis ratio or truncation values). With this commit, checks have been added
    for the point profile (which doesn't need some values): when the row's
    profile is a point, the value is not checked.
    
    This bug was reported by Michael Stein.
    
    This fixes bug #54526.
---
 NEWS                         |  1 +
 THANKS                       |  1 +
 bin/mkprof/ui.c              | 21 ++++++++++++---------
 doc/announce-acknowledge.txt |  2 ++
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 78e8e16..f4886d1 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** Bugs fixed
   bug #54493: Warp crashes when type isn't set.
+  bug #54526: Invalid r, q and truncation of point profiles in MakeProfiles.
 
 
 
diff --git a/THANKS b/THANKS
index 1dde839..b4fa288 100644
--- a/THANKS
+++ b/THANKS
@@ -55,6 +55,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Jenny Sorce                          address@hidden
     Lee Spitler                          address@hidden
     Richard Stallman                     address@hidden
+    Michael Stein                        address@hidden
     Ole Streicher                        address@hidden
     Alfred M. Szmidt                     address@hidden
     Michel Tallon                        address@hidden
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 27291fb..b4a6d73 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -696,10 +696,11 @@ ui_read_cols(struct mkprofparams *p)
 
           /* Check if there is no negative or zero-radius profile. */
           for(i=0;i<p->num;++i)
-            if(p->r[i]<=0.0f)
+            if(p->f[i]!=PROFILE_POINT && p->r[i]<=0.0f)
               error(EXIT_FAILURE, 0, "%s: row %zu, the radius value %g is "
-                    "not acceptable. It has to be larger than 0", p->catname,
-                    i+1, p->r[i]);
+                    "not acceptable for a `%s' profile. It has to be larger "
+                    "than 0", p->catname, i+1, p->r[i],
+                    ui_profile_name_write(p->f[i]));
           break;
 
 
@@ -724,10 +725,11 @@ ui_read_cols(struct mkprofparams *p)
 
           /* Check if there is no negative or >1.0f axis ratio. */
           for(i=0;i<p->num;++i)
-            if(p->q[i]<=0.0f || p->q[i]>1.0f)
+            if( p->f[i]!=PROFILE_POINT && (p->q[i]<=0.0f || p->q[i]>1.0f) )
               error(EXIT_FAILURE, 0, "%s: row %zu, the axis ratio value %g "
-                    "is not acceptable. It has to be >0 and <=1", p->catname,
-                    i+1, p->q[i]);
+                    "is not acceptable for a `%s' profile. It has to be >0 "
+                    "and <=1", p->catname, i+1, p->q[i],
+                    ui_profile_name_write(p->f[i]));
           break;
 
 
@@ -746,10 +748,11 @@ ui_read_cols(struct mkprofparams *p)
 
           /* Check if there is no negative or zero truncation radius. */
           for(i=0;i<p->num;++i)
-            if(p->t[i]<=0.0f)
+            if(p->f[i]!=PROFILE_POINT && p->t[i]<=0.0f)
               error(EXIT_FAILURE, 0, "%s: row %zu, the truncation radius "
-                    "value %g is not acceptable. It has to be larger than 0",
-                    p->catname, i+1, p->t[i]);
+                    "value %g is not acceptable for a `%s' profile. It has "
+                    "to be larger than 0", p->catname, i+1, p->t[i],
+                    ui_profile_name_write(p->f[i]));
           break;
 
 
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 3e63c06..36f8ee2 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1 +1,3 @@
 Alphabetically ordered list to acknowledge in the next release.
+
+Michael Stein



reply via email to

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