gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master b5385f7 093/113: Projected spectra given NaN w


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b5385f7 093/113: Projected spectra given NaN when no measurement on slice
Date: Fri, 16 Apr 2021 10:33:57 -0400 (EDT)

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

    Projected spectra given NaN when no measurement on slice
    
    In the spectra extensions of MakeCatalog's output we report the area of
    measurements on each slice for all spectra except the projected
    spectra. But this caused complications in interpretting the value of zero
    in a projected spectra: is the sum of values zero, or is the whole slice
    blank (for example because of Sky lines)?
    
    So with this commit, when no measurement could be made in the projected
    spectra, at the end of parsing the slice, we set it (and its error) to NaN.
---
 bin/mkcatalog/parse.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/mkcatalog/parse.c b/bin/mkcatalog/parse.c
index 4c4cc55..d9adaff 100644
--- a/bin/mkcatalog/parse.c
+++ b/bin/mkcatalog/parse.c
@@ -303,7 +303,7 @@ parse_spectrum(struct mkcatalog_passparams *pp, gal_data_t 
*xybin)
   gal_data_t *area;
   float *st_v, *st_std;
   uint32_t *narr, *oarr;
-  size_t *tsize, start_end_inc[2];
+  size_t nproj=0, *tsize, start_end_inc[2];
   uint8_t *xybinarr = xybin ? xybin->array : NULL;
   int32_t *O, *OO, *st_o, *objarr=p->objects->array;
   size_t tid, *dsize=p->objects->dsize, num_increment=1;
@@ -366,6 +366,7 @@ parse_spectrum(struct mkcatalog_passparams *pp, gal_data_t 
*xybin)
               /* Projected spectra: see if we have a value of `2' in the
                  `xybin' array (showing that there is atleast one non-blank
                  element there over the whole spectrum.  */
+              ++nproj;
               parr [ sind ] += *V;
               pearr[ sind ] += var;
 
@@ -403,7 +404,9 @@ parse_spectrum(struct mkcatalog_passparams *pp, gal_data_t 
*xybin)
          index `pind' if we have just finished parsing a slice. */
       if( (num_increment-1)%pp->tile->dsize[1]==0 )
         {
-          pind=0;
+          if(nproj==0) parr[sind]=pearr[sind]=NAN;
+
+          nproj=pind=0;
           ++sind;
         }
     }



reply via email to

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