Unverified Commit 572b27d7 authored by Emmanuel Bertin's avatar Emmanuel Bertin Committed by GitHub
Browse files

Merge pull request #42 from astromatic/icx

Icx
parents 9689a1c4 cd937f43
...@@ -4,7 +4,7 @@ Installing the software ...@@ -4,7 +4,7 @@ Installing the software
Hardware requirements Hardware requirements
===================== =====================
PSFEx runs in (ANSI) text-mode from a shell. A window system is SExtractor runs in (ANSI) text-mode from a shell. A window system is
not necessary for basic operation. not necessary for basic operation.
When it comes to memory usage, the amount required by SExtractor depends When it comes to memory usage, the amount required by SExtractor depends
...@@ -75,18 +75,19 @@ locations: ...@@ -75,18 +75,19 @@ locations:
$ ./configure $ ./configure
Compared to "gcc" and the librairies above, the combination of the Compared to "gcc" and the librairies above, the combination of the
Intel compiler ("icc") and the MKL (Math Kernel Library) libraries Intel compiler ("icc" or "icx") and the MKL (Math Kernel Library)
can give the SExtractor executable a significant boost in performance, libraries can give the SExtractor executable a significant boost in
thanks to better vectorized code, and reduced memory usage. If "icc" performance, thanks to better vectorized code, and reduced memory
and the MKL (Math Kernel Library) are installed on your system [4], usage. If "icc" (or "icx") and the MKL (Math Kernel Library) are
you can take advantage of those using instead installed on your system [4], you can take advantage of those using
instead
$ ./configure --enable-mkl $ ./configure --enable-mkl
Additionally, if the SExtractor binary is to be run on a different Additionally, if the SExtractor binary is to be run on a different
machine that does not have "icc" and the MKL (Math Kernel Library) machine that does not have "icc" (or "icx") and the MKL installed
installed (e.g., a cluster computing node), you must configure a (e.g., a cluster computing node), you must configure a partially
partially statically linked executable using statically linked executable using
$ ./configure --enable-mkl --enable-auto-flags --enable-best-link $ ./configure --enable-mkl --enable-auto-flags --enable-best-link
...@@ -118,6 +119,5 @@ path). ...@@ -118,6 +119,5 @@ path).
options "--enable-threads --enable-float". options "--enable-threads --enable-float".
[4] The Linux versions of the Intel compiler and MKL (Math [4] The Linux versions of the Intel compiler and MKL (Math
Kernel Library) are available for free to academic researchers, Kernel Library) are now available for free on Intel's website.
students, educators and open source contributors.
...@@ -22,7 +22,7 @@ ...@@ -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: 11/03/2022 # Last modified: 16/09/2022
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...@@ -31,8 +31,8 @@ define([AC_CACHE_LOAD],) ...@@ -31,8 +31,8 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],) define([AC_CACHE_SAVE],)
# This is your standard AstrOmatic source code... # This is your standard AstrOmatic source code...
AC_INIT(SExtractor, 2.25.3, [astromatic@astromatic.net], AC_INIT([SExtractor],[2.27.0],[astromatic@astromatic.iap.fr],
sextractor, [http://astromatic.net/software/sextractor]) [sextractor],[http://astromatic.net/software/sextractor])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_AUX_DIR(autoconf)
AC_CONFIG_SRCDIR(src/makeit.c) AC_CONFIG_SRCDIR(src/makeit.c)
...@@ -53,6 +53,7 @@ sinclude(acx_atlas.m4) ...@@ -53,6 +53,7 @@ sinclude(acx_atlas.m4)
sinclude(acx_openblas.m4) sinclude(acx_openblas.m4)
sinclude(acx_fftw.m4) sinclude(acx_fftw.m4)
sinclude(acx_mkl.m4) sinclude(acx_mkl.m4)
sinclude(acx_cfitsio.m4)
sinclude(acx_prog_cc_optim.m4) sinclude(acx_prog_cc_optim.m4)
sinclude(acx_pthread.m4) sinclude(acx_pthread.m4)
sinclude(acx_urbi_resolve_dir.m4) sinclude(acx_urbi_resolve_dir.m4)
...@@ -79,24 +80,38 @@ AC_ARG_ENABLE(auto-flags, ...@@ -79,24 +80,38 @@ AC_ARG_ENABLE(auto-flags,
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])) AC_MSG_RESULT([no]))
# Provide special option for the Linux Intel C compiler # Provide special option for the Linux Intel C "classic" compiler
AC_MSG_CHECKING([whether the INTEL compiler is enabled]) AC_MSG_CHECKING([whether the classic INTEL compiler is enabled])
AC_ARG_ENABLE(icc, AC_ARG_ENABLE(icc,
[AS_HELP_STRING([--enable-icc], [AS_HELP_STRING([--enable-icc],
[Use the Intel compiler (default = no)])], [Use the Intel compiler (default = no)])],
CC="icc" CC="icc"
enable_iccx="yes"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
# Provide special option for the Linux Intel OneAPI C compiler
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
AC_ARG_ENABLE(icx,
[AS_HELP_STRING([--enable-icx],
[Use the Intel compiler (default = no)])],
CC="icx"
enable_iccx="yes"
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])) AC_MSG_RESULT([no]))
# Provide special options for INTEL MKL # Provide special options for INTEL MKL
# We force the use of icc # We use icc if available, if not Intel OneAPI's icx
# (we don't use AC_PROG_CC as it does not play nice
# in a conditional block)
AC_MSG_CHECKING([whether INTEL's MKL is enabled]) AC_MSG_CHECKING([whether INTEL's MKL is enabled])
AC_ARG_ENABLE(mkl, AC_ARG_ENABLE(mkl,
[AS_HELP_STRING([--enable-mkl], [AS_HELP_STRING([--enable-mkl],
[Use INTEL's MKL for solvers and FFTs (default = no)])], [Use INTEL's MKL for solvers and FFTs (default = no)])],
enable_icc="yes" AC_MSG_RESULT([yes])
CC="icc" CC=""
AC_MSG_RESULT([yes]), [AC_CHECK_PROGS(CC, [icc icx cc])]
enable_iccx="yes",
AC_MSG_RESULT([no])) AC_MSG_RESULT([no]))
# Checks for programs. # Checks for programs.
...@@ -115,11 +130,10 @@ AC_PROG_INSTALL ...@@ -115,11 +130,10 @@ AC_PROG_INSTALL
AC_CHECK_LIB(m, sin) AC_CHECK_LIB(m, sin)
# Checks for header files. # Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \ AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
sys/types.h unistd.h]) sys/types.h unistd.h])
# Checks for INTEL math header files. # Checks for INTEL math header files.
if test "$enable_icc" = "yes"; then if test "$enable_iccx" = "yes"; then
AC_CHECK_HEADERS(mathimf.h) AC_CHECK_HEADERS(mathimf.h)
fi fi
...@@ -135,7 +149,6 @@ AC_TYPE_UID_T ...@@ -135,7 +149,6 @@ AC_TYPE_UID_T
# Checks for library functions. # Checks for library functions.
AC_FUNC_ERROR_AT_LINE AC_FUNC_ERROR_AT_LINE
AC_FUNC_MMAP AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_STAT AC_FUNC_STAT
AC_FUNC_STRFTIME AC_FUNC_STRFTIME
AC_CHECK_FUNCS([atexit getenv gettimeofday isinf isnan logf memcpy memmove \ AC_CHECK_FUNCS([atexit getenv gettimeofday isinf isnan logf memcpy memmove \
...@@ -180,6 +193,24 @@ AC_ARG_WITH(openblas-incdir, ...@@ -180,6 +193,24 @@ AC_ARG_WITH(openblas-incdir,
[AS_HELP_STRING([--with-openblas-incdir=<OpenBLAS header dir>], [AS_HELP_STRING([--with-openblas-incdir=<OpenBLAS header dir>],
[Provide an alternative path to the OpenBLAS header directory])]) [Provide an alternative path to the OpenBLAS header directory])])
# Provide special option for CFITSIO
AC_MSG_CHECKING([whether CFITSIO support should be disabled (default=enabled)])
AC_ARG_ENABLE(cfitsio,
[AS_HELP_STRING([--disable-cfitsio],
[Disable support for compressed FITS files through the CFITSIO library (default=enabled)])],
if test "$enable_cfitsio" = "no"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi,
AC_MSG_RESULT([no]))
AC_ARG_WITH(cfitsio-libdir,
[AS_HELP_STRING([--with-cfitsio-libdir=<CFITSIO library path>],
[Provide an alternative path to the CFITSIO library])])
AC_ARG_WITH(cfitsio-incdir,
[AS_HELP_STRING([--with-cfitsio-incdir=<CFITSIO include dir>],
[Provide an alternative path to the CFITSIO include directory])])
# Provide a special option for the default XSLT URL # Provide a special option for the default XSLT URL
with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl" with_xsl_url="file://"$(URBI_RESOLVE_DIR([$datadir]))"/$PACKAGE_TARNAME/$PACKAGE_TARNAME.xsl"
AC_ARG_WITH(xsl_url, AC_ARG_WITH(xsl_url,
...@@ -222,7 +253,7 @@ use_pthreads="no" ...@@ -222,7 +253,7 @@ use_pthreads="no"
AC_MSG_CHECKING([for profiler mode]) AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling, AC_ARG_ENABLE(profiling,
[AS_HELP_STRING([--enable-profiling], [AS_HELP_STRING([--enable-profiling],
[Enable special mode for profiling (default = no)])] [Enable special mode for profiling (default = no)])],
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])) AC_MSG_RESULT([no]))
...@@ -256,10 +287,7 @@ if test "$enable_model_fitting" != "no"; then ...@@ -256,10 +287,7 @@ if test "$enable_model_fitting" != "no"; then
if test "$enable_mkl" = "yes"; then if test "$enable_mkl" = "yes"; then
convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a" convlibs="${srcdir}/wcs/libwcs_c.a,${srcdir}/levmar/liblevmar.a"
ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs) ACX_MKL($with_mkl_dir,,$enable_best_link,$convlibs)
if test "$MKL_WARN" == ""; then if test "$MKL_WARN" != ""; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_WARN([$MKL_WARN]) AC_MSG_WARN([$MKL_WARN])
fi fi
AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS " AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
...@@ -305,11 +333,21 @@ if test "$enable_model_fitting" != "no"; then ...@@ -305,11 +333,21 @@ if test "$enable_model_fitting" != "no"; then
fi fi
fi fi
########################## handle the CFITSIO library ########################
if test "$enable_cfitsio" != "no"; then
ACX_CFITSIO($with_cfitsio_libdir, $with_cfitsio_incdir,
[LIBS="$CFITSIO_LIBS $LIBS"]
if test "$CFITSIO_WARN" != ""; then
AC_MSG_WARN([$CFITSIO_WARN])
fi,
AC_MSG_ERROR([$CFITSIO_ERROR Exiting.]))
fi
AM_CONDITIONAL(USE_MODEL, [test "$enable_model_fitting" != "no"]) AM_CONDITIONAL(USE_MODEL, [test "$enable_model_fitting" != "no"])
# Compile with profiling option # Compile with profiling option
if test "$enable_profiling" = "yes"; then if test "$enable_profiling" = "yes"; then
if test "$enable_icc" = "yes"; then if test "$enable_iccx" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -pq" AM_CFLAGS="$AM_CFLAGS -pq"
else else
AM_CFLAGS="$AM_CFLAGS -pg" AM_CFLAGS="$AM_CFLAGS -pg"
...@@ -319,9 +357,9 @@ fi ...@@ -319,9 +357,9 @@ fi
# "Best" linking option # "Best" linking option
if test "$enable_best_link" = "yes"; then if test "$enable_best_link" = "yes"; then
if test "$enable_icc" = "yes"; then if test "$enable_iccx" = "yes"; then
AM_LDFLAGS="-static-intel -qopenmp-link static -shared-libgcc \ AM_LDFLAGS="-static-intel -qopenmp-link=static -shared-libgcc \
-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS" -static-libtool-libs -avoid-version $AM_LDFLAGS"
else else
AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS" AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
fi fi
......
...@@ -15,7 +15,7 @@ ifeq ($(USE_BEST),1) ...@@ -15,7 +15,7 @@ ifeq ($(USE_BEST),1)
dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE) \ dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --mandir=\$${prefix}/share/man \ --prefix=/usr --mandir=\$${prefix}/share/man \
--enable-icc --enable-mkl \ --enable-icx --enable-mkl \
--enable-auto-flags --enable-best-link \ --enable-auto-flags --enable-best-link \
--with-release=$(PACKAGE_RELEASE) --with-release=$(PACKAGE_RELEASE)
else else
......
...@@ -67,9 +67,9 @@ author = u'E. Bertin' ...@@ -67,9 +67,9 @@ author = u'E. Bertin'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '2.25.3' version = '2.27.0'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '2.25.3' release = '2.27.0'
# 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 ...@@ -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 = 'Fri Mar 11 2022' today = 'Fri Sep 16 2022'
# #
# 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()] ...@@ -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.25.3' # html_title = u'SExtractor v2.27.0'
# 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.
# #
......
dnl
dnl acx_cfitsio.m4
dnl
dnl Figure out if the CFITSIO library and header files are installed.
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl This file part of: AstrOmatic software
dnl
dnl Copyright: (C) 2013 Emmanuel Bertin -- IAP/CNRS/UPMC
dnl
dnl License: GNU General Public License
dnl
dnl AstrOmatic software is free software: you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License as
dnl published by the Free Software Foundation, either version 3 of the
dnl License, or (at your option) any later version.
dnl AstrOmatic software is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Last modified: 27/02/2013
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl @synopsis ACX_CFITSIO([CFITSIO_DIR, CFITSIO_INCDIR,
dnl [ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
dnl This macro figures out if the CFITSIO libraries and header
dnl files are installed.
dnl You may wish to use these variables in your default LIBS and CFLAGS:
dnl
dnl LIBS="$CFITSIO_LIBS $LIBS"
dnl
dnl You may wish to use these variables in your default CFLAGS:
dnl
dnl CFLAGS="$CFLAGS $CFITSIO_CFLAGS"
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if CFITSIO
dnl is found (HAVE_CFITSIO are defined first), and ACTION-IF-NOT-FOUND
dnl is a list of commands to run it if it is not found.
AC_DEFUN([ACX_CFITSIO], [
AC_REQUIRE([AC_CANONICAL_HOST])
dnl --------------------
dnl Search include files
dnl --------------------
acx_cfitsio_ok=no
if test x$2 = x; then
AC_CHECK_HEADER(fitsio.h,[acx_cfitsio_ok=yes])
if test x$acx_cfitsio_ok = xyes; then
AC_DEFINE(CFITSIO_H, "fitsio.h", [CFITSIO header filename.])
else
AC_CHECK_HEADER(cfitsio/fitsio.h,[acx_cfitsio_ok=yes])
if test x$acx_cfitsio_ok = xyes; then
AC_DEFINE(CFITSIO_H, "cfitsio/fitsio.h", [CFITSIO header filename.])
else
CFITSIO_ERROR="CFITSIO include files not found at default location!"
fi
fi
else
AC_CHECK_HEADER($2/fitsio.h,[acx_cfitsio_ok=yes])
if test x$acx_cfitsio_ok = xyes; then
AC_DEFINE_UNQUOTED(CFITSIO_H, "$2/fitsio.h", [CFITSIO header filename.])
else
CFITSIO_ERROR="CFITSIO include files not found in $2!"
fi
fi
dnl --------------------
dnl Search library files
dnl --------------------
CFITSIO_LIBS=""
OLIBS="$LIBS"
LIBS=""
if test x$acx_cfitsio_ok = xyes; then
if test x$1 = x; then
AC_CHECK_LIB(cfitsio, ffopen, [acx_cfitsio_ok=yes], [acx_cfitsio_ok=no])
if test x$acx_cfitsio_ok = xyes; then
AC_DEFINE(HAVE_CFITSIO,1, [Define if you have the CFITSIO libraries and header files.])
CFITSIO_LIBS="-lcfitsio"
else
CFITSIO_ERROR="CFITSIO library files not found at usual locations!"
fi
else
dnl -------------------------
dnl Specific libdir specified
dnl -------------------------
AC_CHECK_LIB(cfitsio, ffopen, [acx_cfitsio_ok=yes], [acx_cfitsio_ok=no], [-L$1])
if test x$acx_cfitsio_ok = xyes; then
AC_DEFINE(HAVE_CFITSIO,1, [Define if you have the CFITSIO libraries and header files.])
CFITSIO_LIBS="-L$1 -lcfitsio"
else
CFITSIO_ERROR="CFITSIO library files not found in $1!"
fi
fi
fi
LIBS="$OLIBS"
if test x$acx_cfitsio_ok = xyes; then
AC_SUBST(CFITSIO_LIBS)
$3
else
AC_SUBST(CFITSIO_ERROR)
$4
fi
])dnl ACX_CFITSIO
...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
dnl This file part of: AstrOmatic software dnl This file part of: AstrOmatic software
dnl dnl
dnl Copyright: (C) 2003-2016 IAP/CNRS/UPMC dnl Copyright: (C) 2003-2022 IAP/CNRS/SorbonneU
dnl dnl
dnl License: GNU General Public License dnl License: GNU General Public License
dnl dnl
...@@ -23,7 +23,7 @@ dnl You should have received a copy of the GNU General Public License ...@@ -23,7 +23,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software. dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>. dnl If not, see <http://www.gnu.org/licenses/>.
dnl dnl
dnl Last modified: 16/03/2016 dnl Last modified: 15/09/2022
dnl dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
...@@ -73,11 +73,11 @@ dnl Set architecture flags ...@@ -73,11 +73,11 @@ dnl Set architecture flags
dnl ---------------------- dnl ----------------------
dnl check if INTEL compiler is present dnl check if INTEL compiler is present
icc -V 2>&1 | grep -i "Intel" > /dev/null 2>&1 && flagicc=yes $CC -V 2>&1 | grep -i "Intel" > /dev/null 2>&1 && flagicc=yes
dnl check if INTEL compiler uses x86_64 architecture dnl check if INTEL compiler uses x86_64 architecture
icc -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 && flag64=yes $CC -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 && flag64=yes
dnl check if the platform is OSX dnl check if the platform is OSX
icc -dumpmachine 2>&1 | grep -i "darwin" > /dev/null 2>&1 && flagosx=yes $CC -dumpmachine 2>&1 | grep -i "darwin" > /dev/null 2>&1 && flagosx=yes
dnl ---------------------- dnl ----------------------
dnl Exit if INTEL compiler is not found dnl Exit if INTEL compiler is not found
......
...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
dnl This file part of: AstrOmatic software dnl This file part of: AstrOmatic software
dnl dnl
dnl Copyright: (C) 2002-2013 Emmanuel Bertin -- IAP/CNRS/UPMC dnl Copyright: (C) 2002-2022 Emmanuel Bertin -- IAP/CNRS/SorbonneU
dnl (C) 2002 Ville Lauriki (original version) dnl (C) 2002 Ville Lauriki (original version)
dnl dnl
dnl Licenses: GPL (this version) dnl Licenses: GPL (this version)
...@@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License ...@@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software. dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>. dnl If not, see <http://www.gnu.org/licenses/>.
dnl dnl
dnl Last modified: 13/03/2013 dnl Last modified: 07/09/2022
dnl dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
...@@ -60,14 +60,14 @@ EOF ...@@ -60,14 +60,14 @@ EOF
if $CC -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 && if $CC -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 &&
$CC -c -O conftest.c > /dev/null 2>&1 && $CC -c -O conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then test -f conftest.o; then
prog_cc_optim_cv_flags="-O3 -axSSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I -no-prec-div -unroll" prog_cc_optim_cv_flags="-O3 -axSSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I"
prog_ld_optim_cv_flags="" prog_ld_optim_cv_flags=""
dnl INTEL C 32bits compiler dnl INTEL C 32bits compiler
elif $CC -V 2>&1 | grep -i "Intel(R)" > /dev/null 2>&1 && elif $CC -V 2>&1 | grep -i "Intel(R)" > /dev/null 2>&1 &&
$CC -c -O conftest.c > /dev/null 2>&1 && $CC -c -O conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then test -f conftest.o; then
prog_cc_optim_cv_flags="-O3 -axSSE2,SSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I -no-prec-div -unroll" prog_cc_optim_cv_flags="-O3 -axSSE2,SSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I"
prog_ld_optim_cv_flags="" prog_ld_optim_cv_flags=""
dnl GCC dnl GCC
......
...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...@@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
dnl This file part of: AstrOmatic software dnl This file part of: AstrOmatic software
dnl dnl
dnl Copyright: (C) 2002-2010 Emmanuel Bertin -- IAP/CNRS/UPMC dnl Copyright: (C) 2002-2022 Emmanuel Bertin -- IAP/CNRS/SorbonneU
dnl (C) 2001 Steven G. Johnson (original version) dnl (C) 2001 Steven G. Johnson (original version)
dnl dnl
dnl Licenses: GPL (this version) dnl Licenses: GPL (this version)
...@@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License ...@@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software. dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>. dnl If not, see <http://www.gnu.org/licenses/>.
dnl dnl
dnl Last modified: 09/10/2010 dnl Last modified: 15/09/2022
dnl dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl dnl
...@@ -88,7 +88,7 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then ...@@ -88,7 +88,7 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_LIBS="$LIBS" save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS" LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_LINK_IFELSE([AC_LANG_CALL([], pthread_join)], acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok) AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS="" PTHREAD_LIBS=""
...@@ -170,10 +170,10 @@ for flag in $acx_pthread_flags; do ...@@ -170,10 +170,10 @@ for flag in $acx_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread # pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub. # functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles. # We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>], AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0); [pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], pthread_create(0,0,0,0); pthread_cleanup_pop(0); ])],
[acx_pthread_ok=yes]) [acx_pthread_ok=yes])
LIBS="$save_LIBS" LIBS="$save_LIBS"
...@@ -199,12 +199,12 @@ if test "x$acx_pthread_ok" = xyes; then ...@@ -199,12 +199,12 @@ if test "x$acx_pthread_ok" = xyes; then
# Detect AIX lossage: threads are created detached by default # Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED). # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute]) AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>], AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;], [int attr=PTHREAD_CREATE_JOINABLE;])],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown) ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>], AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;], [int attr=PTHREAD_CREATE_UNDETACHED;])],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# This file part of: SExtractor # This file part of: SExtractor
# #
# Copyright: (C) 2002-2020 IAP/CNRS/SorbonneU # Copyright: (C) 2002-2022 IAP/CNRS/SorbonneU
# #
# License: GNU General Public License # License: GNU General Public License
# #
...@@ -22,7 +22,7 @@ ...@@ -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: 02/01/2020 # Last modified: 15/09/2022
# #
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...@@ -44,6 +44,7 @@ BuildRoot: %{_tmppath}/%{name}-buildroot ...@@ -44,6 +44,7 @@ BuildRoot: %{_tmppath}/%{name}-buildroot
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: fftw-devel >= 3.1 BuildRequires: fftw-devel >= 3.1
BuildRequires: atlas-devel >= 3.6.0 BuildRequires: atlas-devel >= 3.6.0
BuildRequires: cfitsio-devel >= 3.30
%description %description
Extract catalogs of sources from astronomical images Extract catalogs of sources from astronomical images
......
...@@ -280,8 +280,7 @@ void examineiso(picstruct *field, picstruct *dfield, objstruct *obj, ...@@ -280,8 +280,7 @@ void examineiso(picstruct *field, picstruct *dfield, objstruct *obj,
emy2 /= flux2; /* variance of ym */ emy2 /= flux2; /* variance of ym */
emxy /= flux2; /* covariance */ emxy /= flux2; /* covariance */
/*-- Handle fully correlated profile /*-- Handle fully correlated profiles (which cause a singularity...) */
s (which cause a singularity...) */
esum *= 0.08333/flux2; esum *= 0.08333/flux2;
if (obj->singuflag && (emx2*emy2-emxy*emxy) < esum*esum) if (obj->singuflag && (emx2*emy2-emxy*emxy) < esum*esum)
{ {
...@@ -718,10 +717,10 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield, ...@@ -718,10 +717,10 @@ void endobject(picstruct *field, picstruct *dfield, picstruct *wfield,
dgeo_copy(dgeofield, outobj2.vignet_dgeox , outobj2.vignet_dgeoy, dgeo_copy(dgeofield, outobj2.vignet_dgeox , outobj2.vignet_dgeoy,
prefs.vignet_dgeoxsize[0],prefs.vignet_dgeoxsize[1], ix,iy); prefs.vignet_dgeoxsize[0],prefs.vignet_dgeoxsize[1], ix,iy);
else { else {
if (FLAG(obj2.vignet_dgeox)) if (FLAG(obj2.vignet_dgeox))
dgeo_copy(dgeofield, outobj2.vignet_dgeox, NULL, dgeo_copy(dgeofield, outobj2.vignet_dgeox, NULL,
prefs.vignet_dgeoxsize[0],prefs.vignet_dgeoxsize[1], ix,iy); prefs.vignet_dgeoxsize[0],prefs.vignet_dgeoxsize[1], ix,iy);
if (FLAG(obj2.vignet_dgeoy)) if (FLAG(obj2.vignet_dgeoy))
dgeo_copy(dgeofield, NULL, outobj2.vignet_dgeoy, dgeo_copy(dgeofield, NULL, outobj2.vignet_dgeoy,
prefs.vignet_dgeoysize[0],prefs.vignet_dgeoysize[1], ix,iy); prefs.vignet_dgeoysize[0],prefs.vignet_dgeoysize[1], ix,iy);
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1993-2014 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -22,7 +22,7 @@ ...@@ -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: 17/06/2014 * Last modified: 23/09/2020
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -52,8 +52,10 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -52,8 +52,10 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
{ {
backstruct *backmesh,*wbackmesh, *bm,*wbm; backstruct *backmesh,*wbackmesh, *bm,*wbm;
tabstruct *tab, *wtab;
PIXTYPE *buf,*wbuf, *buft,*wbuft; PIXTYPE *buf,*wbuf, *buft,*wbuft;
OFF_T fcurpos,wfcurpos, wfcurpos2,fcurpos2, bufshift, jumpsize; OFF_T2 fcurpos,wfcurpos, wfcurpos2,fcurpos2, bufshift, jumpsize;
OFF_T2 currentElement, wcurrentElement, currentElement2, wcurrentElement2;
size_t bufsize, bufsize2, size_t bufsize, bufsize2,
size,meshsize; size,meshsize;
int i,j,k,m,n, step, nlines, int i,j,k,m,n, step, nlines,
...@@ -65,7 +67,11 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -65,7 +67,11 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
/* If the weight-map is not an external one, no stats are needed for it */ /* If the weight-map is not an external one, no stats are needed for it */
if (wfield && wfield->flags&(INTERP_FIELD|BACKRMS_FIELD)) if (wfield && wfield->flags&(INTERP_FIELD|BACKRMS_FIELD))
wfield= NULL; wfield= NULL;
tab = field->tab;
if (wfield)
wtab = wfield->tab;
else
wtab = NULL; /* to avoid gcc -Wall warnings */
w = field->width; w = field->width;
bw = field->backw; bw = field->backw;
bh = field->backh; bh = field->backh;
...@@ -83,12 +89,20 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -83,12 +89,20 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
wfcurpos = wfcurpos2 = 0; /* to avoid gcc -Wall warnings */ wfcurpos = wfcurpos2 = 0; /* to avoid gcc -Wall warnings */
QFTELL(field->file, fcurpos, field->filename); QFTELL(field->file, fcurpos, field->filename);
if (wfield) #ifdef HAVE_CFITSIO
currentElement = (tab->currentElement == 0) ? 1 : tab->currentElement;
#endif
if (wfield) {
QFTELL(wfield->file, wfcurpos, wfield->filename); QFTELL(wfield->file, wfcurpos, wfield->filename);
#ifdef HAVE_CFITSIO
wcurrentElement = (wtab->currentElement == 0) ? 1 : wtab->currentElement;
#endif
}
/* Allocate a correct amount of memory to store pixels */ /* Allocate a correct amount of memory to store pixels */
bufsize = (OFF_T)w*bh; bufsize = (OFF_T2)w*bh;
meshsize = (size_t)bufsize; meshsize = (size_t)bufsize;
nlines = 0; nlines = 0;
if (bufsize > (size_t)BACK_BUFSIZE) if (bufsize > (size_t)BACK_BUFSIZE)
...@@ -96,8 +110,8 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -96,8 +110,8 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
nlines = BACK_BUFSIZE/w; nlines = BACK_BUFSIZE/w;
step = (field->backh-1)/nlines+1; step = (field->backh-1)/nlines+1;
bufsize = (size_t)(nlines = field->backh/step)*w; bufsize = (size_t)(nlines = field->backh/step)*w;
bufshift = (step/2)*(OFF_T)w; bufshift = (step/2)*(OFF_T2)w;
jumpsize = (step-1)*(OFF_T)w; jumpsize = (step-1)*(OFF_T2)w;
} }
else else
bufshift = jumpsize = 0; /* to avoid gcc -Wall warnings */ bufshift = jumpsize = 0; /* to avoid gcc -Wall warnings */
...@@ -172,16 +186,23 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -172,16 +186,23 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
{ {
/*---- Image size too big, we have to skip a few data !*/ /*---- Image size too big, we have to skip a few data !*/
QFTELL(field->file, fcurpos2, field->filename); QFTELL(field->file, fcurpos2, field->filename);
if (wfield) #ifdef HAVE_CFITSIO
currentElement2 = (tab->currentElement == 0) ? 1 : tab->currentElement;
#endif
if (wfield){
QFTELL(wfield->file, wfcurpos2, wfield->filename); QFTELL(wfield->file, wfcurpos2, wfield->filename);
#ifdef HAVE_CFITSIO
wcurrentElement2 = (wtab->currentElement == 0) ? 1 : wtab->currentElement;
#endif
}
if (j == ny-1 && (n=field->height%field->backh)) if (j == ny-1 && (n=field->height%field->backh))
{ {
meshsize = n*(size_t)w; meshsize = n*(size_t)w;
nlines = BACK_BUFSIZE/w; nlines = BACK_BUFSIZE/w;
step = (n-1)/nlines+1; step = (n-1)/nlines+1;
bufsize = (nlines = n/step)*(size_t)w; bufsize = (nlines = n/step)*(size_t)w;
bufshift = (step/2)*(OFF_T)w; bufshift = (step/2)*(OFF_T2)w;
jumpsize = (step-1)*(OFF_T)w; jumpsize = (step-1)*(OFF_T2)w;
free(buf); free(buf);
QMALLOC(buf, PIXTYPE, bufsize); /* pixel buffer */ QMALLOC(buf, PIXTYPE, bufsize); /* pixel buffer */
if (wfield) if (wfield)
...@@ -192,35 +213,52 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -192,35 +213,52 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
} }
/*---- Read and skip, read and skip, etc... */ /*---- Read and skip, read and skip, etc... */
QFSEEK(field->file, bufshift*(OFF_T)field->bytepix, SEEK_CUR, QFSEEK(field->file, bufshift*(OFF_T2)field->bytepix, SEEK_CUR,
field->filename); field->filename);
#ifdef HAVE_CFITSIO
tab->currentElement += bufshift;
#endif
buft = buf; buft = buf;
for (i=nlines; i--; buft += w) for (i=nlines; i--; buft += w)
{ {
read_body(field->tab, buft, w); read_body(field->tab, buft, w);
if (i) if (i) {
QFSEEK(field->file, jumpsize*(OFF_T)field->bytepix, SEEK_CUR, QFSEEK(field->file, jumpsize*(OFF_T2)field->bytepix, SEEK_CUR,
field->filename); field->filename);
#ifdef HAVE_CFITSIO
tab->currentElement += jumpsize;
#endif
}
} }
if (wfield) if (wfield)
{ {
/*------ Read and skip, read and skip, etc... now on the weight-map */ /*------ Read and skip, read and skip, etc... now on the weight-map */
QFSEEK(wfield->file, bufshift*(OFF_T)wfield->bytepix, SEEK_CUR, QFSEEK(wfield->file, bufshift*(OFF_T2)wfield->bytepix, SEEK_CUR,
wfield->filename); wfield->filename);
#ifdef HAVE_CFITSIO
wtab->currentElement += bufshift;
#endif
wbuft = wbuf; wbuft = wbuf;
for (i=nlines; i--; wbuft += w) for (i=nlines; i--; wbuft += w)
{ {
read_body(wfield->tab, wbuft, w); read_body(wfield->tab, wbuft, w);
weight_to_var(wfield, wbuft, w); weight_to_var(wfield, wbuft, w);
if (i) if (i){
QFSEEK(wfield->file, jumpsize*(OFF_T)wfield->bytepix, SEEK_CUR, QFSEEK(wfield->file, jumpsize*(OFF_T2)wfield->bytepix, SEEK_CUR,
wfield->filename); wfield->filename);
#ifdef HAVE_CFITSIO
wtab->currentElement += jumpsize;
#endif
}
} }
} }
backstat(backmesh, wbackmesh, buf, wbuf, bufsize, nx, w, bw, backstat(backmesh, wbackmesh, buf, wbuf, bufsize, nx, w, bw,
wfield?wfield->weight_thresh:0.0); wfield?wfield->weight_thresh:0.0);
QFSEEK(field->file, fcurpos2, SEEK_SET, field->filename); QFSEEK(field->file, fcurpos2, SEEK_SET, field->filename);
#ifdef HAVE_CFITSIO
tab->currentElement = currentElement2;
#endif
bm = backmesh; bm = backmesh;
for (m=nx; m--; bm++) for (m=nx; m--; bm++)
if (bm->mean <= -BIG) if (bm->mean <= -BIG)
...@@ -230,6 +268,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -230,6 +268,9 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
if (wfield) if (wfield)
{ {
QFSEEK(wfield->file, wfcurpos2, SEEK_SET, wfield->filename); QFSEEK(wfield->file, wfcurpos2, SEEK_SET, wfield->filename);
#ifdef HAVE_CFITSIO
wtab->currentElement = wcurrentElement2;
#endif
wbm = wbackmesh; wbm = wbackmesh;
for (m=nx; m--; wbm++) for (m=nx; m--; wbm++)
if (wbm->mean <= -BIG) if (wbm->mean <= -BIG)
...@@ -284,8 +325,15 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag) ...@@ -284,8 +325,15 @@ void makeback(picstruct *field, picstruct *wfield, int wscale_flag)
/* Go back to the original position */ /* Go back to the original position */
QFSEEK(field->file, fcurpos, SEEK_SET, field->filename); QFSEEK(field->file, fcurpos, SEEK_SET, field->filename);
if (wfield) #ifdef HAVE_CFITSIO
tab->currentElement = currentElement;
#endif
if (wfield) {
QFSEEK(wfield->file, wfcurpos, SEEK_SET, wfield->filename); QFSEEK(wfield->file, wfcurpos, SEEK_SET, wfield->filename);
#ifdef HAVE_CFITSIO
wfield->tab->currentElement = wcurrentElement;
#endif
}
/* Median-filter and check suitability of the background map */ /* Median-filter and check suitability of the background map */
NFPRINTF(OUTPUT, "Filtering background map(s)"); NFPRINTF(OUTPUT, "Filtering background map(s)");
......
...@@ -1059,7 +1059,7 @@ void reendcat() ...@@ -1059,7 +1059,7 @@ void reendcat()
{ {
keystruct *key; keystruct *key;
tabstruct *tab; tabstruct *tab;
OFF_T pos; OFF_T2 pos;
char *head; char *head;
switch(prefs.cat_type) switch(prefs.cat_type)
...@@ -1127,4 +1127,3 @@ void zerocat(void) ...@@ -1127,4 +1127,3 @@ void zerocat(void)
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1993-2015 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2022 Emmanuel Bertin -- IAP/CNRS/SorbonneU
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -22,7 +22,7 @@ ...@@ -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: 11/03/2015 * Last modified: 07/09/2022
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
#define QCALLOC(ptr, typ, nel) \ #define QCALLOC(ptr, typ, nel) \
{if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \ {if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \
{ \ { \
sprintf(gstr, #ptr " (" #nel "=%lld elements) " \ sprintf(gstr, #ptr " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\ error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
#define QMALLOC(ptr, typ, nel) \ #define QMALLOC(ptr, typ, nel) \
{if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \ {if (!(ptr = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
{ \ { \
sprintf(gstr, #ptr " (" #nel "=%lld elements) " \ sprintf(gstr, #ptr " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\ error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
#define QMALLOC16(ptr, typ, nel) \ #define QMALLOC16(ptr, typ, nel) \
{if (posix_memalign((void **)&ptr, 16, (size_t)(nel)*sizeof(typ))) \ {if (posix_memalign((void **)&ptr, 16, (size_t)(nel)*sizeof(typ))) \
{ \ { \
sprintf(gstr, #ptr " (" #nel "=%lld elements) " \ sprintf(gstr, #ptr " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\ error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
#define QREALLOC(ptr, typ, nel) \ #define QREALLOC(ptr, typ, nel) \
{if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ))))\ {if (!(ptr = (typ *)realloc(ptr, (size_t)(nel)*sizeof(typ))))\
{ \ { \
sprintf(gstr, #ptr " (" #nel "=%lld elements) " \ sprintf(gstr, #ptr " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\ error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
{if (ptrin) \ {if (ptrin) \
{if (!(ptrout = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \ {if (!(ptrout = (typ *)malloc((size_t)(nel)*sizeof(typ)))) \
{ \ { \
sprintf(gstr, #ptrout " (" #nel "=%lld elements) " \ sprintf(gstr, #ptrout " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE,"Could not allocate memory for ",gstr);\ error(EXIT_FAILURE,"Could not allocate memory for ",gstr);\
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 2007-2017 IAP/CNRS/UPMC * Copyright: (C) 2007-2022 IAP/CNRS/SorbonneU
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -22,7 +22,7 @@ ...@@ -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: 19/06/2017 * Last modified: 07/09/2022
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define QFFTWF_MALLOC(ptr, typ, nel) \ #define QFFTWF_MALLOC(ptr, typ, nel) \
{if (!(ptr = (typ *)fftwf_malloc((size_t)(nel)*sizeof(typ)))) \ {if (!(ptr = (typ *)fftwf_malloc((size_t)(nel)*sizeof(typ)))) \
{ \ { \
sprintf(gstr, #ptr " (" #nel "=%lld elements) " \ sprintf(gstr, #ptr " (" #nel "=%zd elements) " \
"at line %d in module " __FILE__ " !", \ "at line %d in module " __FILE__ " !", \
(size_t)(nel)*sizeof(typ), __LINE__); \ (size_t)(nel)*sizeof(typ), __LINE__); \
error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\ error(EXIT_FAILURE, "Could not allocate memory for ", gstr);\
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1993-2012 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2020 IAP/CNRS/SorbonneU
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -22,7 +22,7 @@ ...@@ -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: 12/07/2012 * Last modified: 23/09/2020
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -70,6 +70,10 @@ picstruct *newfield(char *filename, int flags, int ext) ...@@ -70,6 +70,10 @@ 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)
nok++;
#endif
if (tab->naxis >= 2 if (tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))
...@@ -78,6 +82,10 @@ picstruct *newfield(char *filename, int flags, int ext) ...@@ -78,6 +82,10 @@ picstruct *newfield(char *filename, int flags, int 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)
nok++;
#endif
if (tab->naxis >= 2 if (tab->naxis >= 2
&& strncmp(tab->xtension, "BINTABLE", 8) && strncmp(tab->xtension, "BINTABLE", 8)
&& strncmp(tab->xtension, "ASCTABLE", 8)) && strncmp(tab->xtension, "ASCTABLE", 8))
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: AstrOmatic FITS/LDAC library * This file part of: AstrOmatic FITS/LDAC library
* *
* Copyright: (C) 1995-2010 IAP/CNRS/SorbonneU * Copyright: (C) 1995-2020 IAP/CNRS/SorbonneU
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* along with AstrOmatic software. * along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
* *
* Last modified: 11/02/2020 * Last modified: 26/08/2020
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
#include "fitscat_defs.h" #include "fitscat_defs.h"
#include "fitscat.h" #include "fitscat.h"
#ifdef HAVE_CFITSIO
#include CFITSIO_H
#endif
size_t body_maxram = BODY_DEFRAM, size_t body_maxram = BODY_DEFRAM,
body_maxvram = BODY_DEFVRAM, body_maxvram = BODY_DEFVRAM,
body_ramleft, body_vramleft, body_ramflag; body_ramleft, body_vramleft, body_ramflag;
...@@ -60,7 +64,7 @@ INPUT Table (tab) structure. ...@@ -60,7 +64,7 @@ INPUT Table (tab) structure.
OUTPUT Pointer to the mapped data if OK, or NULL otherwise. OUTPUT Pointer to the mapped data if OK, or NULL otherwise.
NOTES The file pointer must be positioned at the beginning of the data. NOTES The file pointer must be positioned at the beginning of the data.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 05/05/2001 VERSION 02/10/2017
***/ ***/
PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix))
{ {
...@@ -85,7 +89,11 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) ...@@ -85,7 +89,11 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix))
tab->extname); tab->extname);
/* Decide if the data will go in physical memory or on swap-space */ /* Decide if the data will go in physical memory or on swap-space */
#ifdef HAVE_CFITSIO
npix = tab->naxisn[0] * tab->naxisn[1];
#else
npix = tab->tabsize/tab->bytepix; npix = tab->tabsize/tab->bytepix;
#endif
size = npix*sizeof(PIXTYPE); size = npix*sizeof(PIXTYPE);
if (size < body_ramleft) if (size < body_ramleft)
{ {
...@@ -93,6 +101,9 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) ...@@ -93,6 +101,9 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix))
if ((tab->bodybuf = malloc(size))) if ((tab->bodybuf = malloc(size)))
{ {
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename); QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
#ifdef HAVE_CFITSIO
tab->currentElement = 1;
#endif
read_body(tab, (PIXTYPE *)tab->bodybuf, npix); read_body(tab, (PIXTYPE *)tab->bodybuf, npix);
/*---- Apply pixel processing */ /*---- Apply pixel processing */
if (func) if (func)
...@@ -120,6 +131,9 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) ...@@ -120,6 +131,9 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix))
if (!spoonful) if (!spoonful)
spoonful = DATA_BUFSIZE; spoonful = DATA_BUFSIZE;
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename); QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
#ifdef HAVE_CFITSIO
tab->currentElement = 1;
#endif
read_body(tab, buffer, spoonful/sizeof(PIXTYPE)); read_body(tab, buffer, spoonful/sizeof(PIXTYPE));
/*-- Apply pixel processing */ /*-- Apply pixel processing */
if (func) if (func)
...@@ -159,7 +173,7 @@ INPUT Table (tab) structure. ...@@ -159,7 +173,7 @@ INPUT Table (tab) structure.
OUTPUT Pointer to the mapped data if OK, or NULL otherwise. OUTPUT Pointer to the mapped data if OK, or NULL otherwise.
NOTES The file pointer must be positioned at the beginning of the data. NOTES The file pointer must be positioned at the beginning of the data.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 30/01/2012 VERSION 02/10/2017
***/ ***/
FLAGTYPE *alloc_ibody(tabstruct *tab, FLAGTYPE *alloc_ibody(tabstruct *tab,
void (*func)(FLAGTYPE *ptr, int npix)) void (*func)(FLAGTYPE *ptr, int npix))
...@@ -193,6 +207,9 @@ FLAGTYPE *alloc_ibody(tabstruct *tab, ...@@ -193,6 +207,9 @@ FLAGTYPE *alloc_ibody(tabstruct *tab,
if ((tab->bodybuf = malloc(size))) if ((tab->bodybuf = malloc(size)))
{ {
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename); QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
#ifdef HAVE_CFITSIO
tab->currentElement = 1;
#endif
read_ibody(tab, (FLAGTYPE *)tab->bodybuf, npix); read_ibody(tab, (FLAGTYPE *)tab->bodybuf, npix);
/*---- Apply pixel processing */ /*---- Apply pixel processing */
if (func) if (func)
...@@ -220,6 +237,9 @@ FLAGTYPE *alloc_ibody(tabstruct *tab, ...@@ -220,6 +237,9 @@ FLAGTYPE *alloc_ibody(tabstruct *tab,
if (!spoonful) if (!spoonful)
spoonful = DATA_BUFSIZE; spoonful = DATA_BUFSIZE;
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename); QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
#ifdef HAVE_CFITSIO
tab->currentElement = 1;
#endif
read_ibody(tab, buffer, spoonful/sizeof(FLAGTYPE)); read_ibody(tab, buffer, spoonful/sizeof(FLAGTYPE));
/*-- Apply pixel processing */ /*-- Apply pixel processing */
if (func) if (func)
...@@ -294,6 +314,77 @@ void free_body(tabstruct *tab) ...@@ -294,6 +314,77 @@ void free_body(tabstruct *tab)
return; return;
} }
#ifdef HAVE_CFITSIO
/******* readTileCompressed ***************************************************
*
* Function to read a chunk of a tile-compressed FITS image
*
***/
void readTileCompressed(tabstruct *tab, size_t spoonful, void *bufdata0) {
int status, hdutype;
// first of all, move to correct HDU
status = 0;
fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status);
if (status != 0) {
printf("Error moving to HDU %d\n", tab->hdunum);
fits_report_error(stderr, status);
}
// pixels count from 1
if (!tab->currentElement)
tab->currentElement = 1;
// now read section of image
int datatype;
switch(tab->bitpix){
case BYTE_IMG:
datatype = TBYTE;
break;
case SHORT_IMG:
datatype = TSHORT;
break;
case LONG_IMG:
datatype = TLONG;
break;
case FLOAT_IMG:
datatype = TFLOAT;
break;
case DOUBLE_IMG:
datatype = TDOUBLE;
break;
default:
datatype = TFLOAT;
break;
}
int anynul;
double bscale = 1.0, bzero = 0.0, nulval = 0.;
// turn off any scaling so that we copy raw pixel values
status = 0;
fits_set_bscale(tab->infptr, bscale, bzero, &status);
// now read the image
status = 0;
fits_read_img(tab->infptr, datatype, tab->currentElement, spoonful, &nulval,
bufdata0, &anynul, &status);
// report reading error
if (status) {
printf("CFITSIO ERROR reading start=%d end=%d absolute end=%d\n",
tab->currentElement,
(tab->currentElement + spoonful),
(tab->naxisn[0]*tab->naxisn[1]));
fits_report_error(stderr, status);
}
// update file 'pointer'
tab->currentElement += spoonful;
}
#endif // HAVE_CFITSIO
/******* read_body ************************************************************ /******* read_body ************************************************************
PROTO read_body(tabstruct *tab, PIXTYPE *ptr, long size) PROTO read_body(tabstruct *tab, PIXTYPE *ptr, long size)
...@@ -304,7 +395,7 @@ INPUT A pointer to the tab structure, ...@@ -304,7 +395,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 11/02/2020 VERSION 26/08/2020
***/ ***/
void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
...@@ -323,15 +414,15 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -323,15 +414,15 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
int curval, dval, blankflag, bswapflag, ival, iblank; int curval, dval, blankflag, bswapflag, ival, iblank;
size_t i, bowl, spoonful, npix; size_t i, bowl, spoonful, npix;
PIXTYPE bs,bz; double bs,bz;
/* a NULL cat structure indicates that no data can be read */ /* a NULL cat structure indicates that no data can be read */
if (!(cat = tab->cat)) if (!(cat = tab->cat))
return; return;
bs = (PIXTYPE)tab->bscale; bs = tab->bscale;
bz = (PIXTYPE)tab->bzero; bz = tab->bzero;
blankflag = tab->blankflag; blankflag = tab->blankflag;
bswapflag = *((char *)&ashort); // Byte-swapping flag bswapflag = *((char *)&ashort); // Byte-swapping flag
...@@ -346,7 +437,15 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -346,7 +437,15 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
if (spoonful>size) if (spoonful>size)
spoonful = size; spoonful = size;
bufdata = (char *)bufdata0; bufdata = (char *)bufdata0;
#ifdef HAVE_CFITSIO
if (tab->isTileCompressed)
readTileCompressed(tab, spoonful, (void *)bufdata0);
else
QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename);
#else
QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename);
#endif // HAVE_CFITSIO
switch(tab->bitpix) switch(tab->bitpix)
{ {
case BP_BYTE: case BP_BYTE:
...@@ -383,7 +482,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -383,7 +482,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
break; break;
case BP_SHORT: case BP_SHORT:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 2, spoonful); swapbytes(bufdata, 2, spoonful);
if (blankflag) if (blankflag)
{ {
...@@ -418,7 +521,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -418,7 +521,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
break; break;
case BP_LONG: case BP_LONG:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 4, spoonful); swapbytes(bufdata, 4, spoonful);
if (blankflag) if (blankflag)
{ {
...@@ -454,7 +561,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -454,7 +561,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
case BP_LONGLONG: case BP_LONGLONG:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 8, spoonful); swapbytes(bufdata, 8, spoonful);
if (blankflag) if (blankflag)
{ {
...@@ -489,7 +600,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -489,7 +600,11 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
break; break;
#endif #endif
case BP_FLOAT: case BP_FLOAT:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 4, spoonful); swapbytes(bufdata, 4, spoonful);
#pragma ivdep #pragma ivdep
for (i=spoonful; i--; bufdata += sizeof(float)) for (i=spoonful; i--; bufdata += sizeof(float))
...@@ -499,7 +614,12 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -499,7 +614,12 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
case BP_DOUBLE: case BP_DOUBLE:
if (bswapflag) if (bswapflag)
{ {
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed)
swapbytes(bufdata, 8, spoonful);
#else
swapbytes(bufdata, 8, spoonful); swapbytes(bufdata, 8, spoonful);
#endif
#pragma ivdep #pragma ivdep
for (i=spoonful; i--; bufdata += sizeof(double)) for (i=spoonful; i--; bufdata += sizeof(double))
*(ptr++) = ((0x7ff00000 & *(unsigned int *)(bufdata+4)) *(ptr++) = ((0x7ff00000 & *(unsigned int *)(bufdata+4))
...@@ -632,7 +752,7 @@ INPUT A pointer to the tab structure, ...@@ -632,7 +752,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 11/02/2020 VERSION 26/08/2020
***/ ***/
void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
{ {
...@@ -660,7 +780,15 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -660,7 +780,15 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
if (spoonful>size) if (spoonful>size)
spoonful = size; spoonful = size;
bufdata = (char *)bufdata0; bufdata = (char *)bufdata0;
#ifdef HAVE_CFITSIO
if (tab->isTileCompressed)
readTileCompressed(tab, spoonful, (void *)bufdata0);
else
QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename);
#else
QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename); QFREAD(bufdata, spoonful*tab->bytepix, cat->file, cat->filename);
#endif
switch(tab->bitpix) switch(tab->bitpix)
{ {
case BP_BYTE: case BP_BYTE:
...@@ -670,7 +798,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -670,7 +798,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
break; break;
case BP_SHORT: case BP_SHORT:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 2, spoonful); swapbytes(bufdata, 2, spoonful);
#pragma ivdep #pragma ivdep
for (i=spoonful; i--; bufdata += sizeof(unsigned short)) for (i=spoonful; i--; bufdata += sizeof(unsigned short))
...@@ -678,7 +810,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -678,7 +810,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
break; break;
case BP_LONG: case BP_LONG:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 4, spoonful); swapbytes(bufdata, 4, spoonful);
#pragma ivdep #pragma ivdep
for (i=spoonful; i--; bufdata += sizeof(unsigned int)) for (i=spoonful; i--; bufdata += sizeof(unsigned int))
...@@ -687,7 +823,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -687,7 +823,11 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
case BP_LONGLONG: case BP_LONGLONG:
#ifdef HAVE_CFITSIO
if (!tab->isTileCompressed && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(bufdata, 8, spoonful); swapbytes(bufdata, 8, spoonful);
#pragma ivdep #pragma ivdep
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG)) for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
...@@ -815,7 +955,7 @@ INPUT A pointer to the tab structure, ...@@ -815,7 +955,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 11/02/2020 VERSION 26/08/2020
***/ ***/
void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
...@@ -931,7 +1071,12 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -931,7 +1071,12 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
#pragma ivdep #pragma ivdep
for (i=spoonful; i--;) for (i=spoonful; i--;)
*(bufdata++) = (*(ptr++)-bz)/bs; *(bufdata++) = (*(ptr++)-bz)/bs;
#ifdef HAVE_CFITSIO
if (!tab->infptr && bswapflag)
#else
if (bswapflag) if (bswapflag)
#endif
swapbytes(cbufdata0, 4, spoonful); swapbytes(cbufdata0, 4, spoonful);
} }
break; break;
...@@ -952,7 +1097,61 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -952,7 +1097,61 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
"read_body()"); "read_body()");
break; break;
} }
#ifdef HAVE_CFITSIO
// if cfitsio output file has been set up, then proceed to write
if (tab->infptr) {
// now read section of image
int datatype;
switch(tab->bitpix) {
case BYTE_IMG:
datatype = TBYTE;
break;
case SHORT_IMG:
datatype = TSHORT;
break;
case LONG_IMG:
datatype = TLONG;
break;
case FLOAT_IMG:
datatype = TFLOAT;
break;
case DOUBLE_IMG:
datatype = TDOUBLE;
break;
default:
datatype = TFLOAT;
break;
}
// turn off any scaling so that we copy the raw pixel values
double *array,
bscale = 1.0,
bzero = 0.0,
nulval = 0.0;
int status = 0;
fits_set_bscale(tab->infptr, bscale, bzero, &status);
status = 0;
fits_write_img(tab->infptr, datatype, tab->currentElement, spoonful,
cbufdata0, &status);
if (status) {
printf("CFITSIO ERROR writing start=%d end=%d absolute end=%d\n",
tab->currentElement, (tab->currentElement + spoonful),
(tab->naxisn[0]*tab->naxisn[1]));
fits_report_error(stderr, status);
}
tab->currentElement = tab->currentElement + spoonful;
} else
// otherwise, continue with usual AstrOmatic fits writing routine
QFWRITE(cbufdata0, spoonful*tab->bytepix, cat->file, cat->filename);
#else
QFWRITE(cbufdata0, spoonful*tab->bytepix, cat->file, cat->filename); QFWRITE(cbufdata0, spoonful*tab->bytepix, cat->file, cat->filename);
#endif // HAVE_CFITSIO
} }
break; break;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* along with AstrOmatic software. * along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
* *
* Last modified: 15/07/2020 * Last modified: 26/08/2020
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -167,6 +167,33 @@ int close_cat(catstruct *cat) ...@@ -167,6 +167,33 @@ int close_cat(catstruct *cat)
return RETURN_OK; return RETURN_OK;
} }
#ifdef HAVE_CFITSIO
/****** close_cfitsio **************************************************************
Closes a file previously opened by cfitsio
***/
int close_cfitsio(fitsfile *infptr)
{
if (infptr != NULL) {
int status = 0; fits_close_file(infptr, &status);
if (status != 0) {
fits_report_error(stderr, status);
printf("ERROR could not close FITS file with cfitsio\n");
}
else {
//printf("Successfully closed FITS file with cfitsio\n");
infptr == NULL;
}
}
else {
//printf("ERROR no cfitsio file to close\n");
}
}
#endif // HAVE_CFITSIO
/****** free_cat *************************************************************** /****** free_cat ***************************************************************
PROTO void free_cat(catstruct **cat, int ncat) PROTO void free_cat(catstruct **cat, int ncat)
...@@ -325,14 +352,55 @@ int map_cat(catstruct *cat) ...@@ -325,14 +352,55 @@ int map_cat(catstruct *cat)
QCALLOC(tab, tabstruct, 1); QCALLOC(tab, tabstruct, 1);
tab->cat = cat; tab->cat = cat;
QFTELL(cat->file, tab->headpos, cat->filename); QFTELL(cat->file, tab->headpos, cat->filename);
#ifdef HAVE_CFITSIO
fitsfile *infptr;
int status, hdutype, hdunum;
status = 0; fits_open_file(&infptr, cat->filename, READONLY, &status);
if (status != 0) {
fits_report_error(stderr, status);
printf("ERROR could not open FITS file with cfitsio: %s\n", cat->filename);
}
hdunum = 1;
int any_tile_compressed = 0;
#endif // HAVE_CFITSIO
for (ntab=0; !get_head(tab); ntab++) for (ntab=0; !get_head(tab); ntab++)
{ {
readbasic_head(tab); readbasic_head(tab);
readbintabparam_head(tab); readbintabparam_head(tab);
QFTELL(cat->file, tab->bodypos, cat->filename); QFTELL(cat->file, tab->bodypos, cat->filename);
tab->nseg = tab->seg = 1; tab->nseg = tab->seg = 1;
#ifdef HAVE_CFITSIO
if (tab->isTileCompressed) {
any_tile_compressed = 1;
tab->hdunum = hdunum;
tab->infptr = infptr;
status = 0; fits_movabs_hdu(tab->infptr, tab->hdunum, &hdutype, &status);
if (status != 0) printf("ERROR could not move to hdu %d in file %s\n", tab->hdunum, cat->filename);
if (tab->tabsize)
fseek(cat->file, infptr->Fptr->headstart[hdunum], SEEK_SET);
}
// NOT tile-compressed
else {
tab->infptr = NULL;
if (tab->tabsize)
QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename);
}
hdunum++;
#else
if (tab->tabsize) if (tab->tabsize)
QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename); QFSEEK(cat->file, PADTOTAL(tab->tabsize), SEEK_CUR, cat->filename);
#endif // HAVE_CFITSIO
if (prevtab) if (prevtab)
{ {
tab->prevtab = prevtab; tab->prevtab = prevtab;
...@@ -346,6 +414,12 @@ int map_cat(catstruct *cat) ...@@ -346,6 +414,12 @@ int map_cat(catstruct *cat)
QFTELL(cat->file, tab->headpos, cat->filename); QFTELL(cat->file, tab->headpos, cat->filename);
} }
#ifdef HAVE_CFITSIO
// we will not need CFitsIO, so close CFitsIO file pointer now
if (!any_tile_compressed)
close_cfitsio(infptr);
#endif
cat->ntab = ntab; cat->ntab = ntab;
free(tab); free(tab);
if (prevtab) if (prevtab)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* along with AstrOmatic software. * along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
* *
* Last modified: 11/02/2020 * Last modified: 26/08/2020
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_CFITSIO
#include CFITSIO_H
#endif
#define MAXCHARS 256 /* max. number of characters */ #define MAXCHARS 256 /* max. number of characters */
#define WARNING_NMAX 1000 /* max. number of recorded warnings */ #define WARNING_NMAX 1000 /* max. number of recorded warnings */
...@@ -107,10 +111,11 @@ typedef long long SLONGLONG; ...@@ -107,10 +111,11 @@ typedef long long SLONGLONG;
typedef union {int l[2];} SLONGLONG; typedef union {int l[2];} SLONGLONG;
#endif #endif
#if defined(_FILE_OFFSET_BITS) && !defined(OFF_T) // CFITSIO changed OFF_T to OFF_T2 due to clash with cfitsio lib
#define OFF_T off_t #if defined(_FILE_OFFSET_BITS) && !defined(OFF_T2)
#define OFF_T2 off_t
#else #else
#define OFF_T long #define OFF_T2 long
#endif #endif
/*------------------------------- constants ---------------------------------*/ /*------------------------------- constants ---------------------------------*/
...@@ -180,8 +185,8 @@ typedef struct structtab ...@@ -180,8 +185,8 @@ typedef struct structtab
char *headbuf; /* buffer containing the header */ char *headbuf; /* buffer containing the header */
int headnblock; /* number of FITS blocks */ int headnblock; /* number of FITS blocks */
char *bodybuf; /* buffer containing the body */ char *bodybuf; /* buffer containing the body */
OFF_T bodypos; /* position of the body in the file */ OFF_T2 bodypos; /* position of the body in the file */
OFF_T headpos; /* position of the head in the file */ OFF_T2 headpos; /* position of the head in the file */
struct structcat *cat; /* (original) parent catalog */ struct structcat *cat; /* (original) parent catalog */
struct structtab *prevtab, *nexttab; /* previous and next tab in chain */ struct structtab *prevtab, *nexttab; /* previous and next tab in chain */
int seg; /* segment position */ int seg; /* segment position */
...@@ -191,6 +196,12 @@ typedef struct structtab ...@@ -191,6 +196,12 @@ typedef struct structtab
int swapflag; /* mapped to a swap file ? */ int swapflag; /* mapped to a swap file ? */
char swapname[MAXCHARS]; /* name of the swapfile */ char swapname[MAXCHARS]; /* name of the swapfile */
unsigned int bodysum; /* Checksum of the FITS body */ unsigned int bodysum; /* Checksum of the FITS body */
#ifdef HAVE_CFITSIO
fitsfile *infptr; /* a cfitsio pointer to the file */
int hdunum; /* FITS HDU number for this 'table' */
int isTileCompressed; /* is this a tile compressed image? */
long currentElement; /* tracks the current image pixel */
#endif
} tabstruct; } tabstruct;
...@@ -218,8 +229,8 @@ extern void add_cleanupfilename(char *filename), ...@@ -218,8 +229,8 @@ extern void add_cleanupfilename(char *filename),
encode_checksum(unsigned int sum, char *str), encode_checksum(unsigned int sum, char *str),
end_readobj(tabstruct *keytab, tabstruct *tab, char *buf), end_readobj(tabstruct *keytab, tabstruct *tab, char *buf),
end_writeobj(catstruct *cat, tabstruct *tab, char *buf), end_writeobj(catstruct *cat, tabstruct *tab, char *buf),
error(int, char *, char *), error(int code, const char *msg1, const char *msg2),
error_installfunc(void (*func)(char *msg1, char *msg2)), error_installfunc(void (*func)(const char *msg1, const char *msg2)),
fixexponent(char *s), fixexponent(char *s),
free_body(tabstruct *tab), free_body(tabstruct *tab),
free_cat(catstruct **cat, int ncat), free_cat(catstruct **cat, int ncat),
...@@ -271,6 +282,9 @@ extern int about_cat(catstruct *cat, FILE *stream), ...@@ -271,6 +282,9 @@ extern int about_cat(catstruct *cat, FILE *stream),
add_tab(tabstruct *tab, catstruct *cat, int pos), add_tab(tabstruct *tab, catstruct *cat, int pos),
blank_keys(tabstruct *tab), blank_keys(tabstruct *tab),
close_cat(catstruct *cat), close_cat(catstruct *cat),
#ifdef HAVE_CFITSIO
close_cfitsio(fitsfile *infptr),
#endif
copy_key(tabstruct *tabin, char *keyname, tabstruct *tabout, copy_key(tabstruct *tabin, char *keyname, tabstruct *tabout,
int pos), int pos),
copy_tab(catstruct *catin, char *tabname, int seg, copy_tab(catstruct *catin, char *tabname, int seg,
...@@ -328,8 +342,4 @@ extern FLAGTYPE *alloc_ibody(tabstruct *tab, ...@@ -328,8 +342,4 @@ extern FLAGTYPE *alloc_ibody(tabstruct *tab,
extern t_type ttypeof(char *str); extern t_type ttypeof(char *str);
extern void error(int, char *, char *),
swapbytes(void *ptr, int nb, int n),
warning(char *msg1, char *msg2);
#endif #endif
...@@ -101,29 +101,38 @@ INPUT pointer to catstruct. ...@@ -101,29 +101,38 @@ INPUT pointer to catstruct.
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 03/06/2012 VERSION 04/12/2019
***/ ***/
void readbasic_head(tabstruct *tab) void readbasic_head(tabstruct *tab)
{ {
char str[88]; char str[88];
char key[12], name[16], char key[12], name[16], bitpix_key[16], naxis_key[16],
*filename; *filename;
int i; int i;
KINGSIZE_T tabsize; KINGSIZE_T tabsize;
filename = (tab->cat? tab->cat->filename : strcpy(name, "internal header")); filename = (tab->cat? tab->cat->filename : strcpy(name, "internal header"));
strncpy(bitpix_key, "BITPIX ", 9);
if (fitsread(tab->headbuf, "BITPIX ", &tab->bitpix, H_INT, T_LONG) strncpy(naxis_key, "NAXIS ", 9);
#ifdef HAVE_CFITSIO
tab->isTileCompressed = (fitsread(tab->headbuf, "ZIMAGE ",
str, H_STRING, T_STRING) == RETURN_OK)? 1 : 0;
if (tab->isTileCompressed) {
strncpy(bitpix_key, "ZBITPIX ", 9);
strncpy(naxis_key, "ZNAXIS ", 9);
}
#endif
if (fitsread(tab->headbuf, bitpix_key, &tab->bitpix, H_INT, T_LONG)
==RETURN_ERROR) ==RETURN_ERROR)
error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename); error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename);
tab->bytepix = tab->bitpix>0?(tab->bitpix/8):(-tab->bitpix/8); if (fitsread(tab->headbuf, naxis_key, &tab->naxis, H_INT, T_LONG)
if (fitsread(tab->headbuf, "NAXIS ", &tab->naxis, H_INT, T_LONG)
==RETURN_ERROR) ==RETURN_ERROR)
error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename); error(EXIT_FAILURE, "*Error*: Corrupted FITS header in ", filename);
tab->bytepix = tab->bitpix>0?(tab->bitpix/8):(-tab->bitpix/8);
tabsize = 0; tabsize = 0;
if (tab->naxis>0) if (tab->naxis>0)
{ {
...@@ -133,6 +142,11 @@ void readbasic_head(tabstruct *tab) ...@@ -133,6 +142,11 @@ void readbasic_head(tabstruct *tab)
tabsize = 1; tabsize = 1;
for (i=0; i<tab->naxis && i<999; i++) for (i=0; i<tab->naxis && i<999; i++)
{ {
#ifdef HAVE_CFITSIO
if (tab->isTileCompressed)
sprintf(key,"ZNAXIS%-2d", i+1);
else
#endif
sprintf(key,"NAXIS%-3d", i+1); sprintf(key,"NAXIS%-3d", i+1);
if (fitsread(tab->headbuf, key, &tab->naxisn[i], H_INT, T_LONG) if (fitsread(tab->headbuf, key, &tab->naxisn[i], H_INT, T_LONG)
==RETURN_ERROR) ==RETURN_ERROR)
...@@ -144,6 +158,13 @@ void readbasic_head(tabstruct *tab) ...@@ -144,6 +158,13 @@ void readbasic_head(tabstruct *tab)
/*random groups parameters (optional)*/ /*random groups parameters (optional)*/
tab->pcount = 0; tab->pcount = 0;
fitsread(tab->headbuf, "PCOUNT ", &tab->pcount, H_INT, T_LONG); fitsread(tab->headbuf, "PCOUNT ", &tab->pcount, H_INT, T_LONG);
#ifdef HAVE_CFITSIO
// CFITSIO TODO HACK
if (tab->isTileCompressed)
tab->pcount = 0;
#endif
tab->gcount = 1; tab->gcount = 1;
fitsread(tab->headbuf, "GCOUNT ", &tab->gcount, H_INT, T_LONG); fitsread(tab->headbuf, "GCOUNT ", &tab->gcount, H_INT, T_LONG);
...@@ -284,7 +305,12 @@ int readbintabparam_head(tabstruct *tab) ...@@ -284,7 +305,12 @@ int readbintabparam_head(tabstruct *tab)
key->htype = H_STRING; key->htype = H_STRING;
break; break;
default: default:
#ifdef HAVE_CFITSIO
// CFITSIO TODO dodgy
key->ttype = T_FLOAT;
#else
error(EXIT_FAILURE, "*Error*: Unknown TFORM in ", cat->filename); error(EXIT_FAILURE, "*Error*: Unknown TFORM in ", cat->filename);
#endif
} }
/*--handle the special case of multimensional arrays*/ /*--handle the special case of multimensional arrays*/
......
...@@ -991,7 +991,7 @@ void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys, ...@@ -991,7 +991,7 @@ void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys,
if (kflag) if (kflag)
free(keys); free(keys);
if (o_type == SHOW_SKYCAT) if (o_type == SHOW_SKYCAT)
fprintf(stream, skycattail, 1.0); fprintf(stream, "%s", skycattail);
return; return;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment