[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 858667d: NoiseChisel checks if there was any d
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 858667d: NoiseChisel checks if there was any detection |
Date: |
Thu, 8 Mar 2018 09:31:50 -0500 (EST) |
branch: master
commit 858667d3021e3e5411ceb3c4cf7b11d045e0592d
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
NoiseChisel checks if there was any detection
Until now, NoiseChisel assumed that there is always a detection. It would
thus crash if there wasn't any. So a check was added after the detection
step so NoiseChisel continues only when there are any detections.
This issue came up in a dataset provided by Sara Yousefi Taemeh.
This fixes bug #53304.
---
NEWS | 2 ++
bin/noisechisel/noisechisel.c | 42 ++++++++++++++++++++++++++++--------------
2 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/NEWS b/NEWS
index 0fd4fd6..0c88d37 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,8 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
MakeCatalog parses area larger than clump (bug #53295).
+ NoiseChisel crash when there is no detection (bug #53304).
+
* Noteworthy changes in release 0.5 (library 3.0.0) (2017-12-22) [stable]
diff --git a/bin/noisechisel/noisechisel.c b/bin/noisechisel/noisechisel.c
index a9e4f60..4e5656f 100644
--- a/bin/noisechisel/noisechisel.c
+++ b/bin/noisechisel/noisechisel.c
@@ -23,6 +23,8 @@ along with Gnuastro. If not, see
<http://www.gnu.org/licenses/>.
#include <config.h>
#include <stdio.h>
+#include <errno.h>
+#include <error.h>
#include <stdlib.h>
#include <gnuastro/fits.h>
@@ -325,22 +327,34 @@ noisechisel(struct noisechiselparams *p)
/* Remove false detections. */
detection(p);
- /* Find the Sky value and subtract it from the input and convolved
- images. */
- noisechisel_find_sky_subtract(p);
-
- /* If the user only wanted detection, ignore the segmentation steps. */
- if(p->onlydetection==0)
+ /* If we have any detections, find the Sky value and subtract it from the
+ input and convolved images. */
+ if(p->numdetections)
{
- /* Correct the convolved image channel edges if necessary. */
- noisechisel_convolve_correct_ch_edges(p);
+ noisechisel_find_sky_subtract(p);
+
+ /* If the user only wanted detection, ignore the segmentation steps. */
+ if(p->onlydetection==0)
+ {
+ /* Correct the convolved image channel edges if necessary. */
+ noisechisel_convolve_correct_ch_edges(p);
- /* Do the segmentation. */
- segmentation(p);
+ /* Do the segmentation. */
+ segmentation(p);
+ }
+ else
+ p->numobjects=p->numdetections;
+
+ /* Write the output. */
+ noisechisel_output(p);
}
else
- p->numobjects=p->numdetections;
-
- /* Write the output. */
- noisechisel_output(p);
+ {
+ if(p->cp.quiet)
+ error(0, 0, "no output file created: no detections could found "
+ "in `%s' with given parameters", p->inputname);
+ else
+ gal_timing_report(NULL, "NO OUTPUT FILE CREATED (try with "
+ "`--checkdetection' to see why)", 1);
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 858667d: NoiseChisel checks if there was any detection,
Mohammad Akhlaghi <=