36#include <eris_nix_dfs.h>
37#include <eris_nix_scired.h>
46static const char eris_nix_img_cal_phot_description[] =
47"This recipe calibrates the photometry of ERIS/NIX frames. It does this \n"
50"1. If a frame that has already been photometrically calibrated is\n"
51" present in the input set of files (SoF), then the photometric\n"
52" zeropoint is transferred from that to the target images.\n"
55" DO CATG Explanation Req. #Frames\n"
56" ------- ----------- --- -------\n"
57" "ERIS_NIX_IMG_STD_COMBINED_PRO_CATG
58 " photometrically Y 1\n"
60" "ERIS_NIX_CAL_WCS_OBJECT_JITTER_PRO_CATG
61 " files to be Y 1-n\n"
65" DO CATG Explanation Name\n"
66" ------- ----------- ----\n"
67" "ERIS_NIX_CAL_PHOT_OBJECT_JITTER_PRO_CATG
68 " Calibrated cal_phot.<in_name>\n"
71" The structure of the output files is the same as the input\n"
72" except for some additional keywords defining the zeropoint,\n"
73" stored in the primary header and the header of the extension\n"
74" holding catalogued objects, if present:\n"
75" --- ESO.QC.MAGZPT = The zeropoint transferred from the input\n"
77" --- ESO.QC.MAGZERR = The zeropoint sigma transferred from\n"
78" the input calibrated image.\n"
79" --- PHOTZP = The zeropoint taking into account the exposure\n"
80" time and extinction for this image. This\n"
81" correction can be applied directly to the image\n"
83" --- PHOTZPER = The uncertainty of PHOTZP.\n"
84" --- ZPMETHOD = 'separate_STD_star'\n"
85" --- ZP_CAT = <value of parameter cdssearch_astron>\n"
87"2. If there is no photometrically calibrated frame in the SoF \n"
88" then the recipe will search for a standard star in each frame\n"
89" by trying to associate an object found there with an entry in a \n"
90" catalogue of photometric standards, specified using parameter\n"
91" cdssearch-photom. Currently, the method works only if there is\n"
92" a single standard star in the field.\n"
95" DO CATG Explanation Req. #Frames\n"
96" ------- ----------- --- -------\n"
97" "ERIS_NIX_CAL_WCS_OBJECT_JITTER_PRO_CATG
98 " target frames with Y 1-n\n"
99" absolutely calibrated\n"
100" wcs, that is with\n"
101" ESO.WCS_METHOD = \n"
102" 'science_field_standard'\n"
103" "ERIS_NIX_PHOT_DATA_PRO_CATG
104 " a photometry data\n"
106" equations relating\n"
112" DO CATG Explanation Name\n"
113" ------- ----------- ----\n"
114" "ERIS_NIX_CAL_PHOT_OBJECT_JITTER_PRO_CATG
115 " Calibrated cal_phot.<in_name>\n"
118" The structure of each output file is the same as the input\n"
119" except for some added keywords defining the zeropoint stored\n"
120" in the FITS headers, and the addition of a new extension\n"
121" named MATCHSTD_PHOT with details of the matched photometric\n"
122" standards. The new header items are:\n"
123" -- ESO.QC.MAGZPT The zeropoint calculated through aperture 3\n"
124" using objects from the current SoF images.\n"
125" -- ESO.QC.MAGZERR The zeropoint sigma calculated through\n"
126" aperture 3 using objects from the current\n"
128" -- ESO.QC.MAGNZPT The number of objects used to calculate the\n"
130" -- ESO.QC.LIMITING_MAG The 5 sigma limiting magnitude through\n"
132" -- PHOTZP The zeropoint taking into account the\n"
133" exposure time and extinction for this image.\n"
134" -- PHOTZPER The uncertainty of PHOTZP.\n"
135" -- ZPMETHOD = '2MASS'\n"
137" Calculation of the photometric zeropoint for each frame is done\n"
138" using the same CASU routines as are used for HAWK-I. The images\n"
139" in the SoF are treated together, as if they were from the 4 \n"
140" HAWKI-I detectors.\n"
142"3. If there is no photometrically calibrated frame in the SoF\n"
143" and either their astrometric calibration is not absolute or no\n"
144" standard stars are found in the target frames, then the\n"
145" assigned zeropoint will be the default value for this filter,\n"
146" copied from the photometric data file.\n"
148" The inputs required are the same as for case 2. The outputs\n"
149" will be the same as for case 1, except for:\n"
150" -- ZPMETHOD = 'DEFAULT'\n"
153#define RECIPE_NAME "eris_nix_img_cal_phot"
154#define CONTEXT "eris."RECIPE_NAME
160cpl_recipe_define(eris_nix_img_cal_phot, ERIS_BINARY_VERSION,
162 PACKAGE_BUGREPORT,
"2017",
163 "Calibrate photometry of ERIS/NIX frames",
164 eris_nix_img_cal_phot_description);
180static cpl_error_code eris_nix_img_cal_phot_fill_parameterlist(
181 cpl_parameterlist * self) {
183 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
185 hdrl_parameter * catalogue_defaults = NULL;
186 cpl_parameterlist * catalogue_parlist = NULL;
187 cpl_parameter * p = NULL;
191 p = cpl_parameter_new_enum(CONTEXT
".cdssearch_photom",
193 "CDS photometric catalogue",
195 "2MASS", 2,
"none",
"2MASS");
196 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"cdssearch_photom");
197 cpl_parameterlist_append(self, p);
203 10.0, CPL_TRUE, 128, 5.0, 3.0,
204 ERIS_NIX_SATURATION_DEFAULT, HDRL_CATALOGUE_ALL);
206 "catalogue", catalogue_defaults);
210 for (p = cpl_parameterlist_get_first(catalogue_parlist);
212 p = cpl_parameterlist_get_next(catalogue_parlist)) {
214 const char * pname = cpl_parameter_get_name(p);
215 if (strstr(pname,
"minmax") == NULL) {
216 cpl_parameter * duplicate = cpl_parameter_duplicate(p);
217 cpl_parameterlist_append(self, duplicate);
223 p = cpl_parameter_new_enum(CONTEXT
".catalogue.ao-params",
225 "Default catalogue.core-radius and "
226 "catalogue.mesh-size depending on "
229 "auto", 2,
"auto",
"user");
230 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"catalogue.ao-params");
231 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
232 cpl_parameterlist_append(self, p);
236 p = cpl_parameter_new_value(CONTEXT
".pixel_radius",
238 "Max. distance between object and catalogue "
239 "entry for association (pixels)",
241 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"pixel-radius");
242 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
243 cpl_parameterlist_append(self, p);
245 p = cpl_parameter_new_range(CONTEXT
".minphotom",
247 "Min number of matched stars for photometric "
248 "calibration", CONTEXT, 1, 1, 100000);
249 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"minphotom");
250 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
251 cpl_parameterlist_append(self, p);
253 p = cpl_parameter_new_value(CONTEXT
".magerrcut",
255 "Matched stars with magnitude error above "
256 "this cutoff will not be used.",
258 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"magerrcut");
259 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
260 cpl_parameterlist_append(self, p);
262 p = cpl_parameter_new_value(CONTEXT
".debug-data",
263 CPL_TYPE_BOOL,
"true to save interim results",
265 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"debug-data");
266 cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
267 cpl_parameterlist_append(self, p);
272 cpl_parameterlist_delete(catalogue_parlist);
287static int eris_nix_img_cal_phot(cpl_frameset * frameset,
288 const cpl_parameterlist * parlist) {
292 return (
int) cpl_error_get_code();
cpl_error_code eris_nix_scired_cal_phot(cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *recipe_name, const char *context)
This recipe calibrates the photometry of ERIS/NIX frames.
hdrl_parameter * hdrl_catalogue_parameter_create(int obj_min_pixels, double obj_threshold, cpl_boolean obj_deblending, double obj_core_radius, cpl_boolean bkg_estimate, int bkg_mesh_size, double bkg_smooth_fwhm, double det_eff_gain, double det_saturation, hdrl_catalogue_options resulttype)
Creates catalogue Parameters object.
cpl_parameterlist * hdrl_catalogue_parameter_create_parlist(const char *base_context, const char *prefix, hdrl_parameter *defaults)
Create parameter list for the catalogue computation.
void hdrl_parameter_delete(hdrl_parameter *obj)
shallow delete of a parameter