gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 41ad86f: MakeProfiles: Warning when flat profi


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 41ad86f: MakeProfiles: Warning when flat profiles will have a value of zero
Date: Fri, 22 Feb 2019 12:25:09 -0500 (EST)

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

    MakeProfiles: Warning when flat profiles will have a value of zero
    
    It some times happens that we mistakenly don't write the input columns when
    making a fast catalog properly. When there aren't enough columns,
    MakeProfiles will complain and abort. But when an extra column is
    mistakenly input, it can cause some unexpected behavior.
    
    One such situation that has happened for myself several times happens when
    making flat profiles with `--mforflatpix' or `--mcolisbrightness': when I
    mistakenly add a 0 for the magnitude column. In this case, the flat profile
    would get a value of zero, and it would thus be invisible in the final
    image.
    
    To avoid such unexpected behavior, a warning is now written at the start of
    MakeProfiles when the scenario above happens. This will help the user be
    aware of this situation and if they want to, they can disable it (along
    with all input messages).
---
 bin/mkprof/ui.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 16b36a8..ca6c13f 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -792,6 +792,25 @@ ui_read_cols(struct mkprofparams *p)
           gal_data_free(corrtype);
         }
     }
+
+  /* Multi-column sanity checks. */
+  counter=0;
+  if( !p->cp.quiet && (p->mforflatpix || p->mcolisbrightness) )
+    for(i=0;i<p->num;++i)
+      if( p->m[i]==0.0 && ( p->f[i]==PROFILE_POINT
+                            || p->f[i]==PROFILE_FLAT
+                            || p->f[i]==PROFILE_CIRCUMFERENCE ) )
+        {
+          error(0, 0, "WARNING: atleast one single-valued profile (point, "
+                "flat, or circumference profiles) has a magnitude column "
+                "value of 0.0 while `--mforflatpix' or "
+                "`--mcolforbrightness' have also been given. In such cases "
+                "the profile's pixels will have a value of zero and thus "
+                "they will not be identifiable from the zero-valued "
+                "background. If this behavior is intended, this warning "
+                "can be supressed with the `--quiet' (or `-q') option.\n");
+          break;
+        }
 }
 
 



reply via email to

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