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
# 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>.
#
......@@ -714,8 +714,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.16.3'
PACKAGE_STRING='sextractor 2.16.3'
PACKAGE_VERSION='2.17.0'
PACKAGE_STRING='sextractor 2.17.0'
PACKAGE_BUGREPORT='bertin@iap.fr'
PACKAGE_URL=''
 
......@@ -1465,7 +1465,7 @@ if test "$ac_init_help" = "long"; then
# 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.
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]...
 
......@@ -1535,7 +1535,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.16.3:";;
short | recursive ) echo "Configuration of sextractor 2.17.0:";;
esac
cat <<\_ACEOF
 
......@@ -1668,7 +1668,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sextractor configure 2.16.3
sextractor configure 2.17.0
generated by GNU Autoconf 2.68
 
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -2296,7 +2296,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
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
 
$ $0 $@
......@@ -2972,7 +2972,7 @@ fi
 
# Define the identity of the package.
PACKAGE='sextractor'
VERSION='2.16.3'
VERSION='2.17.0'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -23325,7 +23325,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
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
 
CONFIG_FILES = $CONFIG_FILES
......@@ -23391,7 +23391,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
sextractor config.status 2.16.3
sextractor config.status 2.17.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
 
......
......@@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)
# 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_AUX_DIR(autoconf)
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
sex \- extract a source catalogue from an astronomical FITS image
.SH SYNOPSIS
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 11/10/2010
* Last modified: 26/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -70,17 +70,11 @@ picstruct *newfield(char *filename, int flags, int nok)
field->flags = flags;
field->cat = cat;
tab = cat->tab;
nok++; /* At least one pass through the loop */
nok2 = nok;
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;
nok--;
}
for (ntab=cat->ntab; nok-- && ntab--;)
tab=tab->nexttab;
field->tab = tab;
if (ntab<0)
error(EXIT_FAILURE, "Not enough valid FITS image extensions in ",filename);
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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))
}
/******* 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 ************************************************************
PROTO void free_body(tabstruct *tab)
PURPOSE Free FITS body data.
......@@ -204,7 +304,7 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 24/08/2010
VERSION 13/06/2012
***/
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;
#ifdef HAVE_LONG_LONG_INT
ULONGLONG lluval, llublank;
LONGLONG llval, llblank;
SLONGLONG llval, llblank;
#endif
unsigned int iuval, iublank;
int curval, dval, blankflag, ival, iblank;
......@@ -346,9 +446,9 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{
if (tab->bitsgn)
{
llblank = (LONGLONG)tab->blank;
for (i=spoonful; i--; bufdata += sizeof(LONGLONG))
*(ptr++) = ((llval = *((LONGLONG *)bufdata)) == llblank)?
llblank = (SLONGLONG)tab->blank;
for (i=spoonful; i--; bufdata += sizeof(SLONGLONG))
*(ptr++) = ((llval = *((SLONGLONG *)bufdata)) == llblank)?
-BIG : llval*bs + bz;
}
else
......@@ -362,8 +462,8 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
else
{
if (tab->bitsgn)
for (i=spoonful; i--; bufdata += sizeof(LONGLONG))
*(ptr++) = *((LONGLONG *)bufdata)*bs + bz;
for (i=spoonful; i--; bufdata += sizeof(SLONGLONG))
*(ptr++) = *((SLONGLONG *)bufdata)*bs + bz;
else
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
*(ptr++) = *((ULONGLONG *)bufdata)*bs + bz;
......@@ -511,7 +611,7 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 02/11/2009
VERSION 01/02/2012
***/
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:
if (bswapflag)
swapbytes(bufdata, 4, spoonful);
for (i=spoonful; i--; bufdata += sizeof(unsigned long))
*(ptr++) = (FLAGTYPE)*((unsigned long *)bufdata);
for (i=spoonful; i--; bufdata += sizeof(unsigned int))
*(ptr++) = (FLAGTYPE)*((unsigned int *)bufdata);
break;
#ifdef HAVE_LONG_LONG_INT
......@@ -568,7 +668,7 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
#endif
case BP_FLOAT:
case BP_DOUBLE:
error(EXIT_FAILURE,"*Error*: I was expecting integers in ",
error(EXIT_FAILURE,"*Error*: expected integers, not floats, in ",
cat->filename);
break;
default:
......@@ -687,15 +787,15 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 02/11/2009
VERSION 13/06/2012
***/
void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{
static double bufdata0[DATA_BUFSIZE/sizeof(double)];
catstruct *cat;
char *cbufdata0;
size_t i, bowl, spoonful;
PIXTYPE bs,bz;
static double bufdata0[DATA_BUFSIZE/sizeof(double)];
catstruct *cat;
char *cbufdata0;
size_t i, bowl, spoonful;
PIXTYPE bs,bz;
bs = (PIXTYPE)tab->bscale;
bz = (PIXTYPE)tab->bzero;
......@@ -729,7 +829,7 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{
unsigned char *bufdata = (unsigned char *)cbufdata0;
for (i=spoonful; i--;)
*(bufdata++) = (unsigned char)((*(ptr++)-bz)/bs+0.49999);
*(bufdata++) = (unsigned char)((*(ptr++)-bz)/bs+0.49999);;
}
break;
......@@ -771,9 +871,9 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
case BP_LONGLONG:
if (tab->bitsgn)
{
LONGLONG *bufdata = (LONGLONG *)cbufdata0;
SLONGLONG *bufdata = (SLONGLONG *)cbufdata0;
for (i=spoonful; i--;)
*(bufdata++) = (LONGLONG)((*(ptr++)-bz)/bs+0.49999);
*(bufdata++) = (SLONGLONG)((*(ptr++)-bz)/bs+0.49999);
}
else
{
......@@ -923,9 +1023,9 @@ void write_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
case BP_LONGLONG:
if (tab->bitsgn)
{
LONGLONG *bufdata = (LONGLONG *)cbufdata0;
SLONGLONG *bufdata = (SLONGLONG *)cbufdata0;
for (i=spoonful; i--;)
*(bufdata++) = (LONGLONG)*(ptr++);
*(bufdata++) = (SLONGLONG)*(ptr++);
}
else
{
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,13 +23,15 @@
* along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 02/12/2010
* Last modified: 16/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef _FITSCAT_H_
#define _FITSCAT_H_
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
......@@ -100,17 +102,15 @@ typedef size_t KINGSIZE_T;/* better than nothing */
typedef union {unsigned int l[2];} ULONGLONG;
#endif
#ifdef HAVE_LONG_LONG_INT
typedef long long KINGLONG; /* for large sizes */
typedef long long LONGLONG;
typedef long long SLONGLONG;
#else
typedef long KINGLONG;/* better than nothing */
typedef union {int l[2];} LONGLONG;
typedef union {int l[2];} SLONGLONG;
#endif
#if _FILE_OFFSET_BITS
#if defined(_FILE_OFFSET_BITS) && !defined(OFF_T)
#define OFF_T off_t
#else
#define OFF_T KINGLONG
#define OFF_T long
#endif
/*------------------------------- constants ---------------------------------*/
......@@ -323,6 +323,9 @@ extern int about_cat(catstruct *cat, FILE *stream),
extern PIXTYPE *alloc_body(tabstruct *tab,
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 void error(int, char *, char *),
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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,
OUTPUT -.
NOTES ttypeconv does not yet handle arrays.
AUTHOR E. Bertin (IAP)
VERSION 19/11/2009
VERSION 13/06/2012
***/
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; \
break; \
case T_LONGLONG: \
*((LONGLONG *)ptrout) = (LONGLONG)x; \
*((SLONGLONG *)ptrout) = (SLONGLONG)x; \
break; \
case T_FLOAT: \
*((float *)ptrout) = (float)x; \
......@@ -220,7 +220,7 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
break;
#ifdef HAVE_LONG_LONG_INT
case T_LONGLONG:
OUTCONV(*(LONGLONG *)ptrin, ttypeout);
OUTCONV(*(SLONGLONG *)ptrin, ttypeout);
break;
#endif
case T_FLOAT:
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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.
A NULL keynames pointer means read ALL keys belonging to the table.
A NULL mask pointer means NO selection for reading.
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,
BYTE *mask, FILE *stream,
......@@ -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) {
#ifdef HAVE_LONG_LONG_INT
fprintf(stream, *key->printf?key->printf:"%lld",
*(LONGLONG *)ptr);
*(SLONGLONG *)ptr);
#else
fprintf(stream, *key->printf?key->printf:"%d",
*(int *)ptr);
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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,
OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword.
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,
t_type ttype)
......@@ -347,7 +347,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
sscanf(str+10, " %hd", (short *)ptr);
#ifdef HAVE_LONG_LONG_INT
else
sscanf(str+10, " %lld", (LONGLONG *)ptr);
sscanf(str+10, " %lld", (SLONGLONG *)ptr);
#endif
break;
......@@ -368,7 +368,7 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
*(LONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#ifdef HAVE_LONG_LONG_INT
else
*(LONGLONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
*(SLONGLONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#endif
break;
......@@ -460,7 +460,7 @@ OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword.
The keyword must already exist in the buffer (use fitsadd()).
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,
t_type ttype)
......@@ -485,7 +485,7 @@ int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
sprintf(str, "%20d", *(short *)ptr);
#ifdef HAVE_LONG_LONG_INT
else
sprintf(str, "%20lld", *(LONGLONG *)ptr);
sprintf(str, "%20lld", *(SLONGLONG *)ptr);
#endif
break;
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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,
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009
VERSION 13/06/2012
***/
void save_tab(catstruct *cat, tabstruct *tab)
......@@ -97,7 +97,7 @@ void save_tab(catstruct *cat, tabstruct *tab)
keystruct *key;
tabstruct *keytab;
KINGSIZE_T tabsize;
KINGLONG size;
long size;
int b,j,k,o, nbytes,nkey,nobj,spoonful,
tabflag, larrayin,larrayout;
char *buf, *inbuf, *outbuf, *fptr,*ptr;
......@@ -395,7 +395,7 @@ INPUT Output stream
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 02/11/2009
VERSION 13/06/2012
***/
void print_obj(FILE *stream, tabstruct *tab)
......@@ -435,7 +435,7 @@ void print_obj(FILE *stream, tabstruct *tab)
putc(' ', stream);
break;
case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr);
fprintf(stream, *key->printf?key->printf:"%lld", *(SLONGLONG *)ptr);
if (i)
putc(' ', stream);
break;
......@@ -477,7 +477,7 @@ INPUT Output stream
OUTPUT -.
NOTES -.
AUTHOR G. Tissier & E.Bertin (IAP)
VERSION 02/11/2009
VERSION 13/06/2012
***/
void voprint_obj(FILE *stream, tabstruct *tab)
......@@ -521,7 +521,7 @@ void voprint_obj(FILE *stream, tabstruct *tab)
putc(' ', stream);
break;
case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr);
fprintf(stream, *key->printf?key->printf:"%lld", *(SLONGLONG *)ptr);
if (i)
putc(' ', stream);
break;
......
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* 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.
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 22/07/2011
VERSION 18/06/2012
***/
wcsstruct *read_wcs(tabstruct *tab)
......@@ -439,6 +439,8 @@ wcsstruct *read_wcs(tabstruct *tab)
/*-- Coordinate reference frame */
/*-- Search for an observation date expressed in Julian days */
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) */
/*-- in Julian years from 2000.0 */
if (date>0.0)
......@@ -744,15 +746,16 @@ INPUT Proposed projection code name.
OUTPUT RETURN_OK if projection is supported, RETURN_ERROR otherwise.
NOTES -.
AUTHOR E. Bertin (IAP)
VERSION 12/04/2012
VERSION 14/06/2012
***/
int wcs_supproj(char *name)
{
char projcode[28][5] =
{"TAN", "TPV", "AZP", "SIN", "STG", "ARC", "ZPN", "ZEA", "AIR", "CYP", "CAR",
"MER", "CEA", "COP", "COD", "COE", "COO", "BON", "PCO", "GLS", "PAR",
"AIT", "MOL", "CSC", "QSC", "TSC", "TNX", "NONE"};
{"TAN", "TPV", "AZP", "SIN", "STG", "ARC", "ZPN", "ZEA", "AIR", "CYP",
"CAR", "MER", "CEA", "COP", "COD", "COE", "COO", "BON", "PCO", "GLS",
"PAR", "AIT", "MOL", "CSC", "QSC", "TSC", "TNX", "NONE"};
int i;
for (i=0; i<28; i++)
......@@ -770,7 +773,7 @@ INPUT WCS structure.
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 06/11/2003
VERSION 14/06/2012
***/
void invert_wcs(wcsstruct *wcs)
......@@ -789,7 +792,8 @@ void invert_wcs(wcsstruct *wcs)
lat = wcs->wcsprm->lat;
if (!strcmp(wcs->wcsprm->pcode, "TNX"))
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]))
tnxflag = 0;
else
......@@ -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
Jacobian array.
AUTHOR E. Bertin (IAP)
VERSION 31/03/2012
VERSION 12/06/2012
***/
double wcs_rawtoraw(wcsstruct *wcsin, wcsstruct *wcsout,
double *pixposin, double *pixposout, double *jacob)
{
double pixpos0[NAXIS], pixpos2[NAXIS], wcspos[NAXIS],
dpos;
double pixpos0[NAXIS], pixpos2[NAXIS], wcspos[NAXIS];
int i,j, lng,lat,naxis;
naxis = wcsin->naxis;
......
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 31/03/2012
* Last modified: 14/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -48,7 +48,7 @@
#define WCS_NGRIDPOINTS 12 /* Number of WCS grid points / axis */
#define WCS_NGRIDPOINTS2 (WCS_NGRIDPOINTS*WCS_NGRIDPOINTS)
#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 */
/*-------------------------------- typedefs ---------------------------------*/
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 02/11/2011
* Last modified: 13/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -78,7 +78,7 @@ void makeit()
unsigned int modeltype;
int nflag[MAXFLAG], nparam2[2],
i, nok, ntab, next, ntabmax, forcextflag,
nima0,nima1, nweight0,nweight1, npat;
nima0,nima1, nweight0,nweight1, npat,npat0;
/* Install error logging */
error_installfunc(write_error);
......@@ -110,14 +110,15 @@ void makeit()
if (prefs.psf_flag)
{
/*-- Read the first PSF extension to set up stuff such as context parameters */
NFPRINTF(OUTPUT, "Reading PSF information");
if (prefs.dpsf_flag)
{
thedpsf = psf_load(prefs.psf_name[0]);
thepsf = psf_load(prefs.psf_name[1]);
thedpsf = psf_load(prefs.psf_name[0],0);
thepsf = psf_load(prefs.psf_name[1],0);
}
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 */
updateparamflags();
useprefs();
......@@ -146,14 +147,14 @@ void makeit()
thedprofit = profit_init(thedpsf, modeltype);
if (prefs.pattern_flag)
{
npat = prefs.prof_disk_patternvectorsize;
if (npat<prefs.prof_disk_patternmodvectorsize)
npat = prefs.prof_disk_patternmodvectorsize;
if (npat<prefs.prof_disk_patternargvectorsize)
npat = prefs.prof_disk_patternargvectorsize;
npat0 = prefs.prof_disk_patternvectorsize;
if (npat0<prefs.prof_disk_patternmodvectorsize)
npat0 = prefs.prof_disk_patternmodvectorsize;
if (npat0<prefs.prof_disk_patternargvectorsize)
npat0 = prefs.prof_disk_patternargvectorsize;
/*---- Do a copy of the original number of pattern components */
prefs.prof_disk_patternncomp = npat;
pattern = pattern_init(theprofit, prefs.pattern_type, npat);
prefs.prof_disk_patternncomp = npat0;
pattern = pattern_init(theprofit, prefs.pattern_type, npat0);
if (FLAG(obj2.prof_disk_patternvector))
{
npat = pattern->size[2];
......@@ -180,8 +181,10 @@ void makeit()
}
QPRINTF(OUTPUT, "\n");
if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration))
{
thepprofit = profit_init(thepsf, MODEL_DIRAC);
theqprofit = profit_init(thepsf, MODEL_EXPONENTIAL);
}
#else
error(EXIT_FAILURE,
"*Error*: model-fitting is not supported in this build.\n",
......@@ -229,6 +232,7 @@ void makeit()
/* Check if a specific extension should be loaded */
if ((nima0=selectext(prefs.image_name[0])) != RETURN_ERROR)
{
printf("%d\n", nima0);
forcextflag = 1;
ntabmax = next = 1;
}
......@@ -448,6 +452,48 @@ void makeit()
if ((check=prefs.check[i]))
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 */
if (prefs.psf_flag)
{
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 26/10/2011
* Last modified: 13/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -116,7 +116,7 @@ void psf_end(psfstruct *psf, psfitstruct *psfit)
/*
Read the PSF data from a FITS file.
*/
psfstruct *psf_load(char *filename)
psfstruct *psf_load(char *filename, int ext)
{
static objstruct saveobj;
static obj2struct saveobj2;
......@@ -126,7 +126,7 @@ psfstruct *psf_load(char *filename)
keystruct *key;
char *head, *ci,*co;
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 */
if (!(cat = read_cat(filename)))
......@@ -141,7 +141,10 @@ psfstruct *psf_load(char *filename)
else
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 ",
filename);
......
......@@ -7,7 +7,7 @@
*
* 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
*
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 26/10/2011
* Last modified: 13/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -128,7 +128,7 @@ extern double *compute_gradient (float *weight,int width, int height,
float *masks, double *pm),
psf_fwhm(psfstruct *psf);
extern psfstruct *psf_load(char *filename);
extern psfstruct *psf_load(char *filename, int ext);
extern void pc_end(pcstruct *pc),
pc_fit(psfstruct *psf, float *data, float *weight,
......
......@@ -22,7 +22,7 @@
* You should have received a copy of the GNU General Public License
* along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 04/06/2012
* Last modified: 26/06/2012
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -258,7 +258,7 @@ void readimagehead(picstruct *field)
tab = field->tab;
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 ------------------------------*/
if (tab->bitpix != BP_BYTE
......
......@@ -23,7 +23,7 @@
* along with AstrOmatic software.
* If not, see <http://www.gnu.org/licenses/>.
*
* Last modified: 30/08/2011
* Last modified: 20/12/2011
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
......@@ -36,11 +36,16 @@
#include <stdlib.h>
#include <string.h>
#include "poly.h"
#ifdef HAVE_ATLAS
#include ATLAS_LAPACK_H
#include ATLAS_LAPACK_H
#endif
#ifdef HAVE_LAPACKE
#include LAPACKE_H
#endif
#include "poly.h"
#define QCALLOC(ptr, typ, nel) \
{if (!(ptr = (typ *)calloc((size_t)(nel),sizeof(typ)))) \
qerror("Not enough memory for ", \
......@@ -437,16 +442,16 @@ INPUT Pointer to the (pseudo 2D) matrix of coefficients,
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP, Leiden observatory & ESO)
VERSION 26/10/2010
VERSION 20/12/2011
***/
void poly_solve(double *a, double *b, int n)
{
#ifdef HAVE_ATLAS
#if defined(HAVE_LAPACKE)
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);
#else
if (cholsolve(a,b,n))
qerror("*Error*: singular matrix found ", "while deprojecting" );
cholsolve(a,b,n);
#endif
return;
......@@ -454,7 +459,7 @@ void poly_solve(double *a, double *b, int n)
/****** 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.
INPUT Pointer to the (pseudo 2D) matrix of coefficients,
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