gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 38e601b: FITS keyword titles aligned


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 38e601b: FITS keyword titles aligned
Date: Tue, 29 Aug 2017 09:29:17 -0400 (EDT)

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

    FITS keyword titles aligned
    
    The "Versions and date" title of the FITS keywords was not aligned with the
    WCS title or the Crop titles. To fix this in any place that a keyword title
    is necessary, a macro was defined in `lib/gnuastro/fits.h' which is now
    used everywhere.
    
    Also, there was one extra blank line before the "Crop information" title in
    Crop's outputs which is now corrected.
---
 bin/crop/onecrop.c  | 7 ++-----
 lib/fits.c          | 8 +++-----
 lib/gnuastro/fits.h | 2 +-
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/bin/crop/onecrop.c b/bin/crop/onecrop.c
index 93cbba9..f09dbc6 100644
--- a/bin/crop/onecrop.c
+++ b/bin/crop/onecrop.c
@@ -577,7 +577,6 @@ onecrop_make_array(struct onecropparams *crp, long 
*fpixel_i,
   char **strarr, cpname[FLEN_KEYWORD];
   gal_data_t *rkey=gal_data_array_calloc(1);
   char *cp, *cpf, blankrec[80], titlerec[80];
-  char startblank[]="                      / ";
   struct inputimgs *img=&crp->p->imgs[crp->in_ind];
 
 
@@ -663,7 +662,7 @@ onecrop_make_array(struct onecropparams *crp, long 
*fpixel_i,
       /* Write the WCS title and common WCS information. */
       if(fits_write_record(ofp, blankrec, &status))
         gal_fits_io_error(status, NULL);
-      sprintf(titlerec, "%sWCS information", startblank);
+      sprintf(titlerec, "%sWCS information", GAL_FITS_KEY_TITLE_START);
       for(i=strlen(titlerec);i<79;++i)
         titlerec[i]=' ';
       fits_write_record(ofp, titlerec, &status);
@@ -683,9 +682,7 @@ onecrop_make_array(struct onecropparams *crp, long 
*fpixel_i,
 
 
   /* Add the Crop information. */
-  if(fits_write_record(ofp, blankrec, &status))
-    gal_fits_io_error(status, NULL);
-  sprintf(titlerec, "%sCrop information", startblank);
+  sprintf(titlerec, "%sCrop information", GAL_FITS_KEY_TITLE_START);
   for(i=strlen(titlerec);i<79;++i)
     titlerec[i]=' ';
   if(fits_write_record(ofp, titlerec, &status))
diff --git a/lib/fits.c b/lib/fits.c
index d172a6c..9350c2f 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1123,7 +1123,6 @@ gal_fits_key_write_wcsstr(fitsfile *fptr, char *wcsstr, 
int nkeyrec)
 {
   size_t i;
   int h, status=0;
-  char startblank[]="                      / ";
   char *cp, *cpf, blankrec[80], titlerec[80];
 
   /* Set the last element of the blank array. */
@@ -1135,7 +1134,7 @@ gal_fits_key_write_wcsstr(fitsfile *fptr, char *wcsstr, 
int nkeyrec)
   /* Print the first two lines before the WCS header information. */
   if(fits_write_record(fptr, blankrec, &status))
     gal_fits_io_error(status, NULL);
-  sprintf(titlerec, "%sWCS information", startblank);
+  sprintf(titlerec, "%sWCS information", GAL_FITS_KEY_TITLE_START);
   for(i=strlen(titlerec);i<79;++i)
     titlerec[i]=' ';
   if(fits_write_record(fptr, titlerec, &status))
@@ -1210,7 +1209,6 @@ gal_fits_key_write_version(fitsfile *fptr, 
gal_fits_list_key_t *headers,
   int status=0;
   char *gitdescribe;
   char cfitsioversion[20];
-  char startblank[]="              / ";
   char *cp, *cpf, blankrec[80], titlerec[80];
 
   /* Before WCSLIB 5.0, the wcslib_version function was not
@@ -1233,7 +1231,7 @@ gal_fits_key_write_version(fitsfile *fptr, 
gal_fits_list_key_t *headers,
   if(headers)
     {
       fits_write_record(fptr, blankrec, &status);
-      sprintf(titlerec, "%s%s", startblank,
+      sprintf(titlerec, "%s%s", GAL_FITS_KEY_TITLE_START,
               program_name ? program_name : PACKAGE_NAME);
       for(i=strlen(titlerec);i<79;++i) titlerec[i]=' ';
       fits_write_record(fptr, titlerec, &status);
@@ -1243,7 +1241,7 @@ gal_fits_key_write_version(fitsfile *fptr, 
gal_fits_list_key_t *headers,
 
   /* Start printing the version information */
   fits_write_record(fptr, blankrec, &status);
-  sprintf(titlerec, "%sVersions and date", startblank);
+  sprintf(titlerec, "%sVersions and date", GAL_FITS_KEY_TITLE_START);
   for(i=strlen(titlerec);i<79;++i) titlerec[i]=' ';
   fits_write_record(fptr, titlerec, &status);
   gal_fits_io_error(status, NULL);
diff --git a/lib/gnuastro/fits.h b/lib/gnuastro/fits.h
index b7b67c8..a44a3d5 100644
--- a/lib/gnuastro/fits.h
+++ b/lib/gnuastro/fits.h
@@ -68,7 +68,7 @@ __BEGIN_C_DECLS  /* From C++ preparations */
 
 /* Macros. */
 #define GAL_FITS_MAX_NDIM 999
-
+#define GAL_FITS_KEY_TITLE_START "                      / "
 
 
 



reply via email to

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