gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d589f76: Configuration information in Statisti


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d589f76: Configuration information in Statistics, only in FITS outputs
Date: Mon, 13 Aug 2018 09:39:22 -0400 (EDT)

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

    Configuration information in Statistics, only in FITS outputs
    
    Rencently we added a feature for programs to save their configuration in
    the first extension of their outputs if they are FITS files. But for
    Statistics (that can produce FITS or plain text tables), we weren't
    checking if the output is indeed a FITS file or not before this. Therefore
    we came up with a CFITSIO error, complaining that the file isn't FITS.
    
    With this commit, a check is added to avoid the crash.
---
 bin/statistics/statistics.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/statistics/statistics.c b/bin/statistics/statistics.c
index e9ad1e5..9871220 100644
--- a/bin/statistics/statistics.c
+++ b/bin/statistics/statistics.c
@@ -594,10 +594,13 @@ write_output_table(struct statisticsparams *p, gal_data_t 
*table,
   gal_table_write(table, comments, p->cp.tableformat, output, "TABLE", 0);
 
 
-  /* Write the configuration information. */
-  gal_fits_key_write_filename("input", p->inputname, &p->cp.okeys, 1);
-  gal_fits_key_write_config(&p->cp.okeys, "Statistics configuration",
-                            "STATISTICS-CONFIG", output, "0");
+  /* Write the configuration information if we have a FITS output. */
+  if(!strcmp(fix, "fits"))
+    {
+      gal_fits_key_write_filename("input", p->inputname, &p->cp.okeys, 1);
+      gal_fits_key_write_config(&p->cp.okeys, "Statistics configuration",
+                                "STATISTICS-CONFIG", output, "0");
+    }
 
 
   /* Let the user know, if we aren't in quiet mode. */
@@ -670,7 +673,6 @@ save_hist_and_or_cfp(struct statisticsparams *p)
   /* Set the output file name. */
   write_output_table(p, bins, suf, contents);
 
-
   /* Clean up. */
   gal_data_free(range);
 }



reply via email to

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