Skip to content

Commit

Permalink
Fix issues with compressed FITS files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebertin committed Mar 7, 2023
1 parent c7bf679 commit 1f1191b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
8 changes: 4 additions & 4 deletions doc/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
# built documents.
#
# The short X.Y version.
version = '2.27.0'
version = '2.27.1'
# The full version, including alpha/beta/rc tags.
release = '2.27.0'
release = '2.27.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -81,7 +81,7 @@
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#
today = 'Sat Feb 25 2023'
today = 'Tue Mar 07 2023'
#
# Else, today_fmt is used as the format for a strftime call.
#
Expand Down Expand Up @@ -144,7 +144,7 @@
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'SExtractor v2.27.0'
# html_title = u'SExtractor v2.27.1'

# A shorter title for the navigation bar. Default is the same as html_title.
#
Expand Down
22 changes: 20 additions & 2 deletions src/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,41 @@ picstruct *newfield(char *filename, int flags, int ext)
field->cat = cat;
nok = 0;
tab = cat->tab;
#ifdef HAVE_CFITSIO
if ((tab->isTileCompressed) ||
(tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8)))
#else
if (tab->isTileCompressed)
warning(BANNER " has been compiled without CFITSIO support: "
"compressed image skipped in ", filename);
if (tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8))
#endif
nok++;
ext2 = ext;
for (ntab=cat->ntab; ext2-- && ntab--;)
{
tab=tab->nexttab;
#ifdef HAVE_CFITSIO
if ((tab->isTileCompressed) ||
(tab->naxis >= 2
(tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8)))
#else
if (tab->isTileCompressed)
warning(BANNER " has been compiled without CFITSIO support: "
"compressed image skipped in ", filename);
if (tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8))
#endif
nok++;
}
if (!nok)
error(EXIT_FAILURE, "Not a valid FITS image in ",filename);
error(EXIT_FAILURE, "Not a valid FITS image in ", filename);

field->tab = tab;
if (ntab<0)
Expand Down
10 changes: 3 additions & 7 deletions src/makeit.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 25/02/2023
* Last modified: 07/03/2023
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

Expand Down Expand Up @@ -707,8 +707,8 @@ INPUT Filename character string.
OUTPUT Extension number, or RETURN_ERROR if nos extension specified.
NOTES The bracket and its extension number are removed from the filename if
found.
AUTHOR E. Bertin (IAP)
VERSION 23/09/2020
AUTHOR E. Bertin (CFHT/IAP)
VERSION 07/03/2023
***/
static int selectext(char *filename)
{
Expand All @@ -722,10 +722,6 @@ static int selectext(char *filename)
*bracr = '\0';
next = strtol(bracl+1, NULL, 0);

// VERY BAD HACK to check if this is tile-compressed, if so, add +1 to extension number requested
if (strstr(filename, ".fits.fz") != NULL)
next++;

return next;
}

Expand Down

0 comments on commit 1f1191b

Please sign in to comment.