gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master a15ef2a: FITS files now acceptable with .fit s


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a15ef2a: FITS files now acceptable with .fit suffix
Date: Sun, 25 Jun 2017 16:36:41 -0400 (EDT)

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

    FITS files now acceptable with .fit suffix
    
    The `.fit' suffix is used by some systems to store FITS files. Because it
    only has three characters, it may be preferrable in some contexts. So with
    this commit, Gnuastro also accepts files ending with `.fit' as FITS files.
    
    This was suggested by David Valls-Gabaud.
---
 doc/gnuastro.texi |  8 ++++++--
 lib/fits.c        | 10 ++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 3ce6c99..6de7077 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -4251,6 +4251,9 @@ can accept specific formats, for example 
@ref{ConvertType} also accepts
 @file{.fits}: The standard file name ending of a FITS image.
 
 @item
address@hidden: Alternative (3 character) FITS suffix.
+
address@hidden
 @file{.fits.Z}: A FITS image compressed with @command{compress}.
 
 @item
@@ -19068,8 +19071,9 @@ default string after the CFITSIO error.
 @deftypefun int gal_fits_name_is_fits (char @code{*name})
 If the @code{name} is an acceptable CFITSIO FITS filename return @code{1}
 (one), otherwise return @code{0} (zero). The currently acceptable FITS
-suffixes are @file{.fits}, @file{.fits.gz}, @file{.fits.Z}, @file{.imh},
address@hidden IMH is the IRAF format which is acceptable to CFITSIO.
+suffixes are @file{.fits}, @file{.fit}, @file{.fits.gz}, @file{.fits.Z},
address@hidden, @file{.fits.fz}. IMH is the IRAF format which is acceptable to
+CFITSIO.
 @end deftypefun
 
 @deftypefun int gal_fits_suffix_is_fits (char @code{*suffix})
diff --git a/lib/fits.c b/lib/fits.c
index da89dc8..abb30cd 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -102,7 +102,8 @@ gal_fits_name_is_fits(char *name)
 {
   size_t len;
   len=strlen(name);
-  if ( ( len>=4 && strcmp(&name[len-4], "fits") == 0 )
+  if ( ( len>=3 && strcmp(&name[len-3], "fit") == 0 )
+       || ( len>=4 && strcmp(&name[len-4], "fits") == 0 )
        || ( len>=7 && strcmp(&name[len-7], "fits.gz") == 0 )
        || ( len>=6 && strcmp(&name[len-6], "fits.Z") == 0 )
        || ( len>=3 && strcmp(&name[len-3], "imh") == 0 )
@@ -123,10 +124,11 @@ gal_fits_name_is_fits(char *name)
 int
 gal_fits_suffix_is_fits(char *suffix)
 {
-  if (strcmp(suffix, "fits") == 0 || strcmp(suffix, ".fits") == 0
+  if (strcmp(suffix, "fit") == 0        || strcmp(suffix, ".fit") == 0
+      || strcmp(suffix, "fits") == 0    || strcmp(suffix, ".fits") == 0
       || strcmp(suffix, "fits.gz") == 0 || strcmp(suffix, ".fits.gz") == 0
-      || strcmp(suffix, "fits.Z") == 0 || strcmp(suffix, ".fits.Z") == 0
-      || strcmp(suffix, "imh") == 0 || strcmp(suffix, ".imh") == 0
+      || strcmp(suffix, "fits.Z") == 0  || strcmp(suffix, ".fits.Z") == 0
+      || strcmp(suffix, "imh") == 0     || strcmp(suffix, ".imh") == 0
       || strcmp(suffix, "fits.fz") == 0 || strcmp(suffix, ".fits.fz") == 0)
    return 1;
  else



reply via email to

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