[Top][All Lists]

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

[gnuastro-commits] master 5d5fd95 106/113: NoiseChisel: independent test

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5d5fd95 106/113: NoiseChisel: independent test of input's dimensions
Date: Fri, 16 Apr 2021 10:34:02 -0400 (EDT)

branch: master
commit 5d5fd95237a3d651f853f9996d1115e7121e71ac
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    NoiseChisel: independent test of input's dimensions
    Until now there was no independent test of dimensionality after NoiseChisel
    read the input dataset. As a result, when the input's dimensions were not
    acceptable, it would crash with a suggested bug in the `ui_ngb_check'
    With this commit, immediately after reading the input, NoiseChisel checks
    is dimension independently. So the bug report of `ui_ngb_check' is
 bin/noisechisel/ui.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index a26270f..ac259c4 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -586,8 +586,15 @@ ui_preparations_read_input(struct noisechiselparams *p)
     gal_checkset_allocate_copy("INPUT", &p->input->name);
-  /* Check the values of dimention-related options. */
+  /* Check the dimensions of the input. */
+  if(ndim!=2 && ndim!=3)
+    error(EXIT_FAILURE, 0, "%s: is a %zu dimensional dataset, only 2D "
+          "or 3D datasets are currently supported",
+          gal_fits_name_save_as_string(p->inputname, p->cp.hdu), ndim);
+  /* Check the neighbor options and if the given values correspond to the
+     input's dimensions. */
   ui_ngb_check(p->holengb, "holengb", ndim);
   ui_ngb_check(p->erodengb, "erodengb", ndim);
   ui_ngb_check(p->openingngb, "openingngb", ndim);

reply via email to

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