58#define MODULE_ID "XSH_CREATE_MASTER_DARK"
75 cpl_frame* frame = NULL;
76 cpl_frame* med_frame = NULL;
77 cpl_frame* mbias = NULL;
78 cpl_frameset* set = NULL;
80 float mean = 0.0,median = 0.0, stdev = 0.0;
85 4,100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,25};
87 const char* MBIAS_RECIPE_ID=
"xsh_mbias";
88 cpl_parameterlist* parameters=NULL;
90 const char* ftag=NULL;
91 cpl_frame* product=NULL;
93 cpl_propertylist* header=NULL;
96 const int decode_bp=2147483647;
111 parameters = cpl_parameterlist_new();
127 set = cpl_frameset_new();
128 for(
int i=0;i<nframes;i++) {
129 name=cpl_sprintf(
"frame%d.fits",i);
132 cpl_frameset_insert(set,cpl_frame_duplicate(frame));
149 name=cpl_strdup(cpl_frame_get_filename(product));
150 header=cpl_propertylist_load(name,0);
151 ima=cpl_image_load(name,CPL_TYPE_FLOAT,0,0);
154 CPL_FRAME_TYPE_IMAGE,
155 CPL_FRAME_GROUP_PRODUCT,
156 CPL_FRAME_LEVEL_FINAL));
164 == 0,CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong pcatg keyword");
171 CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong mean value in QC");
173 CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong median value in QC");
175 CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong rms value in QC");
179 assure(cpl_frame_get_group(product) == CPL_FRAME_GROUP_PRODUCT,
180 CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong group for MASTER BIAS frame");
182 CPL_ERROR_ILLEGAL_OUTPUT,
"Wrong tag (%s) for MASTER BIAS frame ",
183 cpl_frame_get_tag(product));
198 if (cpl_error_get_code() != CPL_ERROR_NONE) {
cpl_frame * xsh_compute_qc_on_master_bias(cpl_frameset *raws, cpl_frame *frame, xsh_instrument *instr, cpl_parameterlist *params)
Computes QC on a master bias frame.
cpl_frame * xsh_create_master_bias2(cpl_frameset *rawFrames, xsh_stack_param *stack_par, xsh_instrument *instr, const char *result_tag, const int method_code)
Creates master bias.
int main()
Unit test of xsh_bspline_interpol.
static xsh_instrument * instrument
static xsh_clipping_param crh_clipping
cpl_frame * xsh_test_create_frame(const char *name, int nx, int ny, const char *tag, cpl_frame_group group, xsh_instrument *instrument)
void xsh_pre_free(xsh_pre **pre)
Free a xsh_pre structure.
void xsh_prepare(cpl_frameset *frames, cpl_frame *bpmap, cpl_frame *mbias, const char *prefix, xsh_instrument *instr, const int pre_overscan_corr, const bool flag_neg_and_thresh_pix)
This function transform RAW frames dataset in PRE frames dataset attaching the default bad pixel map ...
#define assure(CONDITION, ERROR_CODE,...)
#define xsh_error_dump(level)
void xsh_instrument_set_mode(xsh_instrument *i, XSH_MODE mode)
Set a mode on instrument structure.
void xsh_instrument_set_recipe_id(xsh_instrument *instrument, const char *recipe_id)
Set the recipe_id into the instrument structure.
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
void xsh_instrument_set_lamp(xsh_instrument *i, XSH_LAMP lamp)
Set a lamp on instrument structure.
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
void xsh_instrument_set_decode_bp(xsh_instrument *i, const int decode_bp)
Set bad pixel code.
#define xsh_msg(...)
Print a message on info level.
const char * xsh_pfits_get_pcatg(const cpl_propertylist *plist)
find out the pcatg
double xsh_pfits_get_qc_mbiasavg(const cpl_propertylist *plist)
find out the QC.MBIASAVG value
double xsh_pfits_get_qc_mbiasrms(const cpl_propertylist *plist)
find out the QC.MBIASRMS value
double xsh_pfits_get_qc_mbiasmed(const cpl_propertylist *plist)
find out the QC.MBIASMED value
cpl_frame * xsh_remove_crh_multiple(cpl_frameset *rawFrames, const char *name, xsh_stack_param *stack_param, xsh_clipping_param *crh_clipping, xsh_instrument *inst, cpl_imagelist **, cpl_image **, const int save_tmp)
void xsh_free_parameterlist(cpl_parameterlist **p)
Deallocate a parameter list and set the pointer to NULL.
void xsh_free_image(cpl_image **i)
Deallocate an image and set the pointer to NULL.
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
void xsh_free_temporary_files(void)
Free temprary files list.
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
#define TESTS_CLEAN_WORKSPACE(DRL_ID)
#define TESTS_INIT_WORKSPACE(DRL_ID)
#define XSH_FLOAT_PRECISION
#define TESTS_INIT(DRL_ID)
cpl_frame * xsh_frame_product(const char *fname, const char *tag, cpl_frame_type type, cpl_frame_group group, cpl_frame_level level)
Creates a frame with given characteristics.
#define XSH_MASTER_BIAS_UVB
#define XSH_GET_TAG_FROM_ARM(TAG, instr)
void xsh_parameters_ron_create(const char *recipe_id, cpl_parameterlist *list, xsh_ron_param p)
create the RON determination parameters in a parameters list
void xsh_parameters_hot_cold_pix_create(const char *recipe_id, cpl_parameterlist *list, xsh_hot_cold_pix_param p)
create the crh clipping parameters in a parameters list
void xsh_parameters_clipping_crh_create(const char *recipe_id, cpl_parameterlist *list, xsh_clipping_param p)
create the crh clipping parameters in a parameters list
void xsh_parameters_fpn_create(const char *recipe_id, cpl_parameterlist *list, xsh_fpn_param p)
create the FPN parameters in a parameters list
void xsh_parameters_struct_create(const char *recipe_id, cpl_parameterlist *list, xsh_struct_param p)
create the structX/Y region definition parameters in a parameters list
void xsh_parameters_generic(const char *recipe_id, cpl_parameterlist *plist)