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

Updated WCS library: fixed issue with TPV CTYPEs and added support for MJDSTART header keyword.

Updated FITS library to the latest version, removing potential conflicts with the CFITSIO library.
Added PSF/model-fitting support for MEFs.
Pushed version number to 2.17.0
parent 4b47f9f1
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for sextractor 2.16.3. # Generated by GNU Autoconf 2.68 for sextractor 2.17.0.
# #
# Report bugs to <bertin@iap.fr>. # Report bugs to <bertin@iap.fr>.
# #
...@@ -714,8 +714,8 @@ MAKEFLAGS= ...@@ -714,8 +714,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sextractor' PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor' PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.16.3' PACKAGE_VERSION='2.17.0'
PACKAGE_STRING='sextractor 2.16.3' PACKAGE_STRING='sextractor 2.17.0'
PACKAGE_BUGREPORT='bertin@iap.fr' PACKAGE_BUGREPORT='bertin@iap.fr'
PACKAGE_URL='' PACKAGE_URL=''
   
...@@ -1465,7 +1465,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1465,7 +1465,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sextractor 2.16.3 to adapt to many kinds of systems. \`configure' configures sextractor 2.17.0 to adapt to many kinds of systems.
   
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
   
...@@ -1535,7 +1535,7 @@ fi ...@@ -1535,7 +1535,7 @@ fi
   
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.16.3:";; short | recursive ) echo "Configuration of sextractor 2.17.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
   
...@@ -1668,7 +1668,7 @@ fi ...@@ -1668,7 +1668,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sextractor configure 2.16.3 sextractor configure 2.17.0
generated by GNU Autoconf 2.68 generated by GNU Autoconf 2.68
   
Copyright (C) 2010 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
...@@ -2296,7 +2296,7 @@ cat >config.log <<_ACEOF ...@@ -2296,7 +2296,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
   
It was created by sextractor $as_me 2.16.3, which was It was created by sextractor $as_me 2.17.0, which was
generated by GNU Autoconf 2.68. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
   
$ $0 $@ $ $0 $@
...@@ -2972,7 +2972,7 @@ fi ...@@ -2972,7 +2972,7 @@ fi
   
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sextractor' PACKAGE='sextractor'
VERSION='2.16.3' VERSION='2.17.0'
   
   
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -23325,7 +23325,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ...@@ -23325,7 +23325,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sextractor $as_me 2.16.3, which was This file was extended by sextractor $as_me 2.17.0, which was
generated by GNU Autoconf 2.68. Invocation command line was generated by GNU Autoconf 2.68. Invocation command line was
   
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -23391,7 +23391,7 @@ _ACEOF ...@@ -23391,7 +23391,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
sextractor config.status 2.16.3 sextractor config.status 2.17.0
configured by $0, generated by GNU Autoconf 2.68, configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"
   
......
...@@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],) ...@@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],) define([AC_CACHE_SAVE],)
# This is your standard Bertin source code... # This is your standard Bertin source code...
AC_INIT(sextractor, 2.16.3, [bertin@iap.fr]) AC_INIT(sextractor, 2.17.0, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c) AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
......
.TH SEXTRACTOR "1" "June 2012" "SExtractor 2.16.3" "User Commands" .TH SEXTRACTOR "1" "June 2012" "SExtractor 2.17.0" "User Commands"
.SH NAME .SH NAME
sex \- extract a source catalogue from an astronomical FITS image sex \- extract a source catalogue from an astronomical FITS image
.SH SYNOPSIS .SH SYNOPSIS
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1993-2010 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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/10/2010 * Last modified: 26/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -70,17 +70,11 @@ picstruct *newfield(char *filename, int flags, int nok) ...@@ -70,17 +70,11 @@ picstruct *newfield(char *filename, int flags, int nok)
field->flags = flags; field->flags = flags;
field->cat = cat; field->cat = cat;
tab = cat->tab; tab = cat->tab;
nok++; /* At least one pass through the loop */
nok2 = nok; nok2 = nok;
for (ntab=cat->ntab; nok && ntab--; tab=tab->nexttab) for (ntab=cat->ntab; nok-- && ntab--;)
{ tab=tab->nexttab;
if ((tab->naxis < 2)
|| !strncmp(tab->xtension, "BINTABLE", 8)
|| !strncmp(tab->xtension, "ASCTABLE", 8))
continue;
field->tab = tab; field->tab = tab;
nok--;
}
if (ntab<0) if (ntab<0)
error(EXIT_FAILURE, "Not enough valid FITS image extensions in ",filename); error(EXIT_FAILURE, "Not enough valid FITS image extensions in ",filename);
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 09/10/2010 * Last modified: 16/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -150,6 +150,106 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix)) ...@@ -150,6 +150,106 @@ PIXTYPE *alloc_body(tabstruct *tab, void (*func)(PIXTYPE *ptr, int npix))
} }
/******* alloc_ibody ***********************************************************
PROTO FLAGTYPE *alloc_ibody(tabstruct *tab,
void (*func)(FLAGTYPE *ptr, int npix))
PURPOSE Allocate memory for and read a FITS integer data body (read-only).
If not enough RAM is available, a swap file is created.
INPUT Table (tab) structure.
OUTPUT Pointer to the mapped data if OK, or NULL otherwise.
NOTES The file pointer must be positioned at the beginning of the data.
AUTHOR E. Bertin (IAP)
VERSION 30/01/2012
***/
FLAGTYPE *alloc_ibody(tabstruct *tab,
void (*func)(FLAGTYPE *ptr, int npix))
{
FILE *file;
FLAGTYPE *buffer;
size_t npix, size, sizeleft, spoonful;
if (!body_ramflag)
{
body_ramleft = body_maxram;
body_vramleft = body_maxvram;
body_ramflag = 1;
}
/* Return a NULL pointer if size is zero */
if (!tab->tabsize)
return (FLAGTYPE *)NULL;
/* Check that there is a cat parent structure and that the file is open */
if (tab->cat && !tab->cat->file)
error(EXIT_FAILURE, "*Internal Error*: Cannot access table: ",
tab->extname);
/* Decide if the data will go in physical memory or on swap-space */
npix = tab->tabsize/tab->bytepix;
size = npix*sizeof(FLAGTYPE);
if (size < body_ramleft)
{
/*-- There should be enough RAM left: try to do a malloc() */
if ((tab->bodybuf = malloc(size)))
{
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
read_ibody(tab, (FLAGTYPE *)tab->bodybuf, npix);
/*---- Apply pixel processing */
if (func)
(*func)((FLAGTYPE *)tab->bodybuf, npix);
body_ramleft -= size;
return (FLAGTYPE *)tab->bodybuf;
}
else
tab->bodybuf = NULL;
}
if (size < body_vramleft)
{
/*-- Convert and copy the data to a swap file, and mmap() it */
if (!(buffer = malloc(DATA_BUFSIZE)))
return NULL;
sprintf(tab->swapname, "%s/vm%05ld_%05x.tmp",
body_swapdirname, (long)getpid(),
(unsigned int)++body_vmnumber) ;
if (!(file=fopen(tab->swapname, "wb+")))
error(EXIT_FAILURE, "*Error*: cannot create swap-file ", tab->swapname);
add_cleanupfilename(tab->swapname);
spoonful = (size%DATA_BUFSIZE);
if (!spoonful)
spoonful = DATA_BUFSIZE;
QFSEEK(tab->cat->file, tab->bodypos, SEEK_SET, tab->cat->filename);
read_ibody(tab, buffer, spoonful/sizeof(FLAGTYPE));
/*-- Apply pixel processing */
if (func)
(*func)(buffer, spoonful/sizeof(FLAGTYPE));
QFWRITE(buffer, spoonful, file, tab->swapname);
for (sizeleft = size; sizeleft -= spoonful;)
{
read_ibody(tab, buffer, (spoonful=DATA_BUFSIZE)/sizeof(FLAGTYPE));
/*--- Apply pixel processing */
if (func)
(*func)(buffer, spoonful/sizeof(FLAGTYPE));
QFWRITE(buffer, spoonful, file, tab->swapname);
}
free(buffer);
tab->bodybuf = mmap(NULL,size,PROT_READ,MAP_SHARED,fileno(file),(off_t)0);
fclose(file);
tab->swapflag = 1;
body_vramleft -= size;
/*-- Memory mapping problem */
if (tab->bodybuf == (void *)-1)
return NULL;
return (FLAGTYPE *)tab->bodybuf;
}
/* If no memory left at all: forget it! */
return NULL;
}
/******* free_body ************************************************************ /******* free_body ************************************************************
PROTO void free_body(tabstruct *tab) PROTO void free_body(tabstruct *tab)
PURPOSE Free FITS body data. PURPOSE Free FITS body data.
...@@ -204,7 +304,7 @@ INPUT A pointer to the tab structure, ...@@ -204,7 +304,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 24/08/2010 VERSION 13/06/2012
***/ ***/
void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
...@@ -217,7 +317,7 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -217,7 +317,7 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
short val16, sval, sblank; short val16, sval, sblank;
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
ULONGLONG lluval, llublank; ULONGLONG lluval, llublank;
LONGLONG llval, llblank; SLONGLONG llval, llblank;
#endif #endif
unsigned int iuval, iublank; unsigned int iuval, iublank;
int curval, dval, blankflag, ival, iblank; int curval, dval, blankflag, ival, iblank;
...@@ -346,9 +446,9 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -346,9 +446,9 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
if (tab->bitsgn) if (tab->bitsgn)
{ {
llblank = (LONGLONG)tab->blank; llblank = (SLONGLONG)tab->blank;
for (i=spoonful; i--; bufdata += sizeof(LONGLONG)) for (i=spoonful; i--; bufdata += sizeof(SLONGLONG))
*(ptr++) = ((llval = *((LONGLONG *)bufdata)) == llblank)? *(ptr++) = ((llval = *((SLONGLONG *)bufdata)) == llblank)?
-BIG : llval*bs + bz; -BIG : llval*bs + bz;
} }
else else
...@@ -362,8 +462,8 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -362,8 +462,8 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
else else
{ {
if (tab->bitsgn) if (tab->bitsgn)
for (i=spoonful; i--; bufdata += sizeof(LONGLONG)) for (i=spoonful; i--; bufdata += sizeof(SLONGLONG))
*(ptr++) = *((LONGLONG *)bufdata)*bs + bz; *(ptr++) = *((SLONGLONG *)bufdata)*bs + bz;
else else
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG)) for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
*(ptr++) = *((ULONGLONG *)bufdata)*bs + bz; *(ptr++) = *((ULONGLONG *)bufdata)*bs + bz;
...@@ -511,7 +611,7 @@ INPUT A pointer to the tab structure, ...@@ -511,7 +611,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 02/11/2009 VERSION 01/02/2012
***/ ***/
void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
{ {
...@@ -554,8 +654,8 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -554,8 +654,8 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
case BP_LONG: case BP_LONG:
if (bswapflag) if (bswapflag)
swapbytes(bufdata, 4, spoonful); swapbytes(bufdata, 4, spoonful);
for (i=spoonful; i--; bufdata += sizeof(unsigned long)) for (i=spoonful; i--; bufdata += sizeof(unsigned int))
*(ptr++) = (FLAGTYPE)*((unsigned long *)bufdata); *(ptr++) = (FLAGTYPE)*((unsigned int *)bufdata);
break; break;
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
...@@ -568,7 +668,7 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -568,7 +668,7 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
#endif #endif
case BP_FLOAT: case BP_FLOAT:
case BP_DOUBLE: case BP_DOUBLE:
error(EXIT_FAILURE,"*Error*: I was expecting integers in ", error(EXIT_FAILURE,"*Error*: expected integers, not floats, in ",
cat->filename); cat->filename);
break; break;
default: default:
...@@ -687,7 +787,7 @@ INPUT A pointer to the tab structure, ...@@ -687,7 +787,7 @@ INPUT A pointer to the tab structure,
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
...@@ -729,7 +829,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -729,7 +829,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{ {
unsigned char *bufdata = (unsigned char *)cbufdata0; unsigned char *bufdata = (unsigned char *)cbufdata0;
for (i=spoonful; i--;) for (i=spoonful; i--;)
*(bufdata++) = (unsigned char)((*(ptr++)-bz)/bs+0.49999); *(bufdata++) = (unsigned char)((*(ptr++)-bz)/bs+0.49999);;
} }
break; break;
...@@ -771,9 +871,9 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size) ...@@ -771,9 +871,9 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
case BP_LONGLONG: case BP_LONGLONG:
if (tab->bitsgn) if (tab->bitsgn)
{ {
LONGLONG *bufdata = (LONGLONG *)cbufdata0; SLONGLONG *bufdata = (SLONGLONG *)cbufdata0;
for (i=spoonful; i--;) for (i=spoonful; i--;)
*(bufdata++) = (LONGLONG)((*(ptr++)-bz)/bs+0.49999); *(bufdata++) = (SLONGLONG)((*(ptr++)-bz)/bs+0.49999);
} }
else else
{ {
...@@ -923,9 +1023,9 @@ void write_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size) ...@@ -923,9 +1023,9 @@ void write_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
case BP_LONGLONG: case BP_LONGLONG:
if (tab->bitsgn) if (tab->bitsgn)
{ {
LONGLONG *bufdata = (LONGLONG *)cbufdata0; SLONGLONG *bufdata = (SLONGLONG *)cbufdata0;
for (i=spoonful; i--;) for (i=spoonful; i--;)
*(bufdata++) = (LONGLONG)*(ptr++); *(bufdata++) = (SLONGLONG)*(ptr++);
} }
else else
{ {
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* License: GNU General Public License * License: GNU General Public License
* *
...@@ -23,13 +23,15 @@ ...@@ -23,13 +23,15 @@
* 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: 02/12/2010 * Last modified: 16/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef _FITSCAT_H_ #ifndef _FITSCAT_H_
#define _FITSCAT_H_ #define _FITSCAT_H_
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
...@@ -100,17 +102,15 @@ typedef size_t KINGSIZE_T;/* better than nothing */ ...@@ -100,17 +102,15 @@ typedef size_t KINGSIZE_T;/* better than nothing */
typedef union {unsigned int l[2];} ULONGLONG; typedef union {unsigned int l[2];} ULONGLONG;
#endif #endif
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
typedef long long KINGLONG; /* for large sizes */ typedef long long SLONGLONG;
typedef long long LONGLONG;
#else #else
typedef long KINGLONG;/* better than nothing */ typedef union {int l[2];} SLONGLONG;
typedef union {int l[2];} LONGLONG;
#endif #endif
#if _FILE_OFFSET_BITS #if defined(_FILE_OFFSET_BITS) && !defined(OFF_T)
#define OFF_T off_t #define OFF_T off_t
#else #else
#define OFF_T KINGLONG #define OFF_T long
#endif #endif
/*------------------------------- constants ---------------------------------*/ /*------------------------------- constants ---------------------------------*/
...@@ -323,6 +323,9 @@ extern int about_cat(catstruct *cat, FILE *stream), ...@@ -323,6 +323,9 @@ extern int about_cat(catstruct *cat, FILE *stream),
extern PIXTYPE *alloc_body(tabstruct *tab, extern PIXTYPE *alloc_body(tabstruct *tab,
void (*func)(PIXTYPE *ptr, int npix)); void (*func)(PIXTYPE *ptr, int npix));
extern FLAGTYPE *alloc_ibody(tabstruct *tab,
void (*func)(FLAGTYPE *ptr, int npix));
extern t_type ttypeof(char *str); extern t_type ttypeof(char *str);
extern void error(int, char *, char *), extern void error(int, char *, char *),
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 09/10/2010 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -146,7 +146,7 @@ INPUT Pointer to element to convert, ...@@ -146,7 +146,7 @@ INPUT Pointer to element to convert,
OUTPUT -. OUTPUT -.
NOTES ttypeconv does not yet handle arrays. NOTES ttypeconv does not yet handle arrays.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 19/11/2009 VERSION 13/06/2012
***/ ***/
void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout) void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
...@@ -170,7 +170,7 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout) ...@@ -170,7 +170,7 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
*((int *)ptrout) = (int)x; \ *((int *)ptrout) = (int)x; \
break; \ break; \
case T_LONGLONG: \ case T_LONGLONG: \
*((LONGLONG *)ptrout) = (LONGLONG)x; \ *((SLONGLONG *)ptrout) = (SLONGLONG)x; \
break; \ break; \
case T_FLOAT: \ case T_FLOAT: \
*((float *)ptrout) = (float)x; \ *((float *)ptrout) = (float)x; \
...@@ -220,7 +220,7 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout) ...@@ -220,7 +220,7 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
break; break;
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
case T_LONGLONG: case T_LONGLONG:
OUTCONV(*(LONGLONG *)ptrin, ttypeout); OUTCONV(*(SLONGLONG *)ptrin, ttypeout);
break; break;
#endif #endif
case T_FLOAT: case T_FLOAT:
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 09/10/2010 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -588,7 +588,7 @@ NOTES This is approximately the same code as for read_keys. ...@@ -588,7 +588,7 @@ NOTES This is approximately the same code as for read_keys.
A NULL keynames pointer means read ALL keys belonging to the table. A NULL keynames pointer means read ALL keys belonging to the table.
A NULL mask pointer means NO selection for reading. A NULL mask pointer means NO selection for reading.
AUTHOR E. Bertin (IAP & Leiden observatory) AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 08/02/2010 VERSION 13/06/2012
***/ ***/
void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys, void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys,
BYTE *mask, FILE *stream, BYTE *mask, FILE *stream,
...@@ -864,7 +864,7 @@ void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys, ...@@ -864,7 +864,7 @@ void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys,
if (key_col[k] == 0 || key_col[k] == j+1) { if (key_col[k] == 0 || key_col[k] == j+1) {
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
fprintf(stream, *key->printf?key->printf:"%lld", fprintf(stream, *key->printf?key->printf:"%lld",
*(LONGLONG *)ptr); *(SLONGLONG *)ptr);
#else #else
fprintf(stream, *key->printf?key->printf:"%d", fprintf(stream, *key->printf?key->printf:"%d",
*(int *)ptr); *(int *)ptr);
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 09/10/2010 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -323,7 +323,7 @@ INPUT pointer to the FITS buffer, ...@@ -323,7 +323,7 @@ INPUT pointer to the FITS buffer,
OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise. OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword. NOTES The buffer MUST contain the ``END '' keyword.
AUTHOR E. Bertin (IAP & Leiden observatory) AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype, int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
t_type ttype) t_type ttype)
...@@ -347,7 +347,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype, ...@@ -347,7 +347,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
sscanf(str+10, " %hd", (short *)ptr); sscanf(str+10, " %hd", (short *)ptr);
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
else else
sscanf(str+10, " %lld", (LONGLONG *)ptr); sscanf(str+10, " %lld", (SLONGLONG *)ptr);
#endif #endif
break; break;
...@@ -368,7 +368,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype, ...@@ -368,7 +368,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
*(LONG *)ptr = ((int)s[0] == 'T') ? 1 : 0; *(LONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
else else
*(LONGLONG *)ptr = ((int)s[0] == 'T') ? 1 : 0; *(SLONGLONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#endif #endif
break; break;
...@@ -460,7 +460,7 @@ OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise. ...@@ -460,7 +460,7 @@ OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword. NOTES The buffer MUST contain the ``END '' keyword.
The keyword must already exist in the buffer (use fitsadd()). The keyword must already exist in the buffer (use fitsadd()).
AUTHOR E. Bertin (IAP & Leiden observatory) AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype, int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
t_type ttype) t_type ttype)
...@@ -485,7 +485,7 @@ int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype, ...@@ -485,7 +485,7 @@ int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
sprintf(str, "%20d", *(short *)ptr); sprintf(str, "%20d", *(short *)ptr);
#ifdef HAVE_LONG_LONG_INT #ifdef HAVE_LONG_LONG_INT
else else
sprintf(str, "%20lld", *(LONGLONG *)ptr); sprintf(str, "%20lld", *(SLONGLONG *)ptr);
#endif #endif
break; break;
......
...@@ -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 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1995-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 09/10/2010 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -88,7 +88,7 @@ INPUT pointer to the catalog structure, ...@@ -88,7 +88,7 @@ INPUT pointer to the catalog structure,
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory) AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
void save_tab(catstruct *cat, tabstruct *tab) void save_tab(catstruct *cat, tabstruct *tab)
...@@ -97,7 +97,7 @@ void save_tab(catstruct *cat, tabstruct *tab) ...@@ -97,7 +97,7 @@ void save_tab(catstruct *cat, tabstruct *tab)
keystruct *key; keystruct *key;
tabstruct *keytab; tabstruct *keytab;
KINGSIZE_T tabsize; KINGSIZE_T tabsize;
KINGLONG size; long size;
int b,j,k,o, nbytes,nkey,nobj,spoonful, int b,j,k,o, nbytes,nkey,nobj,spoonful,
tabflag, larrayin,larrayout; tabflag, larrayin,larrayout;
char *buf, *inbuf, *outbuf, *fptr,*ptr; char *buf, *inbuf, *outbuf, *fptr,*ptr;
...@@ -395,7 +395,7 @@ INPUT Output stream ...@@ -395,7 +395,7 @@ INPUT Output stream
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory) AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
void print_obj(FILE *stream, tabstruct *tab) void print_obj(FILE *stream, tabstruct *tab)
...@@ -435,7 +435,7 @@ void print_obj(FILE *stream, tabstruct *tab) ...@@ -435,7 +435,7 @@ void print_obj(FILE *stream, tabstruct *tab)
putc(' ', stream); putc(' ', stream);
break; break;
case T_LONGLONG: case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr); fprintf(stream, *key->printf?key->printf:"%lld", *(SLONGLONG *)ptr);
if (i) if (i)
putc(' ', stream); putc(' ', stream);
break; break;
...@@ -477,7 +477,7 @@ INPUT Output stream ...@@ -477,7 +477,7 @@ INPUT Output stream
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR G. Tissier & E.Bertin (IAP) AUTHOR G. Tissier & E.Bertin (IAP)
VERSION 02/11/2009 VERSION 13/06/2012
***/ ***/
void voprint_obj(FILE *stream, tabstruct *tab) void voprint_obj(FILE *stream, tabstruct *tab)
...@@ -521,7 +521,7 @@ void voprint_obj(FILE *stream, tabstruct *tab) ...@@ -521,7 +521,7 @@ void voprint_obj(FILE *stream, tabstruct *tab)
putc(' ', stream); putc(' ', stream);
break; break;
case T_LONGLONG: case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr); fprintf(stream, *key->printf?key->printf:"%lld", *(SLONGLONG *)ptr);
if (i) if (i)
putc(' ', stream); putc(' ', stream);
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: 12/04/2012 * Last modified: 18/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -328,7 +328,7 @@ INPUT tab structure. ...@@ -328,7 +328,7 @@ INPUT tab structure.
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 22/07/2011 VERSION 18/06/2012
***/ ***/
wcsstruct *read_wcs(tabstruct *tab) wcsstruct *read_wcs(tabstruct *tab)
...@@ -439,6 +439,8 @@ wcsstruct *read_wcs(tabstruct *tab) ...@@ -439,6 +439,8 @@ wcsstruct *read_wcs(tabstruct *tab)
/*-- Coordinate reference frame */ /*-- Coordinate reference frame */
/*-- Search for an observation date expressed in Julian days */ /*-- Search for an observation date expressed in Julian days */
FITSREADF(buf, "MJD-OBS ", date, -1.0); FITSREADF(buf, "MJD-OBS ", date, -1.0);
if (date<0.0)
FITSREADF(buf, "MJDSTART", date, -1.0);
/*-- Precession date (defined from Ephemerides du Bureau des Longitudes) */ /*-- Precession date (defined from Ephemerides du Bureau des Longitudes) */
/*-- in Julian years from 2000.0 */ /*-- in Julian years from 2000.0 */
if (date>0.0) if (date>0.0)
...@@ -744,15 +746,16 @@ INPUT Proposed projection code name. ...@@ -744,15 +746,16 @@ INPUT Proposed projection code name.
OUTPUT RETURN_OK if projection is supported, RETURN_ERROR otherwise. OUTPUT RETURN_OK if projection is supported, RETURN_ERROR otherwise.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 12/04/2012 VERSION 14/06/2012
***/ ***/
int wcs_supproj(char *name) int wcs_supproj(char *name)
{ {
char projcode[28][5] = char projcode[28][5] =
{"TAN", "TPV", "AZP", "SIN", "STG", "ARC", "ZPN", "ZEA", "AIR", "CYP", "CAR", {"TAN", "TPV", "AZP", "SIN", "STG", "ARC", "ZPN", "ZEA", "AIR", "CYP",
"MER", "CEA", "COP", "COD", "COE", "COO", "BON", "PCO", "GLS", "PAR", "CAR", "MER", "CEA", "COP", "COD", "COE", "COO", "BON", "PCO", "GLS",
"AIT", "MOL", "CSC", "QSC", "TSC", "TNX", "NONE"}; "PAR", "AIT", "MOL", "CSC", "QSC", "TSC", "TNX", "NONE"};
int i; int i;
for (i=0; i<28; i++) for (i=0; i<28; i++)
...@@ -770,7 +773,7 @@ INPUT WCS structure. ...@@ -770,7 +773,7 @@ INPUT WCS structure.
OUTPUT -. OUTPUT -.
NOTES . NOTES .
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 06/11/2003 VERSION 14/06/2012
***/ ***/
void invert_wcs(wcsstruct *wcs) void invert_wcs(wcsstruct *wcs)
...@@ -789,7 +792,8 @@ void invert_wcs(wcsstruct *wcs) ...@@ -789,7 +792,8 @@ void invert_wcs(wcsstruct *wcs)
lat = wcs->wcsprm->lat; lat = wcs->wcsprm->lat;
if (!strcmp(wcs->wcsprm->pcode, "TNX")) if (!strcmp(wcs->wcsprm->pcode, "TNX"))
tnxflag = 1; tnxflag = 1;
else if (!strcmp(wcs->wcsprm->pcode, "TAN") else if ((strcmp(wcs->wcsprm->pcode, "TAN")
|| !strcmp(wcs->wcsprm->pcode, "TPV"))
&& (wcs->projp[1+lng*100] || wcs->projp[1+lat*100])) && (wcs->projp[1+lng*100] || wcs->projp[1+lat*100]))
tnxflag = 0; tnxflag = 0;
else else
...@@ -1652,13 +1656,12 @@ OUTPUT Determinant over spatial coordinates (ratio of pixel areas), ...@@ -1652,13 +1656,12 @@ OUTPUT Determinant over spatial coordinates (ratio of pixel areas),
NOTES Memory must have been allocated (naxis*naxis*sizeof(double)) for the NOTES Memory must have been allocated (naxis*naxis*sizeof(double)) for the
Jacobian array. Jacobian array.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 31/03/2012 VERSION 12/06/2012
***/ ***/
double wcs_rawtoraw(wcsstruct *wcsin, wcsstruct *wcsout, double wcs_rawtoraw(wcsstruct *wcsin, wcsstruct *wcsout,
double *pixposin, double *pixposout, double *jacob) double *pixposin, double *pixposout, double *jacob)
{ {
double pixpos0[NAXIS], pixpos2[NAXIS], wcspos[NAXIS], double pixpos0[NAXIS], pixpos2[NAXIS], wcspos[NAXIS];
dpos;
int i,j, lng,lat,naxis; int i,j, lng,lat,naxis;
naxis = wcsin->naxis; naxis = wcsin->naxis;
......
...@@ -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: 31/03/2012 * Last modified: 14/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define WCS_NGRIDPOINTS 12 /* Number of WCS grid points / axis */ #define WCS_NGRIDPOINTS 12 /* Number of WCS grid points / axis */
#define WCS_NGRIDPOINTS2 (WCS_NGRIDPOINTS*WCS_NGRIDPOINTS) #define WCS_NGRIDPOINTS2 (WCS_NGRIDPOINTS*WCS_NGRIDPOINTS)
#define WCS_INVMAXDEG 9 /* Maximum inversion polynom degree */ #define WCS_INVMAXDEG 9 /* Maximum inversion polynom degree */
#define WCS_INVACCURACY 0.04 /* Maximum inversion error (pixels) */ #define WCS_INVACCURACY 0.001 /* Maximum inversion error (pixels) */
#define WCS_NRANGEPOINTS 32 /* Number of WCS range points / axis */ #define WCS_NRANGEPOINTS 32 /* Number of WCS range points / axis */
/*-------------------------------- typedefs ---------------------------------*/ /*-------------------------------- typedefs ---------------------------------*/
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1993-2011 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1993-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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/11/2011 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -78,7 +78,7 @@ void makeit() ...@@ -78,7 +78,7 @@ void makeit()
unsigned int modeltype; unsigned int modeltype;
int nflag[MAXFLAG], nparam2[2], int nflag[MAXFLAG], nparam2[2],
i, nok, ntab, next, ntabmax, forcextflag, i, nok, ntab, next, ntabmax, forcextflag,
nima0,nima1, nweight0,nweight1, npat; nima0,nima1, nweight0,nweight1, npat,npat0;
/* Install error logging */ /* Install error logging */
error_installfunc(write_error); error_installfunc(write_error);
...@@ -110,14 +110,15 @@ void makeit() ...@@ -110,14 +110,15 @@ void makeit()
if (prefs.psf_flag) if (prefs.psf_flag)
{ {
/*-- Read the first PSF extension to set up stuff such as context parameters */
NFPRINTF(OUTPUT, "Reading PSF information"); NFPRINTF(OUTPUT, "Reading PSF information");
if (prefs.dpsf_flag) if (prefs.dpsf_flag)
{ {
thedpsf = psf_load(prefs.psf_name[0]); thedpsf = psf_load(prefs.psf_name[0],0);
thepsf = psf_load(prefs.psf_name[1]); thepsf = psf_load(prefs.psf_name[1],0);
} }
else else
thepsf = psf_load(prefs.psf_name[0]); thepsf = psf_load(prefs.psf_name[0],0);
/*-- Need to check things up because of PSF context parameters */ /*-- Need to check things up because of PSF context parameters */
updateparamflags(); updateparamflags();
useprefs(); useprefs();
...@@ -146,14 +147,14 @@ void makeit() ...@@ -146,14 +147,14 @@ void makeit()
thedprofit = profit_init(thedpsf, modeltype); thedprofit = profit_init(thedpsf, modeltype);
if (prefs.pattern_flag) if (prefs.pattern_flag)
{ {
npat = prefs.prof_disk_patternvectorsize; npat0 = prefs.prof_disk_patternvectorsize;
if (npat<prefs.prof_disk_patternmodvectorsize) if (npat0<prefs.prof_disk_patternmodvectorsize)
npat = prefs.prof_disk_patternmodvectorsize; npat0 = prefs.prof_disk_patternmodvectorsize;
if (npat<prefs.prof_disk_patternargvectorsize) if (npat0<prefs.prof_disk_patternargvectorsize)
npat = prefs.prof_disk_patternargvectorsize; npat0 = prefs.prof_disk_patternargvectorsize;
/*---- Do a copy of the original number of pattern components */ /*---- Do a copy of the original number of pattern components */
prefs.prof_disk_patternncomp = npat; prefs.prof_disk_patternncomp = npat0;
pattern = pattern_init(theprofit, prefs.pattern_type, npat); pattern = pattern_init(theprofit, prefs.pattern_type, npat0);
if (FLAG(obj2.prof_disk_patternvector)) if (FLAG(obj2.prof_disk_patternvector))
{ {
npat = pattern->size[2]; npat = pattern->size[2];
...@@ -180,8 +181,10 @@ void makeit() ...@@ -180,8 +181,10 @@ void makeit()
} }
QPRINTF(OUTPUT, "\n"); QPRINTF(OUTPUT, "\n");
if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration)) if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration))
{
thepprofit = profit_init(thepsf, MODEL_DIRAC); thepprofit = profit_init(thepsf, MODEL_DIRAC);
theqprofit = profit_init(thepsf, MODEL_EXPONENTIAL); theqprofit = profit_init(thepsf, MODEL_EXPONENTIAL);
}
#else #else
error(EXIT_FAILURE, error(EXIT_FAILURE,
"*Error*: model-fitting is not supported in this build.\n", "*Error*: model-fitting is not supported in this build.\n",
...@@ -229,6 +232,7 @@ void makeit() ...@@ -229,6 +232,7 @@ void makeit()
/* Check if a specific extension should be loaded */ /* Check if a specific extension should be loaded */
if ((nima0=selectext(prefs.image_name[0])) != RETURN_ERROR) if ((nima0=selectext(prefs.image_name[0])) != RETURN_ERROR)
{ {
printf("%d\n", nima0);
forcextflag = 1; forcextflag = 1;
ntabmax = next = 1; ntabmax = next = 1;
} }
...@@ -448,6 +452,48 @@ void makeit() ...@@ -448,6 +452,48 @@ void makeit()
if ((check=prefs.check[i])) if ((check=prefs.check[i]))
reinitcheck(field, check); reinitcheck(field, check);
if (nok || forcextflag)
{
if (prefs.psf_flag)
{
/*------ Read other PSF extensions */
NFPRINTF(OUTPUT, "Reading PSF information");
psf_end(thepsf, thepsfit);
if (prefs.dpsf_flag)
{
psf_end(thedpsf, thedpsfit);
thedpsf = psf_load(prefs.psf_name[0], nima0<0? nok:nima0);
thepsf = psf_load(prefs.psf_name[1], nima1<0? nok:nima1);
}
else
thepsf = psf_load(prefs.psf_name[0],nima0<0? nok:nima0);
}
if (prefs.prof_flag)
{
/*------ Create profiles at full resolution */
profit_end(theprofit);
theprofit = profit_init(thepsf, modeltype);
if (prefs.dprof_flag)
{
profit_end(thedprofit);
thedprofit = profit_init(thedpsf, modeltype);
}
if (prefs.pattern_flag)
{
pattern = pattern_init(theprofit, prefs.pattern_type, npat0);
pattern_end(pattern);
}
if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration))
{
profit_end(thepprofit);
profit_end(theqprofit);
thepprofit = profit_init(thepsf, MODEL_DIRAC);
theqprofit = profit_init(thepsf, MODEL_EXPONENTIAL);
}
}
}
/*-- Initialize PSF contexts and workspace */ /*-- Initialize PSF contexts and workspace */
if (prefs.psf_flag) if (prefs.psf_flag)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1998-2011 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1998-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 26/10/2011 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -116,7 +116,7 @@ void psf_end(psfstruct *psf, psfitstruct *psfit) ...@@ -116,7 +116,7 @@ void psf_end(psfstruct *psf, psfitstruct *psfit)
/* /*
Read the PSF data from a FITS file. Read the PSF data from a FITS file.
*/ */
psfstruct *psf_load(char *filename) psfstruct *psf_load(char *filename, int ext)
{ {
static objstruct saveobj; static objstruct saveobj;
static obj2struct saveobj2; static obj2struct saveobj2;
...@@ -126,7 +126,7 @@ psfstruct *psf_load(char *filename) ...@@ -126,7 +126,7 @@ psfstruct *psf_load(char *filename)
keystruct *key; keystruct *key;
char *head, *ci,*co; char *head, *ci,*co;
int deg[POLY_MAXDIM], group[POLY_MAXDIM], ndim, ngroup, int deg[POLY_MAXDIM], group[POLY_MAXDIM], ndim, ngroup,
i,k; e,i,k;
/* Open the cat (well it is not a "cat", but simply a FITS file */ /* Open the cat (well it is not a "cat", but simply a FITS file */
if (!(cat = read_cat(filename))) if (!(cat = read_cat(filename)))
...@@ -141,7 +141,10 @@ psfstruct *psf_load(char *filename) ...@@ -141,7 +141,10 @@ psfstruct *psf_load(char *filename)
else else
strcpy(psf->name, filename); strcpy(psf->name, filename);
if (!(tab = name_to_tab(cat, "PSF_DATA", 0))) tab = cat->tab;
for (i=cat->ntab, e=ext; i-- && (strcmp("PSF_DATA",tab->extname) || e--);
tab = tab->nexttab);
if (i<0)
error(EXIT_FAILURE, "*Error*: PSF_DATA table not found in catalog ", error(EXIT_FAILURE, "*Error*: PSF_DATA table not found in catalog ",
filename); filename);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* This file part of: SExtractor * This file part of: SExtractor
* *
* Copyright: (C) 1998-2011 Emmanuel Bertin -- IAP/CNRS/UPMC * Copyright: (C) 1998-2012 Emmanuel Bertin -- IAP/CNRS/UPMC
* *
* 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: 26/10/2011 * Last modified: 13/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -128,7 +128,7 @@ extern double *compute_gradient (float *weight,int width, int height, ...@@ -128,7 +128,7 @@ extern double *compute_gradient (float *weight,int width, int height,
float *masks, double *pm), float *masks, double *pm),
psf_fwhm(psfstruct *psf); psf_fwhm(psfstruct *psf);
extern psfstruct *psf_load(char *filename); extern psfstruct *psf_load(char *filename, int ext);
extern void pc_end(pcstruct *pc), extern void pc_end(pcstruct *pc),
pc_fit(psfstruct *psf, float *data, float *weight, pc_fit(psfstruct *psf, float *data, float *weight,
......
...@@ -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: 04/06/2012 * Last modified: 26/06/2012
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -258,7 +258,7 @@ void readimagehead(picstruct *field) ...@@ -258,7 +258,7 @@ void readimagehead(picstruct *field)
tab = field->tab; tab = field->tab;
if(tab->naxis < 2) if(tab->naxis < 2)
error(EXIT_FAILURE, field->filename, " does NOT contain 2D-data!"); error(EXIT_FAILURE, field->filename, " does NOT contain image data!");
/*---------------------------- Basic keywords ------------------------------*/ /*---------------------------- Basic keywords ------------------------------*/
if (tab->bitpix != BP_BYTE if (tab->bitpix != BP_BYTE
......
...@@ -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: 30/08/2011 * Last modified: 20/12/2011
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
...@@ -36,11 +36,16 @@ ...@@ -36,11 +36,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "poly.h"
#ifdef HAVE_ATLAS #ifdef HAVE_ATLAS
#include ATLAS_LAPACK_H #include ATLAS_LAPACK_H
#endif #endif
#ifdef HAVE_LAPACKE
#include LAPACKE_H
#endif
#include "poly.h"
#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)))) \
qerror("Not enough memory for ", \ qerror("Not enough memory for ", \
...@@ -437,16 +442,16 @@ INPUT Pointer to the (pseudo 2D) matrix of coefficients, ...@@ -437,16 +442,16 @@ INPUT Pointer to the (pseudo 2D) matrix of coefficients,
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP, Leiden observatory & ESO) AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
VERSION 26/10/2010 VERSION 20/12/2011
***/ ***/
void poly_solve(double *a, double *b, int n) void poly_solve(double *a, double *b, int n)
{ {
#if defined(HAVE_LAPACKE)
#ifdef HAVE_ATLAS LAPACKE_dposv(LAPACK_COL_MAJOR, 'L', n, 1, a, n, b, n);
#elif defined(HAVE_ATLAS)
clapack_dposv(CblasRowMajor, CblasUpper, n, 1, a, n, b, n); clapack_dposv(CblasRowMajor, CblasUpper, n, 1, a, n, b, n);
#else #else
if (cholsolve(a,b,n)) cholsolve(a,b,n);
qerror("*Error*: singular matrix found ", "while deprojecting" );
#endif #endif
return; return;
...@@ -454,7 +459,7 @@ void poly_solve(double *a, double *b, int n) ...@@ -454,7 +459,7 @@ void poly_solve(double *a, double *b, int n)
/****** cholsolve ************************************************************* /****** cholsolve *************************************************************
PROTO void cholsolve(double *a, double *b, int n) PROTO int cholsolve(double *a, double *b, int n)
PURPOSE Solve a system of linear equations, using Cholesky decomposition. PURPOSE Solve a system of linear equations, using Cholesky decomposition.
INPUT Pointer to the (pseudo 2D) matrix of coefficients, INPUT Pointer to the (pseudo 2D) matrix of coefficients,
pointer to the 1D column vector, pointer to the 1D column vector,
......
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