1  /*
2  				astrom.h
3 
4 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 *
6 *	Part of:	SExtractor
7 *
8 *	Author:		E.BERTIN, IAP & Leiden observatory
9 *
10 *	Contents:	Astrometrical stuff.
11 *
12 *	Last modify:	13/07/2006
13 *
14 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 */
16 
17 /*----------------------------- Internal constants --------------------------*/
18 
19 #define		DEG	(PI/180.0)	/* 1 deg in radians */
20 #define		ARCSEC	(DEG/3600.0)	/* 1 arcsec in radians */
21 #define		MJD2000	51544.50000	/* Modified Julian date for J2000.0 */
22 #define		MJD1950	33281.92346	/* Modified Julian date for B1950.0 */
23 #define		JU2TROP	1.0000214	/* 1 Julian century in tropical units*/
24 #define		NAXIS	3		/* Max number of FITS axes */
25 #define		MAMA_CORFLEX	3.3e-5	/* MAMA coordinate correction factor */
26 
27 /*------------------------------- structures --------------------------------*/
28 
29 typedef struct structastrom
30   {
31   int		naxis;			/* Number of image axes */
32 
33   char		ctype[NAXIS][9];	/* FITS CTYPE strings */
34   char		cunit[NAXIS][32];	/* FITS CUNIT strings */
35   double	crval[NAXIS];		/* FITS CRVAL parameters */
36   double	cdelt[NAXIS];		/* FITS CDELT parameters */
37   double	crpix[NAXIS];		/* FITS CRPIX parameters */
38   double	projp[100*NAXIS];	/* FITS PROJP parameters */
39   double	longpole,latpole;	/* FITS LONGPOLE and LATPOLE */
40   double	pc[NAXIS*NAXIS];	/* FITS PC matrix */
41   double	linmat[NAXIS*NAXIS];	/* Local linear mapping matrix */
42   double	lindet;			/* Determinant of the local matrix */
43   double	pixscale;		/* (Local) pixel scale */
44   double	ap2000,dp2000;		/* J2000 coordinates of pole */
45   double	ap1950,dp1950;		/* B1950 coordinates of pole */
46   double	equinox;		/* Equinox of observations */
47   enum {RDSYS_ICRS, RDSYS_FK5, RDSYS_FK4, RDSYS_FK4_NO_E, RDSYS_GAPPT}
48 		radecsys;		/* FITS RADECSYS reference frame */
49   int		wcs_flag;		/* WCSLIB: can it be used? */
50   int		lat,lng;		/* longitude and latitude axes # */
51   double	r0;			/* projection "radius" */
52   struct wcsprm	*wcs;			/* WCSLIB's wcsprm structure */
53   struct linprm	*lin;			/* WCSLIB's linprm structure */
54   struct celprm	*cel;			/* WCSLIB's celprm structure */
55   struct prjprm *prj;			/* WCSLIB's prjprm structure */
56   struct tnxaxis *tnx_latcor;		/* IRAF's TNX latitude corrections */
57   struct tnxaxis *tnx_lngcor;		/* IRAF's TNX longitude corrections */
58   }	astromstruct;
59 
60 /*------------------------------- functions ---------------------------------*/
61 extern void		astrom_errparam(picstruct *, objstruct *),
62 			astrom_winerrparam(picstruct *, objstruct *),
63 			astrom_shapeparam(picstruct *, objstruct *),
64 			astrom_winshapeparam(picstruct *, objstruct *),
65 			computeastrom(picstruct *, objstruct *),
66 			copyastrom(picstruct *infield, picstruct *outfield),
67 			endastrom(picstruct *),
68 			initastrom(picstruct *),
69 			j2b(double, double, double, double *, double *),
70 			precess(double,double,double,double,double *,double *);
71 
72 extern double		*compute_wcs(picstruct *, double, double);
73