1  /*
2  				prefs.h
3 
4 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 *
6 *	Part of:	SExtractor
7 *
8 *	Author:		E.BERTIN (IAP)
9 *
10 *	Contents:	Keywords for the configuration file.
11 *
12 *	Last modify:	13/07/2006
13 *
14 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 */
16 
17 #ifndef _PREFS_H_
18 #define _PREFS_H_
19 
20 /*----------------------------- Internal constants --------------------------*/
21 
22 #define	MAXLIST		32		/* max. nb of list members */
23 
24 /* NOTES:
25 One must have:	MAXLIST >= 1 (preferably >= 16!)
26 */
27 /*------------------------------- preferences -------------------------------*/
28 typedef struct
29   {
30   char		**command_line;				/* Command line */
31   int		ncommand_line;				/* nb of params */
32   char		prefs_name[MAXCHAR];			/* prefs filename*/
33   char		*(image_name[2]);			/* image filenames */
34   int		nimage_name;				/* nb of params */
35   char		cat_name[MAXCHAR];			/* catalog filename*/
36 /*----- thresholding */
37   double	dthresh[2];				/* detect. threshold */
38   int		ndthresh;				/* (1 or 2 entries) */
39   double	thresh[2];				/* analysis thresh. */
40   int		nthresh;				/* (1 or 2 entries) */
41   enum	{THRESH_RELATIVE, THRESH_ABSOLUTE}
42 					thresh_type[2];	/* bkgnd type */
43   int		nthresh_type;				/* nb of params */
44 /*----- extraction */
45   int		dimage_flag;				/* detect. image ? */
46   int		ext_minarea;				/* min area in pix. */
47   int		deb_maxarea;				/* max deblend. area */
48   int		filter_flag;				/* smoothing on/off */
49   char		filter_name[MAXCHAR];			/* mask filename */
50   double	filter_thresh[2];			/* Filter thresholds */
51   int		nfilter_thresh;				/* nb of params */
52   int		deblend_nthresh;			/* threshold number */
53   double	deblend_mincont;			/* minimum contrast */
54   double	satur_level;				/* saturation level */
55   enum	{CCD, PHOTO}			detect_type;	/* detection type */
56 /*----- Flagging */
57   char		*(fimage_name[MAXFLAG]);		/* flagmap filenames */
58   int		nfimage_name;				/* nb of params */
59   enum	{FLAG_OR, FLAG_AND, FLAG_MIN, FLAG_MAX, FLAG_MOST}
60 				flag_type[MAXFLAG];	/* flag combination */
61   int		imaflag_size;				/* requested iso nb1 */
62   int		imanflag_size;				/* requested iso nb2 */
63   int		nimaisoflag;				/* effective iso nb */
64   int		nimaflag;				/* effective ima nb */
65 /*----- cleaning */
66   int		clean_flag;				/* allow cleaning ? */
67   double	clean_param;				/* cleaning effic. */
68 /*----- Weighting */
69   char		*(wimage_name[2]);       		/* weight filenames */
70   int		nwimage_name;				/* nb of params */
71   weightenum	weight_type[2];				/* weighting scheme */
72   int		nweight_type;				/* nb of params */
73   int		weight_flag;				/* do we weight ? */
74   int		dweight_flag;				/* detection weight? */
75   int		weightgain_flag;			/* weight gain? */
76 /*----- photometry */
77   enum	{CAT_NONE, ASCII, ASCII_HEAD, ASCII_SKYCAT, ASCII_VO,
78 	FITS_LDAC, FITS_TPX, FITS_10}
79 		cat_type;				/* type of catalog */
80   enum	{PNONE, FIXED, AUTO}		apert_type;	/* type of aperture */
81   double	apert[MAXNAPER];			/* apert size (pix) */
82   int		naper;					/* effective apert. */
83   int		flux_apersize, fluxerr_apersize;	/* requested apert. */
84   int		mag_apersize, magerr_apersize;		/* requested apert. */
85   double	autoparam[2];				/* Kron parameters */
86   int		nautoparam;				/* nb of Kron params */
87   double	petroparam[2];				/* Kron parameters */
88   int		npetroparam;				/* nb of Kron params */
89   double	autoaper[2];				/* minimum apertures */
90   int		nautoaper;				/* nb of min. aperts */
91   double	mag_zeropoint;				/* magnitude offsets */
92   double	mag_gamma;				/* for emulsions */
93   double	gain;					/* only for CCD */
94 /*----- S/G separation */
95   double	pixel_scale;				/* in arcsec */
96   double	seeing_fwhm;				/* in arcsec */
97   char		nnw_name[MAXCHAR];			/* nnw filename */
98 /*----- background */
99   enum	{IMAGE, AFILE}			back_origin;	/* origin of bkgnd */
100   char		back_name[MAXCHAR];			/* bkgnd filename */
101   backenum	back_type[2];				/* bkgnd type */
102   int		nback_type;				/* nb of params */
103   double	back_val[2];				/* user-def. bkg */
104   int		nback_val;				/* nb of params */
105   int		backsize[2];				/* bkgnd mesh size */
106   int		nbacksize;				/* nb of params */
107   int		backfsize[2];				/* bkgnd filt. size */
108   int		nbackfsize;				/* nb of params */
109   double	backfthresh;				/* bkgnd fil. thresh */
110   enum	{GLOBAL, LOCAL}			pback_type;	/* phot. bkgnd type */
111   int		pback_size;				/* rect. ann. width */
112 /*----- memory */
113   int		clean_stacksize;			/* size of buffer */
114   int		mem_pixstack;				/* pixel stack size */
115   int		mem_bufsize;				/* strip height */
116 /*----- catalog output */
117   char		param_name[MAXCHAR];			/* param. filename */
118 /*----- miscellaneous */
119   int		pipe_flag;				/* allow piping ? */
120   enum	{QUIET, NORM, WARN, FULL}      	verbose_type;	/* display type */
121   int		xml_flag;				/* Write XML file? */
122   char		xml_name[MAXCHAR];			/* XML file name */
123   char		xsl_name[MAXCHAR];			/* XSL file name (or URL) */
124   char		sdate_start[12];			/* SCAMP start date */
125   char		stime_start[12];			/* SCAMP start time */
126   char		sdate_end[12];				/* SCAMP end date */
127   char		stime_end[12];				/* SCAMP end time */
128   double	time_diff;				/* Execution time */
129 /*----- CHECK-images */
130   int		check_flag;				/* CHECK-image flag */
131   checkenum    	check_type[MAXCHECK];		       	/* check-image types */
132   int		ncheck_type;				/* nb of params */
133   char		*(check_name[MAXCHECK]);       		/* check-image names */
134   int		ncheck_name;				/* nb of params */
135   struct structcheck	*(check[MAXCHECK]);		/* check-image ptrs */
136 /*----- ASSOCiation */
137   int		assoc_flag;				/* ASSOCiation flag */
138   char		assoc_name[MAXCHAR];			/* ASSOC-list name */
139   int		assoc_param[3];				/* ASSOC param cols */
140   int		nassoc_param;				/* nb of params */
141   int		assoc_data[MAXNASSOC];		       	/* ASSOC data cols */
142   int		nassoc_data;				/* nb of params */
143   enum	{ASSOC_FIRST, ASSOC_NEAREST, ASSOC_MEAN, ASSOC_MAGMEAN,
144 	 ASSOC_SUM, ASSOC_MAGSUM, ASSOC_MIN, ASSOC_MAX}
145 		assoc_type;				/* type of assoc. */
146   enum	{ASSOCSELEC_ALL, ASSOCSELEC_MATCHED, ASSOCSELEC_NOMATCHED}
147 		assocselec_type;		       	/* type of assoc. */
148   double	assoc_radius;				/* ASSOC range */
149   int		assoc_size;				/* nb of parameters */
150   char		retina_name[MAXCHAR];			/* retina filename */
151   int		vignetsize[2];				/* vignet size */
152   int		vigshiftsize[2];			/* shift-vignet size */
153   int		cleanmargin;				/* CLEANing margin */
154   char		som_name[MAXCHAR];			/* SOM filename */
155   int		somfit_flag;				/* ASSOCiation flag */
156   int		somfit_vectorsize;			/* SOMfit vec. size */
157 /*----- masking */
158   enum {MASK_NONE, MASK_BLANK, MASK_CORRECT}
159 		mask_type;				/* type of masking */
160   int		blank_flag;				/* BLANKing flag */
161   double	weight_thresh[2];      			/* weight threshlds */
162   int		nweight_thresh;				/* nb of params */
163 /*----- interpolation */
164   enum	{INTERP_NONE, INTERP_VARONLY, INTERP_ALL}
165 		interp_type[2];				/* interpolat. type */
166   int		ninterp_type;				/* nb of params */
167   int		interp_xtimeout[2];   			/* interp. x timeout */
168   int		ninterp_xtimeout;       	        /* nb of params */
169   int		interp_ytimeout[2];   			/* interp. y timeout */
170   int		ninterp_ytimeout;       		/* nb of params */
171 /*----- astrometry */
172   int		world_flag;				/* WORLD required */
173   char		coosys[16];				/* VOTable coord.sys */
174   double	epoch;					/* VOTable epoch */
175 /*----- growth curve */
176   int		growth_flag;				/* gr. curve needed */
177   int		flux_growthsize;       			/* number of elem. */
178   int		mag_growthsize;       			/* number of elem. */
179   int		flux_radiussize;       			/* number of elem. */
180   double	growth_step;				/* step size (pix) */
181   double	flux_frac[MAXNAPER];			/* for FLUX_RADIUS */
182   int		nflux_frac;       			/* number of elem. */
183 /*----- PSF-fitting */
184   int		psf_flag;				/* PSF-fit needed */
185   int		dpsf_flag;				/* dual image PSF-fit */
186   char		*(psf_name[2]);				/* PSF filename */
187   int		npsf_name;				/* nb of params */
188   int		psf_npsfmax;				/* Max # of PSFs */
189   enum	{PSFDISPLAY_SPLIT, PSFDISPLAY_VECTOR}
190 		psfdisplay_type;			/* PSF display type */
191   int		psf_xsize,psf_ysize;			/* nb of params */
192   int		psf_xwsize,psf_ywsize;			/* nb of params */
193   int		psf_alphassize,psf_deltassize;		/* nb of params */
194   int		psf_alpha2000size,psf_delta2000size;	/* nb of params */
195   int		psf_alpha1950size,psf_delta1950size;	/* nb of params */
196   int		psf_fluxsize;				/* nb of params */
197   int		psf_fluxerrsize;			/* nb of params */
198   int		psf_magsize;				/* nb of params */
199   int		psf_magerrsize;				/* nb of params */
200   int		pc_flag;				/* PC-fit needed */
201   int		pc_vectorsize;				/* nb of params */
202 /*----- customize */
203   int		fitsunsigned_flag;			/* Force unsign FITS */
204   int		next;			     /* Number of extensions in file */
205 /* Multithreading */
206   int		nthreads;			/* Number of active threads */
207   }	prefstruct;
208 
209 EXTERN prefstruct	prefs;
210 
211 /*-------------------------------- protos -----------------------------------*/
212 extern int	cistrcmp(char *cs, char *ct, int mode);
213 
214 extern void	dumpprefs(int state),
215 		readprefs(char *filename,char **argkey,char **argval,int narg),
216 		useprefs(void);
217 #endif
218