MOONS Pipeline Reference Manual 0.13.1
Functions
Moons data reduction

Functions

cpl_error_code moo_apply_flat (moo_ext *ext, moo_ext *flat, moo_f2f *f2f)
 Divide spectra by 1D flat-field.
 
cpl_error_code moo_apply_p2p (moo_det *flat, moo_det *p2pmap)
 Divide DET by the pixel-to-pixel variation map.
 
cpl_error_code moo_calib_flux (moo_rbn *rbn, moo_atm *atm, moo_resp *resp)
 Apply the relative flux calibration to 1D rebinned spectra.
 
moo_sci * moo_coadd (moo_scilist *scilist, moo_coadd_params *params, const char *filename)
 Co-add reduced science frames in SCI format.
 
moo_sci * moo_combine_pair (moo_rbn *nod_rbn, moo_rbn *sky_rbn, moo_rbn *obj_rbn, moo_target_table *target_table, moo_f2f *f2f, const cpl_frame *solflux_frame, const cpl_frame *airglow_group_frame, const cpl_frame *airglow_var_frame, moo_combine_pair_params *combine_pair_params, moo_sub_sky_stare_params *sky_params, const char *filename, moo_products *products, const cpl_frame *ref_frame)
 Combine the extracted spectra from a same objec.
 
moo_rbn * moo_combine_sky (moo_rbnlist *rbnlist)
 Combine RBN sky frames.
 
moo_f2f * moo_compute_fibtrans (moo_ext *ext, moo_compute_fibtrans_params *params, const char *filename)
 Computes fibre-to-fibre relative transmission table.
 
cpl_error_code moo_reproject_model (moo_det *flat1, moo_loc *loc1, moo_psf *model_flat1, const char *filename)
 Reporject a model on detector.
 
moo_det * moo_compute_p2p (moo_det *flat1, moo_loc *loc1, moo_psf *model_flat1, moo_det *flat2, moo_loc *loc2, moo_psf *model_flat2)
 To compute pixel-to-pixel variation map.
 
moo_resp * moo_compute_resp (moo_scilist *scilist, moo_atm *atm, moo_flx *flx, moo_compute_resp_params *params)
 Compute instrumental response.
 
float * moo_compute_slitoffset (moo_det *det, moo_loc *loc, moo_compute_slitoffset_params *params)
 Compute slit offset in LOC.
 
cpl_error_code moo_correct_tell (moo_rbn *rbn, moo_telluric *tell)
 Apply the telluric correction to 1D rebinned spectra.
 
cpl_error_code moo_correct_tell_science (moo_sci *sci, moo_telluric *tell)
 Apply the telluric correction to SCI.
 
cpl_error_code moo_create_s1d (cpl_frame *sci_frame, moo_create_s1d_params *params, const char *tag, moo_products *products)
 Apply the telluric correction to SCI.
 
cpl_error_code moo_correct_bias (moo_det *det, const cpl_frame *masterbias_frame, moo_correct_bias_params *params)
 Subtracts the Master Bias frame from a DET frame.
 
cpl_error_code moo_correct_dark (moo_det *det, moo_det *detoff, const cpl_frame *masterDarkVis, const cpl_frame *masterDarkNir)
 Subtracts the master dark frame from a frame after scaling for exposure time (RI). Subtract OFF frame from ON frame (YJ, H)
 
cpl_error_code moo_correct_detlin (moo_det *det, const cpl_frame *cube_frame)
 Apply the detector linearity correction.
 
cpl_error_code moo_single_compute_noise_map (moo_single *single, moo_nos_params *params, cpl_imagelist *list, cpl_imagelist *qlist)
 Calculates the noisey bad pixel mask for one extension.
 
cpl_error_code moo_compute_noise_map (moo_det *det, moo_detlist *darkList, moo_masklist *cosmiclist, moo_nos_params *params)
 Calculates the noisey bad pixel mask.
 
cpl_error_code moo_compute_hot_map (moo_det *det, moo_hot_params *params)
 Calculates the hot bad pixel mask.
 
moo_ext * moo_extract (moo_det *det, moo_loc *loc, moo_psf *master_flat, moo_extract_params *params, const char *filename)
 extract the 1D spectrum of fibres
 
cpl_error_code moo_flat_shift_compute (moo_det *det, moo_loc *ff_trace)
 Compute the shift between FF_TRACE and FLAT.
 
moo_loc * moo_localise (moo_det *det, const cpl_frame *guess_loc, moo_localise_params *params, const char *locname)
 To localise the centroid of fibre spectrum on frames.
 
moo_psf * moo_model_flat (moo_det *det, moo_loc *loc, moo_model_flat_params *params, const char *filename)
 To extract 2D FF and model it, resulting MASTER_FLAT.
 
moo_molectable * moo_molecfit_model (const cpl_frame *sci_frame, const char *modename, const cpl_frame *molecule_frame, const cpl_frame *winc_frame, moo_molectable **pmt_atm_fitted, moo_molectable **best_fitted_model, moo_molecfit_model_params *params)
 Apply the relative flux calibration to 1D rebinned spectra.
 
moo_telluric * moo_molecfit_calctrans (const cpl_frame *rbn_frame, const char *modename, const cpl_frame *molecules_frame, const cpl_frame *atm_frame, const cpl_frame *best_fit_frame, const cpl_frame *kernel_lib_frame, moo_molecfit_calctrans_params *params)
 Apply the molcecfit calctrans to the RBN to compute telle telluric correction.
 
moo_det * moo_prepare (const cpl_frame *rawframe, const char *const badpixmask_rp, const char *const badpixmask_nl, const cpl_frame *masterbias, const cpl_frame *cube_frame, moo_prepare_params *params)
 This function transforms RAW frames in DET frames attaching the default bad pixel map and an error image.
 
moo_det * moo_prepare_adu (const cpl_frame *rawframe, const char *const badpixmask_rp, moo_prepare_params *params)
 This function transforms RAW frames in DET ADU frames attaching the default bad pixel.
 
moo_rbn * moo_rebin (moo_ext *ext, moo_map *wmap, moo_spectral_format *sformat, moo_rebin_params *params, const char *filename)
 Rebin an EXT spectra in RBN format.
 
moo_det * moo_remove_CRH (moo_detlist *detlist, moo_masklist *cosmiclist, moo_crh_params *params)
 Remove CRH in single frames or in a combination of multiple frames.
 
cpl_array * moo_select_sky (const char *targname, int indextarg, int obj_index, double obj_targalpha, double obj_targdelta, cpl_table *target_table, const char *index_colname, cpl_table *sky_stare_table, moo_detector_type type, int maxdistslit, double mintrans, int min_sky, double radius, double step_r, int target_table_idx, moo_f2f *f2f, cpl_array *allsky_indexes)
 This function selects sky fibres around a target object.
 
moo_sci * moo_sub_sky_stare (moo_rbn *obja_rbn, moo_target_table *target_table, moo_rbn *objb_rbn, moo_f2f *f2f, const cpl_frame *solflux_frame, const cpl_frame *airglow_group_frame, const cpl_frame *airglow_var_frame, moo_sub_sky_stare_params *params, const char *filename, int ispaired)
 This function subtracts the sky in wavelength calibrated and extracted science frames obtain in Stare mode observations.
 
moo_det * moo_subtract_nod (moo_det *object, moo_det *sky, const char *filename)
 Sky from object subtraction.
 
moo_map * moo_wavesol (moo_ext *arc_ext, const char *lineCatname, moo_spectral_format *sformat, moo_loc *loc, moo_map *wmap, moo_wavesol_params *params)
 Computes the wavelength solution from 1D extracted arc spectra.
 

Detailed Description

Function Documentation

◆ moo_apply_flat()

cpl_error_code moo_apply_flat ( moo_ext *  ext,
moo_ext *  flat,
moo_f2f *  f2f 
)

Divide spectra by 1D flat-field.

Parameters
extEXT extracted to flatfield
flatEXT extracted flatfield
f2ffibre-to-fibre relative transmission table
Returns
cpl_error_code or CPL_ERROR_NONE

This function performs a simple division by a flat field.

Bad pixels flags:

  • BADPIX_CALIB_DEFECT where division failed.

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 182 of file moo_apply_flat.c.

References MOO_BADPIX_LOW_QE, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_detector_get_extname(), moo_ext_get_fibre_table(), moo_ext_load_single(), moo_f2f_get_trans(), moo_f2f_order_by_index(), moo_fibres_table_add_f2f_cols(), and moo_fibres_table_get_spectro_index().

◆ moo_apply_p2p()

cpl_error_code moo_apply_p2p ( moo_det *  flat,
moo_det *  p2pmap 
)

Divide DET by the pixel-to-pixel variation map.

Parameters
flatDET which is divided
p2pmapDET pixel to pixel variation map
Returns
cpl_error_code or CPL_ERROR_NONE

This function performs a simple division by a P2P map.

Bad pixels flags:

  • BADPIX_CALIB_DEFECT where division failed.

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 122 of file moo_apply_p2p.c.

References MOO_BADPIX_GOOD, moo_det_get_primary_header(), moo_det_load_single(), moo_detector_get_extname(), and moo_qc_set_is_p2pcor().

◆ moo_calib_flux()

cpl_error_code moo_calib_flux ( moo_rbn *  rbn,
moo_atm *  atm,
moo_resp *  resp 
)

Apply the relative flux calibration to 1D rebinned spectra.

Parameters
rbnRBN spectra
atmAtmospheric extinction table
respInstrumental response
Returns
Flux calibrated frame

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 143 of file moo_calib_flux.c.

References MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_pfits_get_cd1_1(), moo_pfits_get_crpix1(), moo_pfits_get_crval1(), moo_pfits_get_dit(), moo_pfits_get_exptime(), moo_pfits_get_ndit(), moo_pfits_get_tel_airm_end(), moo_pfits_get_tel_airm_start(), moo_rbn_get_fibre_table(), moo_rbn_get_primary_header(), moo_rbn_load_single(), moo_rbn_single_get_header(), moo_rbn_single_get_image(), moo_resp_get_colname(), and moo_resp_get_table().

◆ moo_coadd()

moo_sci * moo_coadd ( moo_scilist *  scilist,
moo_coadd_params *  params,
const char *  filename 
)

Co-add reduced science frames in SCI format.

Parameters
scilistList of SCI files
paramscoadd params
filenamename of result file
Returns
the SCI result

_Flags considered as bad : BADPIX_COSMETIC | BADPIX_HOT

Bad pixels flags:

  • BADPIX_COSMIC_UNREMOVED is set in SIGCLIP mode

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the SCI list have a size

Definition at line 134 of file moo_coadd.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_fits_create(), moo_imagelist_collapse_bitwiseor(), moo_pfits_update_ncoadd(), moo_sci_add_single(), moo_sci_add_target_table(), moo_sci_create(), moo_sci_delete(), moo_sci_get_single(), moo_sci_get_target_table(), moo_sci_new(), moo_sci_save(), moo_sci_single_get_header(), moo_sci_single_get_image(), moo_sci_single_get_qual(), moo_sci_single_get_sky(), moo_sci_single_new(), moo_scilist_get(), moo_scilist_get_single(), moo_scilist_get_size(), moo_scilist_load_single(), moo_target_table_find_index(), moo_target_table_find_target(), and moo_target_table_remove_coadd_cols().

◆ moo_combine_pair()

moo_sci * moo_combine_pair ( moo_rbn *  nod_rbn,
moo_rbn *  sky_rbn,
moo_rbn *  obj_rbn,
moo_target_table target_table,
moo_f2f *  f2f,
const cpl_frame *  solflux_frame,
const cpl_frame *  airglow_group_frame,
const cpl_frame *  airglow_var_frame,
moo_combine_pair_params *  combine_pair_params,
moo_sub_sky_stare_params *  sky_params,
const char *  filename,
moo_products *  products,
const cpl_frame *  ref_frame 
)

Combine the extracted spectra from a same objec.

Parameters
nod_rbn_RBN Wavelength calibrated science spectra from NOD
sky_rbn_RBN Wavelength calibrated science spectra from SKY
obj_rbn_RBN Wavelength calibrated science spectra from OBJECT
target_tableTARGET_TABLE Attached target table
f2fF2F fibre to fibre table
solflux_framethe monthly averages of solar radio flux at 10.7 cm frame
airglow_group_framethe airglow line list frame (use in subsky)
airglow_var_framethe airglow scaling parameters frame (use in subsky)
combine_pair_paramsthe combine pair parameters
sky_paramsthe sub sky stare parameters
filenamethe SCI filename
productsthe product structure to save file
ref_framethe reference frame to produce product KW
Returns
the SCI result

_Flags considered as bad : MOO_BADPIX_OUTSIDE_DATA_RANGE, MOO_BADPIX_CALIB_DEFECT

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 802 of file moo_combine_pair.c.

References moo_products_add_sci(), moo_sci_delete(), moo_sci_save(), and moo_sub_sky_stare().

◆ moo_combine_sky()

moo_rbn * moo_combine_sky ( moo_rbnlist *  rbnlist)

Combine RBN sky frames.

Parameters
rbnlistlist of RBN frames
Returns
the RBN result

_Flags considered as bad : BADPIX_COSMETIC

Bad pixels flags:

  • BADPIX_COSMIC_UNREMOVED is set in SIGCLIP mode

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if RBN list size is lower or equal to zero

Definition at line 208 of file moo_combine_sky.c.

References MOO_BADPIX_GOOD, moo_qc_set_ncom(), moo_rbn_delete(), moo_rbn_get_fibre_table(), moo_rbn_new(), and moo_rbnlist_get().

◆ moo_compute_fibtrans()

moo_f2f * moo_compute_fibtrans ( moo_ext *  ext,
moo_compute_fibtrans_params *  params,
const char *  filename 
)

Computes fibre-to-fibre relative transmission table.

Parameters
extEXT spectra from which computes transmission
paramsfibre transmission parameters
filenamename of the result F2F
Returns
the result F2F

The function expects as input flat-field data obtained with a uniformly illuminated field of view. Then it decouples the relative intensity and the shape of the extracted flat-field spectra into a fibre-to-fibre relative transmission table and a normalised extracted Flat-field respectively.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if an input pointer is NULL

Definition at line 193 of file moo_compute_fibtrans.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_COSMETIC, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_detector_get_extname(), moo_ext_get_fibre_table(), moo_ext_load_single(), moo_f2f_create(), moo_f2f_delete(), and moo_f2f_set_trans().

◆ moo_compute_hot_map()

cpl_error_code moo_compute_hot_map ( moo_det *  det,
moo_hot_params *  params 
)

Calculates the hot bad pixel mask.

Parameters
detDET Average dark frame
paramshot map parameters
Returns
the error code

This function searches for hot bad pixels in a master dark frame by applying an iterative kappa-sigma clipping algorithm. The QUAL extension of det frame is updated.

Bad pixels flags:

  • BADPIX_HOT

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 830 of file moo_drl.c.

References MOO_BADPIX_COSMETIC, MOO_BADPIX_COSMIC_UNREMOVED, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), and moo_detector_get_extname().

◆ moo_compute_noise_map()

cpl_error_code moo_compute_noise_map ( moo_det *  det,
moo_detlist *  darkList,
moo_masklist *  cosmiclist,
moo_nos_params *  params 
)

Calculates the noisey bad pixel mask.

Parameters
detDET Average dark frame
darkListseries of individual DET dark frames
cosmiclistseries of individual MASK of dark frames
paramsnoise map parameters
Returns
the error code

This function searches for static bad pixels in stacks of dark frames taken with equal exposure times. The noise in each pixel stack is computed and compared to the mean noise and a pixel is declared bad if the deviation exceeds nos-clip-sigma. The QUAL extension of det frame is updated.

_Flags considered as bad : BADPIX_COSMETIC | BADPIX_COSMIC_UNREMOVED | BADPIX_HOT

Bad pixels flags:

  • BADPIX_NOISY

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the frame is darkList size < 3
  • CPL_ERROR_ILLEGAL_INPUT if the frame is not tagged has MASTER BIAS

Definition at line 629 of file moo_drl.c.

References MOO_BADPIX_COSMETIC, MOO_BADPIX_COSMIC_UNREMOVED, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), moo_detlist_free_single(), moo_detlist_get_single_data(), moo_detlist_get_single_qual(), moo_detlist_get_size(), moo_detlist_load_single(), moo_mask_get(), moo_mask_to_badpix(), moo_masklist_get(), and moo_single_compute_noise_map().

◆ moo_compute_p2p()

moo_det * moo_compute_p2p ( moo_det *  flat1,
moo_loc *  loc1,
moo_psf *  model_flat1,
moo_det *  flat2,
moo_loc *  loc2,
moo_psf *  model_flat2 
)

To compute pixel-to-pixel variation map.

Parameters
flat1DET first flat field
loc1LOC localisation of the first flat field
model_flat1PSF model of the first flat field
flat2DET second flat field
loc2LOC localisation of the second flat field
model_flat2PSF model of the second flat field
Returns
DET the pixel to pixel variation map

The function co-adds two preprocessed flat-field frames at two slit positions is order to increase the illumination coverage of the detectors, and it co-adds as well the corresponding modeled FFs. Then it derives the pixel-to-pixel variation map.

Bad pixels flags:

  • BADPIX_CALIB_DEFECT

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if first localisation has not a fibres table

Definition at line 398 of file moo_compute_p2p.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_LOW_QE, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_delete(), moo_det_load_single(), moo_det_new(), moo_detector_get_extname(), moo_fits_create(), moo_fits_write_extension_image(), moo_loc_get_fibre_table(), moo_loc_get_single(), and moo_psf_get_single().

◆ moo_compute_resp()

moo_resp * moo_compute_resp ( moo_scilist *  scilist,
moo_atm *  atm,
moo_flx flx,
moo_compute_resp_params *  params 
)

Compute instrumental response.

Parameters
scilistList of sky subtracted spectra of the standard star
atmAtmospheric extinction table
flxStandard star flux table
paramsCompute response parameters
Returns
the response

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the SCI list have a size

Definition at line 257 of file moo_compute_resp.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_COSMETIC, MOO_BADPIX_HOT, MOO_BADPIX_LOW_QE, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_median_filter(), moo_pfits_get_cd1_1(), moo_pfits_get_tel_airm_end(), moo_pfits_get_tel_airm_start(), moo_resp_create(), moo_resp_get_table(), moo_sci_get_single(), moo_sci_get_target_table(), moo_sci_single_get_header(), moo_scilist_get(), moo_scilist_get_size(), and moo_target_table_find_index().

◆ moo_compute_slitoffset()

float * moo_compute_slitoffset ( moo_det *  det,
moo_loc *  loc,
moo_compute_slitoffset_params *  params 
)

Compute slit offset in LOC.

Parameters
detthe DET frame
locthe LOC frame
paramsthe compute slit offset parameters
Returns
the slit offset by detector

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 197 of file moo_compute_slitoffset.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_COSMETIC, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), and moo_loc_get_single().

◆ moo_correct_bias()

cpl_error_code moo_correct_bias ( moo_det *  det,
const cpl_frame *  masterbias_frame,
moo_correct_bias_params *  params 
)

Subtracts the Master Bias frame from a DET frame.

Parameters
detDET frame to subtract
masterbias_framethe Master bias frame
paramscorrect bias parameters
Returns
the error code

This function applies to the RI extensions, it is applied to frames in basic calibration recipes and to frames used in science reduction in stare mode. The Master Bias extensions are simply subtracted from the corresponding extensions in the input Frame, taking into account the associated Bad Pixel Map extensions. The output frame is an image with associated bad pixel map and statistical errors. The output bad pixel maps are the combination of the input ones.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the frame is not tagged has MASTER BIAS

Definition at line 86 of file moo_drl.c.

References MOO_BADPIX_GOOD, moo_det_create(), moo_det_delete(), moo_det_load_single(), moo_single_get_image(), moo_single_get_qual(), and MOO_TYPE_RI.

◆ moo_correct_dark()

cpl_error_code moo_correct_dark ( moo_det *  det,
moo_det *  detoff,
const cpl_frame *  masterDarkVis,
const cpl_frame *  masterDarkNir 
)

Subtracts the master dark frame from a frame after scaling for exposure time (RI). Subtract OFF frame from ON frame (YJ, H)

Parameters
detDET structure to subtract
detoffcorresponding DET Off structure or NULL
masterDarkVisMaster dark frame for optical detectors
masterDarkNirMaster dark frame for IR detectors or NULL
Returns
the error code

The input frame is corrected for dark current using the Master Dark frame and accounting for its associated Bad Pixel Mask darkbpixmask which identifies pixels where the dark current is far above the average. In RI extensions the Master Dark is scaled according to the exposure time and subtracted from the input frame. The bad pixel masks are combined and propagated. In YJ and H extensions, the OFF frame or the master dark (IR) is subtracted from the ON frame and the bad pixel masks are combined and propagated.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the frame is not tagged has MASTER DARK_VIS

Definition at line 250 of file moo_drl.c.

References MOO_BADPIX_GOOD, moo_det_create(), moo_det_delete(), moo_det_get_single(), moo_det_load_single(), moo_detector_get_extname(), moo_pfits_get_exptime(), moo_single_get_image(), moo_single_sub(), MOO_TYPE_H, MOO_TYPE_RI, and MOO_TYPE_YJ.

◆ moo_correct_detlin()

cpl_error_code moo_correct_detlin ( moo_det *  det,
const cpl_frame *  cube_frame 
)

Apply the detector linearity correction.

Parameters
detDET frame to correct
cube_framecube coefficients to appply linearity correction by pixel
Returns
the error code

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the frame of COEFF is invalid

Definition at line 507 of file moo_drl.c.

References MOO_BADPIX_GOOD, moo_cube_delete(), moo_det_get_primary_header(), moo_det_load_single(), and moo_qc_set_is_linearcor().

Referenced by moo_prepare().

◆ moo_correct_tell()

cpl_error_code moo_correct_tell ( moo_rbn *  rbn,
moo_telluric *  tell 
)

Apply the telluric correction to 1D rebinned spectra.

Parameters
rbnRBN specta
tellTELLURIC correction
Returns
Flux calibrated frame

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 124 of file moo_correct_tell.c.

References MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_pfits_get_cd1_1(), moo_pfits_get_crpix1(), moo_pfits_get_crval1(), moo_rbn_get_fibre_table(), moo_rbn_get_primary_header(), moo_rbn_load_single(), moo_rbn_single_get_header(), moo_rbn_single_get_image(), moo_telluric_get_band(), moo_telluric_get_image(), and moo_telluric_get_index().

◆ moo_correct_tell_science()

cpl_error_code moo_correct_tell_science ( moo_sci *  sci,
moo_telluric *  tell 
)

Apply the telluric correction to SCI.

Parameters
scisky Input wavelength calibrated, sky corrected frame
telltelluric corerction
Returns
the error code

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 246 of file moo_correct_tell.c.

References MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_pfits_get_cd1_1(), moo_pfits_get_crpix1(), moo_pfits_get_crval1(), moo_sci_get_target_table(), moo_sci_load_single(), moo_sci_single_get_header(), moo_sci_single_get_image(), moo_telluric_get_band(), moo_telluric_get_image(), and moo_telluric_get_index().

◆ moo_create_s1d()

cpl_error_code moo_create_s1d ( cpl_frame *  sci_frame,
moo_create_s1d_params *  params,
const char *  tag,
moo_products *  products 
)

Apply the telluric correction to SCI.

Parameters
sci_frameInput wavelength calibrated, sky corrected frame
paramsParameters od create_s1d
tagThe S1D associated tag
productsthe saving products structure
Returns
the error code

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 177 of file moo_create_s1d.c.

References MOO_BADPIX_GOOD, moo_products_add_s1d(), moo_s1d_delete(), moo_s1d_save(), moo_sci_create(), moo_sci_delete(), moo_sci_get_single(), moo_sci_get_target_table(), moo_sci_load_single(), and moo_target_table_get_exptime().

◆ moo_extract()

moo_ext * moo_extract ( moo_det *  det,
moo_loc *  loc,
moo_psf *  master_flat,
moo_extract_params *  params,
const char *  filename 
)

extract the 1D spectrum of fibres

Parameters
detDET frame to extract
locLOC localisation of the fibres
master_flatPSF the master flat or NULL
paramsthe extraction parameters
filenamethe file name for the result
Returns
the EXT spectra

This function is to extract fibre spectra into 1D with two different methods defined by extract-method: “sum” or “optimal”. The latter will request the MasterFlat input, in order to use the fibre profiles along the slit.

Bad pixels flags:

  • BADPIX_OUTSIDE_DATA_RANGE

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the localisation fibres table is NULL

Definition at line 523 of file moo_extract.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_COSMETIC, MOO_BADPIX_GOOD, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_get_fibre_table(), moo_det_load_single(), moo_detector_get_extname(), moo_ext_add_fibre_table(), moo_ext_add_single(), moo_ext_delete(), moo_ext_new(), moo_fibres_table_add_extract_cols(), moo_fibres_table_by_index(), moo_fibres_table_get_spectro_indexext(), moo_fits_create(), moo_loc_get_fibre_table(), moo_loc_get_single(), and moo_psf_get_single().

◆ moo_flat_shift_compute()

cpl_error_code moo_flat_shift_compute ( moo_det *  det,
moo_loc *  ff_trace 
)

Compute the shift between FF_TRACE and FLAT.

Parameters
detDET frame to analyse
ff_tracethe given FF_TRACE

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if DET has not a fibre table

Definition at line 174 of file moo_flat_shift_compute.c.

References MOO_BADPIX_COSMETIC, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), moo_detector_get_extname(), and moo_loc_get_single().

◆ moo_localise()

moo_loc * moo_localise ( moo_det *  det,
const cpl_frame *  guess_loc,
moo_localise_params *  params,
const char *  locname 
)

To localise the centroid of fibre spectrum on frames.

END CREATE_GUESS

Parameters
detDET frame to localize
guess_locFF_TRACE_GUESS frame or NULL
paramsthe localisation parameters
locnamethe file name of the result
Returns
the FF_TRACE or NULL in error case

This function is to find the localisation of the centroid of each fibre spectrum on CCD Frame, then generate the FF_TRACE. It is able be excuted in two cases:

  1. construct the FF_TRACE from scratch
  2. construct the FF_TRACE based on user input FF_TRACE_GUESS _Flags considered as bad :BADPIX_COSMETIC | BADPIX_HOT

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if DET has not a fibre table

Definition at line 3093 of file moo_localise.c.

References MOO_BADPIX_COSMETIC, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_loc_delete(), and moo_loc_load().

◆ moo_model_flat()

moo_psf * moo_model_flat ( moo_det *  det,
moo_loc *  loc,
moo_model_flat_params *  params,
const char *  filename 
)

To extract 2D FF and model it, resulting MASTER_FLAT.

Parameters
detDET frame to extract
locLOC localisation of the fibres
paramsthe model flat parameters
filenamethe name of the result
Returns
the PSF model flat

This function is to model the extracted FF, and resultsing a modelled FF, i.e., the MasterFlat.

_Flags considered as bad : BADPIX_COSMETIC | BADPIX_HOT

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the LOC file has not a fibre table

Definition at line 1546 of file moo_model_flat.c.

References MOO_BADPIX_COSMETIC, MOO_BADPIX_HOT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), moo_detector_get_extname(), moo_loc_get_fibre_table(), moo_loc_get_single(), moo_psf_add_single(), and moo_psf_create().

◆ moo_molecfit_calctrans()

moo_telluric * moo_molecfit_calctrans ( const cpl_frame *  rbn_frame,
const char *  modename,
const cpl_frame *  molecules_frame,
const cpl_frame *  atm_frame,
const cpl_frame *  best_fit_frame,
const cpl_frame *  kernel_lib_frame,
moo_molecfit_calctrans_params *  params 
)

Apply the molcecfit calctrans to the RBN to compute telle telluric correction.

Parameters
rbn_frameThe RBN SPECTRA
modenamemode LR or HR
molecules_frameThe MOLECULES frame
atm_framethe ATM frame (from model)
best_fit_framethe BEST_FIT frame (from model)
kernel_lib_framethe KERNEL frame
paramsthe calctrans parameters
Returns
Flux calibrated frame

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 1428 of file moo_molecfit.c.

References MOO_BADPIX_GOOD, moo_kernel_delete(), moo_kernel_get_header(), moo_kernel_get_matrix(), moo_kernel_load(), moo_molectable_delete(), moo_molectable_get_data(), moo_molectable_load(), moo_molectable_new(), moo_pfits_get_cd1_1(), moo_pfits_get_crpix1(), moo_pfits_get_crval1(), moo_rbn_create(), moo_rbn_delete(), moo_rbn_get_fibre_table(), moo_rbn_get_single(), moo_rbn_single_get_header(), moo_rbn_single_get_image(), moo_rbn_single_load(), MOO_TELLURIC_EXT_RI, moo_telluric_new(), and moo_telluric_set_image().

◆ moo_molecfit_model()

moo_molectable * moo_molecfit_model ( const cpl_frame *  sci_frame,
const char *  modename,
const cpl_frame *  molecule_frame,
const cpl_frame *  winc_frame,
moo_molectable **  pmt_atm_fitted,
moo_molectable **  best_fitted_model,
moo_molecfit_model_params *  params 
)

Apply the relative flux calibration to 1D rebinned spectra.

Parameters
sci_framethe sky Input wavelength calibrated, sky corrected frame
modenamethe instrument mode (LR or HR)
molecule_framethe MOLECULE frame
winc_framethe WAVE_INCLUDE frame
pmt_atm_fittedThe ATM fitted result
best_fitted_modelThe BEST FITTED model result
paramsthe molecfit model parameters
Returns
The best fitted parameters result

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 1158 of file moo_molecfit.c.

References MOO_BADPIX_GOOD, moo_detector_get_name(), moo_molectable_delete(), moo_molectable_get_data(), moo_molectable_load(), moo_molectable_new(), moo_molectable_set_data(), moo_pfits_get_cd1_1(), moo_pfits_get_crpix1(), moo_pfits_get_crval1(), moo_sci_create(), moo_sci_delete(), moo_sci_get_single(), moo_sci_single_get_header(), moo_sci_single_get_image(), and moo_sci_single_load().

◆ moo_prepare()

moo_det * moo_prepare ( const cpl_frame *  rawframe,
const char *const  badpixmask_rp,
const char *const  badpixmask_nl,
const cpl_frame *  masterbias,
const cpl_frame *  cube_frame,
moo_prepare_params *  params 
)

This function transforms RAW frames in DET frames attaching the default bad pixel map and an error image.

Parameters
rawframethe RAW cpl frame to prepare
badpixmask_rpthe filename of the bad pixel mask RP or NULL
badpixmask_nlthe filename of the bad pixel mask NL or NULL
masterbiasthe MASTER_BIAS frame or NULL if not
cube_framethe LINEARITY_COEFF_CUBE frame or NULL if no correction
paramsthe prepare parameters
Returns
the DET corresponding to the given raw files

This function is placed at the beginning of every recipe, it transforms an input RAW frame in a DET frame attaching to it additional extensions: a bad pixel map, and an error image for each detector extension. The bad pixel map is the default one or a zero image if the default map does not exist. The error image is built summing the Read Out Noise and the shot noise.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if raw frame is not from GROUP RAW

Definition at line 324 of file moo_prepare.c.

References moo_correct_detlin(), moo_det_delete(), moo_det_get_single(), moo_det_save(), moo_detector_get_extname(), and moo_prepare_adu().

◆ moo_prepare_adu()

moo_det * moo_prepare_adu ( const cpl_frame *  rawframe,
const char *const  badpixmask_rp,
moo_prepare_params *  params 
)

This function transforms RAW frames in DET ADU frames attaching the default bad pixel.

Parameters
rawframethe RAW cpl frame to prepare
badpixmask_rpthe filename of the bad pixel mask RP or NULL
paramsthe prepare parameters
Returns
the DET corresponding to the given raw files

This function is placed at the beginning of every recipe, it transforms an input RAW frame in a DET frame attaching to it additional extensions: a bad pixel map, and an error image for each detector extension. The bad pixel map is the default one or a zero image if the default map does not exist. The error image is built summing the Read Out Noise and the shot noise.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if raw frame is not from GROUP RAW

Definition at line 430 of file moo_prepare.c.

References moo_det_create(), moo_det_delete(), moo_det_get_single(), moo_det_save(), moo_detector_get_extname(), moo_pfits_get_det_chip_live(), and moo_pfits_get_live().

Referenced by moo_prepare().

◆ moo_rebin()

moo_rbn * moo_rebin ( moo_ext *  ext,
moo_map *  wmap,
moo_spectral_format *  sformat,
moo_rebin_params *  params,
const char *  filename 
)

Rebin an EXT spectra in RBN format.

Parameters
extEXT Extracted 1D spectra
wmapEXT Wave map
sformatthe spectral format
paramsthe rebin parameters
filenamethe file name for the result
Returns
the RBN spectra

This function rebin the extracted spectra.

Bad pixels flags:

  • BADPIX_OUTSIDE_DATA_RANGE

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 783 of file moo_rebin.c.

References MOO_BADPIX_GOOD, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_detector_get_name(), moo_ext_get_fibre_table(), moo_ext_load_single(), moo_fibres_table_add_rebin_cols(), moo_fibres_table_get_spectro_indexext(), moo_fits_create(), moo_rbn_add_fibre_table(), moo_rbn_add_single(), moo_rbn_delete(), moo_rbn_new(), moo_rbn_single_delete(), moo_rbn_single_get_data(), moo_rbn_single_get_errs(), moo_rbn_single_new(), moo_rbn_single_set_wcs1(), moo_spectral_format_get(), moo_spectral_format_get_wave_range(), moo_spectral_format_info_delete(), and moo_table_and_selected_sequal_string().

◆ moo_remove_CRH()

moo_det * moo_remove_CRH ( moo_detlist *  detlist,
moo_masklist *  cosmiclist,
moo_crh_params *  params 
)

Remove CRH in single frames or in a combination of multiple frames.

Parameters
detlistlist of DET frames
cosmiclistlist of MASK or NULL
paramsthe remove CRH parameters
Returns
the DET result

The function will behave differently depending on the number of input frames. For now, only multiple input is implemented.

  • With, as input, a series of n (N = n ≥ 3) similar frames in DET format, the function uses the collapse functionalities from HDRL, specified by crh-method. The default value for crh-method will depend on the recipe: “median” in moons_mbias, “sigclip” in moons_mdark
    _Flags considered as bad : BADPIX_COSMETIC

Bad pixels flags:

  • BADPIX_COSMIC_UNREMOVED is set in SIGCLIP mode

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if DET list size is lower or equal to zero

Definition at line 427 of file moo_remove_crh.c.

References MOO_BADPIX_GOOD, moo_det_delete(), moo_det_get_fibre_table(), moo_det_new(), moo_detlist_get(), moo_qc_set_ncom(), moo_qc_set_ncrh_tot(), MOO_TYPE_H, MOO_TYPE_RI, and MOO_TYPE_YJ.

◆ moo_reproject_model()

cpl_error_code moo_reproject_model ( moo_det *  flat1,
moo_loc *  loc1,
moo_psf *  model_flat1,
const char *  filename 
)

Reporject a model on detector.

Parameters
flat1DET first flat field
loc1LOC localisation of the first flat field
model_flat1PSF model of the first flat field
filenamethe name of the produce DET file
Returns
DET the pixel to pixel variation map

Definition at line 232 of file moo_compute_p2p.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_LOW_QE, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_det_load_single(), moo_fits_create(), moo_fits_write_extension_image(), moo_loc_get_fibre_table(), moo_loc_get_single(), and moo_psf_get_single().

◆ moo_select_sky()

cpl_array * moo_select_sky ( const char *  targname,
int  indextarg,
int  obj_index,
double  obj_targalpha,
double  obj_targdelta,
cpl_table *  target_table,
const char *  index_colname,
cpl_table *  sky_stare_table,
moo_detector_type  type,
int  maxdistslit,
double  mintrans,
int  min_sky,
double  radius,
double  step_r,
int  target_table_idx,
moo_f2f *  f2f,
cpl_array *  allsky_indexes 
)

This function selects sky fibres around a target object.

Parameters
targnameName of the target object
indextargIndex of the target in the TARGET_TABLE
obj_indexIndex RBN of the target in the TARGET_TABLE
obj_targalphaAlpha position of the target
obj_targdeltaDelta position of the target
target_tablethe TARGET TABLE
index_colnamethe name of the INDEX column in table
sky_stare_tablethe SKY fibres results table
typethe detector type RI,YJ or H
maxdistslitthe maximum distance on the slit for the sky fibres
mintransthe minimum value of transmission for the sky fibres
min_skythe minimum of sky fibres to find
radiusthe radius around the object position to find the sky fibres
step_rthe step to increase rhe radius to search the sky fibres
f2fthe fibre to fibre transmission
allsky_indexesthe indexes of sky fibres in target_table
Returns
the selected sky indexes
Error code:
  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 122 of file moo_sub_sky_stare.c.

References moo_f2f_get_trans_colname(), moo_select_sky(), and moo_sky_distance().

Referenced by moo_select_sky().

◆ moo_single_compute_noise_map()

cpl_error_code moo_single_compute_noise_map ( moo_single *  single,
moo_nos_params *  params,
cpl_imagelist *  list,
cpl_imagelist *  qlist 
)

Calculates the noisey bad pixel mask for one extension.

Parameters
singleDET single extension
paramsnoise map parameters
listDARK list DATA images
qlistDARK list QUAL images
Returns
the error code

Bad pixels flags:

  • BADPIX_NOISY

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 559 of file moo_drl.c.

References MOO_BADPIX_NOISY, moo_compute_sigma_map(), moo_kappa_sigma_clipping(), moo_single_apply_mask(), and moo_single_get_data().

Referenced by moo_compute_noise_map().

◆ moo_sub_sky_stare()

moo_sci * moo_sub_sky_stare ( moo_rbn *  obja_rbn,
moo_target_table target_table,
moo_rbn *  objb_rbn,
moo_f2f *  f2f,
const cpl_frame *  solflux_frame,
const cpl_frame *  airglow_group_frame,
const cpl_frame *  airglow_var_frame,
moo_sub_sky_stare_params *  params,
const char *  filename,
int  ispaired 
)

This function subtracts the sky in wavelength calibrated and extracted science frames obtain in Stare mode observations.

Parameters
obja_rbnRBN Wavelength calibrated science spectra for object A
target_tableTARGET_TABLE Attached target table
objb_rbnRBN Wavelength calibrated science spectra for object B
f2fthe F2F (fibre to fibre transmission) table
solflux_framethe monthly averages of solar radio flux at 10.7 cm frame
airglow_group_framethe airglow line list frame (use in subsky)
airglow_var_framethe airglow scaling parameters frame (use in subsky)
paramsthe sub sky stare parameters
filenamethe name of the result SCI
ispairedMOO_SCI1D_NOT_PAIRED or MOO_SCI1D_PAIRED
Returns
the SCI result

_Flags considered as bad : BADPIX_COSMETIC | BADPIX_HOT

Bad pixels flags:

  • BADPIX_COSMIC_UNREMOVED is set in SIGCLIP mode

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 810 of file moo_sub_sky_stare.c.

References MOO_BADPIX_CALIB_DEFECT, MOO_BADPIX_OUTSIDE_DATA_RANGE, moo_f2f_order_by_indexrbn(), moo_fits_create(), moo_pfits_get_dit(), moo_pfits_get_exptime(), moo_pfits_get_ndit(), moo_rbn_get_fibre_table(), moo_rbn_get_single(), moo_rbn_load_single(), moo_rbn_single_get_header(), moo_sci_add_single(), moo_sci_add_target_table(), moo_sci_delete(), moo_sci_new(), moo_target_table_duplicate(), moo_target_table_select_obj_index(), moo_target_table_select_sky_index(), and moo_target_table_xswitch_paired().

Referenced by moo_combine_pair().

◆ moo_subtract_nod()

moo_det * moo_subtract_nod ( moo_det *  object,
moo_det *  sky,
const char *  filename 
)

Sky from object subtraction.

Parameters
object[DET] object det file
sky[DET] skt det file
filenamefile name of the new nod DET
Returns
object-sky [DET]

_Flags considered as bad :

Bad pixels flags:


Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if the SCI list have a size

Definition at line 70 of file moo_subtract_nod.c.

References MOO_BADPIX_GOOD, moo_det_create(), moo_det_delete(), moo_det_get_fibre_table(), moo_det_get_primary_header(), moo_det_load(), moo_det_rescale_using_exptime(), moo_det_save(), moo_det_subtract(), moo_fibres_table_add_nod_cols(), and moo_qc_set_frame_raw2().

◆ moo_wavesol()

moo_map * moo_wavesol ( moo_ext *  arc_ext,
const char *  lineCatname,
moo_spectral_format *  sformat,
moo_loc *  loc,
moo_map *  wmap,
moo_wavesol_params *  params 
)

Computes the wavelength solution from 1D extracted arc spectra.

Parameters
arc_extEXT Extracted 1D arc spectra
lineCatnameName of the Line list file
sformatthe SPECTRAL FORMAT
locLOC localization trace
wmapthe WAVE MAP GUESS if a preliminary solution is alrezady computed
paramsthe wavesol parameters
Returns
the EXT spectra

This function computes the wavelength solution. It first determine the (X,Y) positions of a set of arc lines given as input, and then creates a wavelength map for each detector extensions in the input frame.

Bad pixels flags:

  • None

Error code:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 2728 of file moo_wavesol.c.

References moo_map_check().