gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d6051a1 074/113: Upperlimit magnitude in 3D, c


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d6051a1 074/113: Upperlimit magnitude in 3D, corrected creation of check table
Date: Fri, 16 Apr 2021 10:33:50 -0400 (EDT)

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

    Upperlimit magnitude in 3D, corrected creation of check table
    
    When converting the Z axis position to UINT32, we were mistakenly making a
    copy of the Y position. So when freeing, MakeCatalog would abort with a
    segmentation fault. It now correctly copies from the Z axis.
    
    Also, the conversion is now only done on non-32-bit systems.
---
 bin/mkcatalog/upperlimit.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/bin/mkcatalog/upperlimit.c b/bin/mkcatalog/upperlimit.c
index 2b271be..d883a4e 100644
--- a/bin/mkcatalog/upperlimit.c
+++ b/bin/mkcatalog/upperlimit.c
@@ -405,11 +405,16 @@ upperlimit_write_check(struct mkcatalogparams *p, 
gal_list_sizet_t *check_x,
                    "Sum of pixel values over random footprint.");
 
 
-  /* Convert the unsigned 64-bit values to 32-bit because the FITS table
-     format doesn't recognize 64-bit integers.*/
-  x=gal_data_copy_to_new_type_free(x, GAL_TYPE_UINT32);
-  y=gal_data_copy_to_new_type_free(y, GAL_TYPE_UINT32);
-  if(check_z) z=gal_data_copy_to_new_type_free(y, GAL_TYPE_UINT32);
+  /* If `size_t' isn't 32-bit on this system, then convert the unsigned
+     64-bit values to 32-bit because the FITS table format doesn't
+     recognize 64-bit integers.*/
+  if( GAL_TYPE_SIZE_T != GAL_TYPE_UINT32 )
+    {
+      x=gal_data_copy_to_new_type_free(   x, GAL_TYPE_UINT32);
+      y=gal_data_copy_to_new_type_free(   y, GAL_TYPE_UINT32);
+      if(check_z)
+        z=gal_data_copy_to_new_type_free( z, GAL_TYPE_UINT32);
+    }
 
 
   /* Write exactly what object/clump this table is for. */
@@ -684,7 +689,8 @@ upperlimit_one_tile(struct mkcatalog_passparams *pp, 
gal_data_t *tile,
          parsed. */
       if(continueparse) uparr[ counter++ ] = sum;
 
-      /* If a check is necessary, write in the values. */
+      /* If a check is necessary, write in the values (in FITS
+         coordinates). */
       if(writecheck)
         {
           switch(ndim)



reply via email to

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