Commit 1f1191b0 authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fix issues with compressed FITS files.

parent c7bf6799
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -67,9 +67,9 @@ author = u'E. Bertin'
# built documents.
# built documents.
#
#
# The short X.Y version.
# The short X.Y version.
version = '2.27.0'
version = '2.27.1'
# The full version, including alpha/beta/rc tags.
# 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
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# for a list of supported languages.
@@ -81,7 +81,7 @@ language = None
# There are two options for replacing |today|: either, you set today to some
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# 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.
# Else, today_fmt is used as the format for a strftime call.
#
#
@@ -144,7 +144,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents.
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
# "<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.
# A shorter title for the navigation bar.  Default is the same as html_title.
#
#
+20 −2
Original line number Original line Diff line number Diff line
@@ -70,19 +70,37 @@ picstruct *newfield(char *filename, int flags, int ext)
  field->cat = cat;
  field->cat = cat;
  nok = 0;
  nok = 0;
  tab = cat->tab;
  tab = cat->tab;
#ifdef HAVE_CFITSIO
  if ((tab->isTileCompressed) ||
  if ((tab->isTileCompressed) ||
	(tab->naxis >= 2
	(tab->naxis >= 2
	&& strncmp(tab->xtension, "BINTABLE", 8)
	&& strncmp(tab->xtension, "BINTABLE", 8)
	&& strncmp(tab->xtension, "ASCTABLE", 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++;
    nok++;
  ext2 = ext;
  ext2 = ext;
  for (ntab=cat->ntab; ext2-- && ntab--;)
  for (ntab=cat->ntab; ext2-- && ntab--;)
    {
    {
    tab=tab->nexttab;
    tab=tab->nexttab;
#ifdef HAVE_CFITSIO
    if ((tab->isTileCompressed) ||
    if ((tab->isTileCompressed) ||
	(tab->naxis >= 2
	(tab->naxis >= 2
		&& strncmp(tab->xtension, "BINTABLE", 8)
		&& strncmp(tab->xtension, "BINTABLE", 8)
		&& strncmp(tab->xtension, "ASCTABLE", 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++;
      nok++;
    }
    }
  if (!nok)
  if (!nok)
+3 −7
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@
*	You should have received a copy of the GNU General Public License
*	You should have received a copy of the GNU General Public License
*	along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*	along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
*
*	Last modified:		25/02/2023
*	Last modified:		07/03/2023
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/


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