49#include "eris_nix_dfs.h"
56#include <eris_nix_scired.h>
63static const char eris_nix_img_skysub_description[] =
64"This recipe estimates and subtracts the sky background from a set of \n"
65ERIS_NIX_CAL_DET_OBJECT_JITTER_PRO_CATG
" or "
66ERIS_NIX_CAL_DET_STD_JITTER_PRO_CATG
" frames.\n"
70" The recipe has 2 modes of operation.\n"
71" If --sky-source='target' then the sky background will be estimated \n"
72" from the target frames themselves.\n"
74" DO CATG Explanation Req. #Frames\n"
75" ------- ----------- --- -------\n"
76" "ERIS_NIX_CAL_DET_OBJECT_JITTER_PRO_CATG
77 " target frames with the Y 1-n\n"
78" or detector signature\n"
79" "ERIS_NIX_CAL_DET_STD_JITTER_PRO_CATG
82" If --sky-source='offset' and for "
83ERIS_NIX_CAL_DET_OBJECT_JITTER_PRO_CATG
"\n"
84" data only, the sky background will be estimated from a set of \n"
85" frames offset from the target region.\n"
87" DO CATG Explanation Req. #Frames\n"
88" ------- ----------- --- -------\n"
89" "ERIS_NIX_CAL_DET_OBJECT_JITTER_PRO_CATG
90 " target frames with the Y 1-n\n"
91" detector signature\n"
93" "ERIS_NIX_CAL_DET_SKY_JITTER_PRO_CATG
94 " sky frames with the Y 1-m\n"
95" detector signature\n"
100" DO CATG Explanation \n"
101" ------- ----------- \n"
102" "ERIS_NIX_SKYSUB_OBJECT_JITTER_PRO_CATG
103 " target frames with the sky removed.\n"
105" "ERIS_NIX_SKYSUB_STD_JITTER_PRO_CATG
"\n"
107" The output will be FITS files named 'skysub.<input filename>',\n"
108" containing extensions:\n"
109" - DATA, with the target data.\n"
110" - ERR, with the target error plane.\n"
111" - DQ, with the target data quality plane.\n"
112" - CONFIDENCE, with the target confidence plane.\n"
113" - BKG_DATA, with the estimated sky background.\n"
114" - BKG_ERR, with the error on the sky background.\n"
115" - BKG_CONF, with the confidence of the sky background.\n"
117"Notes on the method.\n"
118" Sky frames are taken from the pool of target or offset\n"
119" according to param --sky-source.\n"
121" The background for each frame is estimated from sky frames\n"
122" taken within sky-bracket-time/2 seconds of it.\n"
124" A first estimate of the background is made.\n"
125" If param --sky-method='collapse-median':\n"
126" - The estimate is a median collapse of the sky frames\n"
127" selected. This is prone to problems if the field is\n"
129" If --sky-method='median-median':\n"
130" - The median of each sky frame is obtained, and the\n"
131" background frame set at the median of those values.\n"
132" The background is forced to be flat, which is more\n"
133" robust in crowded fields, or where there is\n"
136" The estimated backgrounds are subtracted from the sky\n"
137" frames, and a search made for objects in each image.\n"
138" Object masks are constructed which blank out astronomical\n"
139" flux the sky frames. The --catalogue.xxx params listed\n"
140" below are used in this search for objects.\n"
142" The masked sky frames are then used to re-estimate the\n"
143" sky backgrounds following the same sky-method.\n";
146#define RECIPE_NAME "eris.eris_nix_img_skysub"
147#define CONTEXT "eris."RECIPE_NAME
152cpl_recipe_define(eris_nix_img_skysub, ERIS_BINARY_VERSION,
154 PACKAGE_BUGREPORT,
"2017",
155 "Subtract sky background from frames",
156 eris_nix_img_skysub_description);
172static cpl_error_code eris_nix_img_skysub_fill_parameterlist(
173 cpl_parameterlist * self) {
175 if (cpl_error_get_code() != CPL_ERROR_NONE)
return cpl_error_get_code();
179 eris_nix_catalogue_param_set(CONTEXT, self, 20, 3.0, CPL_TRUE,
180 5.0, CPL_TRUE, 64, 2.0, 3.0, ERIS_NIX_SATURATION_DEFAULT, HDRL_CATALOGUE_ALL);
185 eris_nix_skysub_param_set(CONTEXT, self);
188 eris_nix_pixel_coord_diagnostic_param_set(CONTEXT, self);
204static int eris_nix_img_skysub(cpl_frameset * frameset,
205 const cpl_parameterlist * parlist) {
210 return (
int) cpl_error_get_code();
cpl_error_code eris_nix_scired_skysub(cpl_frameset *frameset, const cpl_parameterlist *parlist, const char *recipe_name, const char *context)
This recipe estimates and subtracts the sky background from a set of science frames.