Rectify Image
[DRL Functions]

Defines

#define SLIT_FRAC_STEP   50

Functions

static double compute_shift_with_localization (cpl_frame *loc_frame, cpl_frame *loc0_frame)
static double compute_shift_with_kw (cpl_propertylist *header, xsh_rectify_param *rectify_par, double **ref_ra, double **ref_dec, int flag)
static cpl_frame * xsh_shift (cpl_frame *rec_frame, xsh_instrument *instrument, const char *fname, double slit_shift, cpl_frame **res_frame_ext)
static void get_errors (float *err, int ix, int iy, int nx, int ny, double radius, float *err_val, int *qual_val)
static void xsh_rec_list_rectify (xsh_rec_list *rec_list, int iorder, int irec, xsh_pre *sci_pre, double fx, double fy, double radius, cpl_vector *profile, double mult, int *good, int *bad, int *out)
static void fill_rectified (xsh_pre *pre_sci, xsh_rec_list *rec_list, int idx, xsh_wavesol *wavesol, xsh_xs_3 *model_config, xsh_instrument *instrument, xsh_dispersol_list *disp_list, float slit_min, float slit_max, double lambda_min, int skip_low, int skip_up, xsh_rectify_param *rectify_par, double slit_shift)
 Fill the rectified structure for one order with the corresponding flux, using the wavelength solution.
void xsh_get_slit_edges (cpl_frame *slitmap_frame, double *sdown, double *sup, double *sldown, double *slup, xsh_instrument *instrument)
 Trace slit edges in a master flat.
void xsh_rec_slit_size (xsh_rectify_param *rectify_par, double *slit_min, int *nslit, XSH_MODE mode)
 rectify frame
static void adjust_lambdas (xsh_spectralformat_list *spec_list, xsh_rectify_param *rectify_par)
static float get_step_slit (float *slit, int nslit)
cpl_frame * xsh_rectify (cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *disp_tab_frame, const char *res_name, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab, const char *rec_prefix)
 Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters. Lambda min and max are taken from the spectralformat list. Slit min/max are hard coded.
cpl_frame * xsh_rectify_and_shift (cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *loc_frame, cpl_frame *loc0_frame, double *throw_shift, cpl_frame *disp_tab_frame, const char *res_name, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab)
cpl_frameset * xsh_rectify_ifu (cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frameset *wavesol_frameset, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *slice_offset_frame, cpl_frame *slitmap_frame, cpl_frameset **rec_frameset_ext, cpl_frameset **rec_frameset_tab, const char *rec_prefix)
cpl_frame * xsh_rectify_orders (cpl_frame *sci_frame, xsh_order_list *orderlist, cpl_frame *wavesol_frame, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *disp_tab_frame, const char *res_name, const char *tag, cpl_frame **res_frame_ext, cpl_frame **res_frame_tab, int min_index, int max_index, double slit_min, int nslit, double slit_shift)
 Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters. Lambda min and max are taken from the spectralformat list. Slit min/max are hard coded. Range orders arve given.
cpl_frameset * xsh_rectify_orders_ifu (cpl_frame *sci_frame, xsh_order_list *orderlist, cpl_frameset *wavesol_frameset, cpl_frame *model_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, cpl_frame *spectralformat_frame, cpl_frame *sliceoffset_frame, cpl_frame *slitmap_frame, cpl_frameset **res_frameset_ext, cpl_frameset **res_frameset_tab, int min_index, int max_index, const char *rec_prefix)
static cpl_frame * shift_with_localization (cpl_frame *rec_frame, cpl_frame *loc_frame, cpl_frame *loc0_frame, xsh_instrument *instrument, const char *fname, cpl_frame **res_frame_ext)
cpl_frame * shift_with_kw (cpl_frame *rec_frame, xsh_instrument *instrument, xsh_rectify_param *rectify_par, const char *fname, cpl_frame **res_frame_ext, double **ref_ra, double **ref_dec, int flag)
 This function creates a structure containing for each order the shift to be applied.
cpl_frame * xsh_shift_rectified (cpl_frame *rec_frame, cpl_frame *loc_frame, cpl_frame *loc0_frame, const char *file_name, xsh_combine_nod_param *combine_nod_param, xsh_rectify_param *rectif_par, xsh_instrument *instrument, cpl_frame **res_frame_ext)

Variables

static cpl_vector * rec_profile = NULL

Detailed Description

Function ...


Define Documentation

#define SLIT_FRAC_STEP   50

Definition at line 76 of file xsh_rectify.c.


Function Documentation

static void adjust_lambdas ( xsh_spectralformat_list spec_list,
xsh_rectify_param rectify_par 
) [static]
static double compute_shift_with_kw ( cpl_propertylist *  header,
xsh_rectify_param rectify_par,
double **  ref_ra,
double **  ref_dec,
int  flag 
) [static]
static double compute_shift_with_localization ( cpl_frame *  loc_frame,
cpl_frame *  loc0_frame 
) [static]

This function creates a structure containing for each order the shift to be applied.

Parameters:
loc_frame Localization of the current rectified frame
loc0_frame Localization of the reference frame (first A frame)

Definition at line 1261 of file xsh_rectify.c.

References xsh_localization::cenpoly, check, XSH_ASSURE_NOT_NULL, xsh_localization_free(), xsh_localization_load(), xsh_msg, and xsh_msg_dbg_medium.

Referenced by xsh_rectify_and_shift().

static void fill_rectified ( xsh_pre pre_sci,
xsh_rec_list rec_list,
int  idx,
xsh_wavesol wavesol,
xsh_xs_3 model_config,
xsh_instrument instrument,
xsh_dispersol_list disp_list,
float  slit_min,
float  slit_max,
double  lambda_min,
int  skip_low,
int  skip_up,
xsh_rectify_param rectify_par,
double  slit_shift 
) [static]

Fill the rectified structure for one order with the corresponding flux, using the wavelength solution.

Parameters:
[in] pre_sci Science Frame (in PRE format)
[in] rec_list Rectified structure pointer (to fill)
[in] idx Index in the rec_list
[in] wavesol Wave Solution structure pointer
[in] model_config model configuration structure
[in] instrument instrument arm structure
[in] disp_list dispersion structure
[in] slit_min min slit value
[in] slit_max max slit value
[in] lambda_min min lambda value
[in] skip_low amount of points to skip on low slice
[in] skip_up amount of points to skip on up slice
[in] rectify_par rectify parameter
[in] slit_shift shift nod position on slit

Definition at line 277 of file xsh_rectify.c.

References xsh_dispersol::absorder, xsh_instrument::binx, xsh_instrument::biny, check, convert_data_to_bin(), xsh_rectify_param::kernel_type, xsh_rec::lambda, xsh_dispersol::lambda_poly, xsh_dispersol_list::list, xsh_rec_list::list, order, rec_profile, xsh_rectify_param::rectif_bin_lambda, xsh_rectify_param::rectif_bin_space, xsh_rectify_param::rectif_radius, xsh_rec::slit, xsh_dispersol::slit_poly, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, xsh_free_polynomial(), xsh_free_vector(), xsh_model_get_xy(), xsh_msg_dbg_low, xsh_rec_list_get_data1(), xsh_rec_list_get_errs1(), xsh_rec_list_get_lambda(), xsh_rec_list_get_nlambda(), xsh_rec_list_get_nslit(), xsh_rec_list_get_order(), xsh_rec_list_get_qual1(), xsh_rec_list_get_slit(), xsh_rec_list_rectify(), xsh_wavesol_eval_polx(), and xsh_wavesol_eval_poly().

Referenced by xsh_rectify_orders().

static void get_errors ( float *  err,
int  ix,
int  iy,
int  nx,
int  ny,
double  radius,
float *  err_val,
int *  qual_val 
) [static]

Definition at line 95 of file xsh_rectify.c.

References n, QFLAG_OUTSIDE_DATA_RANGE, x, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, and y.

Referenced by xsh_rec_list_rectify().

static float get_step_slit ( float *  slit,
int  nslit 
) [static]

Definition at line 639 of file xsh_rectify.c.

References xsh_msg.

Referenced by shift_with_localization().

cpl_frame* shift_with_kw ( cpl_frame *  rec_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
const char *  fname,
cpl_frame **  res_frame_ext,
double **  ref_ra,
double **  ref_dec,
int  flag 
)

This function creates a structure containing for each order the shift to be applied.

Parameters:
[in] rec_frame Science Frame. The kwywords are taken from the header.
[in] instrument Instrument structure
[in] rectify_par Rectification parameters
[in] fname filename
[out] res_frame_ext resampled frame in ESO format
[out] ref_ra RA of reference frame
[out] ref_dec DEG of reference frame
[in] flag flag
Returns:
resampled frame in DRL frame

Definition at line 1523 of file xsh_rectify.c.

References check, compute_shift_with_kw(), XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_propertylist(), xsh_msg, xsh_pfits_get_rectify_bin_space(), xsh_round_double(), and xsh_shift().

Referenced by main(), xsh_nod_rectify_and_shift_with_key(), and xsh_shift_rectified().

static cpl_frame* shift_with_localization ( cpl_frame *  rec_frame,
cpl_frame *  loc_frame,
cpl_frame *  loc0_frame,
xsh_instrument instrument,
const char *  fname,
cpl_frame **  res_frame_ext 
) [static]
void xsh_get_slit_edges ( cpl_frame *  slitmap_frame,
double *  sdown,
double *  sup,
double *  sldown,
double *  slup,
xsh_instrument instrument 
)

Trace slit edges in a master flat.

Parameters:
[in] slitmap_frame slit map frame
[in] sdown down SLIT trace estimate
[in] sup upp SLIT trace estimate
[in] sldown down IFU slice estimate
[in] slup down IFU slice estimate
[in] instrument instrument arm setting

Definition at line 495 of file xsh_rectify.c.

References check, MAX_SLIT, MIN_SLIT, SLITLET_CEN_CENTER, XSH_ASSURE_NOT_NULL, xsh_error_reset, xsh_free_propertylist(), xsh_instrument_get_mode(), XSH_MODE_IFU, xsh_msg, xsh_msg_warning, xsh_pfits_get_slitmap_median_edglo(), xsh_pfits_get_slitmap_median_edgup(), xsh_pfits_get_slitmap_median_sliclo(), and xsh_pfits_get_slitmap_median_slicup().

Referenced by main(), xsh_compute_slice_dist(), xsh_follow_arclines_ifu(), xsh_opt_extract_orders(), and xsh_rectify_orders_ifu().

static void xsh_rec_list_rectify ( xsh_rec_list rec_list,
int  iorder,
int  irec,
xsh_pre sci_pre,
double  fx,
double  fy,
double  radius,
cpl_vector *  profile,
double  mult,
int *  good,
int *  bad,
int *  out 
) [static]
void xsh_rec_slit_size ( xsh_rectify_param rectify_par,
double *  slit_min,
int *  nslit,
XSH_MODE  mode 
)

rectify frame

Parameters:
[in] rectify_par parameters structure to control rectification
[out] slit_min min slit value
[out] nslit number of slit sampling points
[in] mode mode to control if we are in slit mode

Definition at line 581 of file xsh_rectify.c.

References MAX_SLIT, MIN_SLIT, xsh_rectify_param::rectif_bin_space, xsh_rectify_param::rectify_full_slit, slit_step, XSH_ASSURE_NOT_NULL, XSH_MODE_SLIT, xsh_msg, and xsh_msg_warning.

Referenced by main(), xsh_rectify(), and xsh_rectify_and_shift().

cpl_frame* xsh_rectify ( cpl_frame *  sci_frame,
cpl_frame *  orderlist_frame,
cpl_frame *  wavesol_frame,
cpl_frame *  model_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
cpl_frame *  spectralformat_frame,
cpl_frame *  disp_tab_frame,
const char *  res_name,
cpl_frame **  res_frame_ext,
cpl_frame **  res_frame_tab,
const char *  rec_prefix 
)

Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters. Lambda min and max are taken from the spectralformat list. Slit min/max are hard coded.

Parameters:
sci_frame The input Science frame after sky subtaraction
orderlist_frame The input Order Table Frame
wavesol_frame The input Wavesolution frame
model_frame The input model frame
instrument Pointer to instrument description structure
rectify_par Parameters for rectification
spectralformat_frame The frame for the spectral format
disp_tab_frame The dispersion table frame (for flux conservation)
res_name The file name of the resampled frame
res_frame_ext The resampled frame in ESO format
res_frame_tab A table associated to the resampled frame
rec_prefix The recipe prefix (to build proper products PRO.CATG)
Returns:
Rectified frame

Definition at line 689 of file xsh_rectify.c.

References check, XSH_ASSURE_NOT_NULL, XSH_GET_TAG_FROM_ARM, XSH_MODE_SLIT, XSH_ORDER2D, xsh_order_list_free(), xsh_order_list_load(), xsh_rec_slit_size(), and xsh_rectify_orders().

Referenced by xsh_nod_rectify_and_shift_with_key(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_slit_nod_accurate(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), and xsh_slit_stare_correct_crh_and_sky().

cpl_frame* xsh_rectify_and_shift ( cpl_frame *  sci_frame,
cpl_frame *  orderlist_frame,
cpl_frame *  wavesol_frame,
cpl_frame *  model_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
cpl_frame *  spectralformat_frame,
cpl_frame *  loc_frame,
cpl_frame *  loc0_frame,
double *  throw_shift,
cpl_frame *  disp_tab_frame,
const char *  res_name,
cpl_frame **  res_frame_ext,
cpl_frame **  res_frame_tab 
)

This function rectify AND shift the input frame. The shift is calculated for each order and later used in the fill_rectify function.

Parameters:
sci_frame Science Frame (PRE format)
orderlist_frame Order table
wavesol_frame Wave table (can be NULL)
model_frame Model Frame (can be NULL)
instrument Instrument structure
rectify_par Rectify parameters
spectralformat_frame Spectral format table frame
loc_frame Localization of this frame
loc0_frame Localization of the reference frame (first A frame)
throw_shift shift in nod throw
disp_tab_frame Dispersion table
res_name Result frame name
res_frame_ext Ext result frame
res_frame_tab Ext result frame table
Returns:
The rectified (and shifted) frame

Definition at line 750 of file xsh_rectify.c.

References check, compute_shift_with_localization(), xsh_rectify_param::rectif_bin_space, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_propertylist(), XSH_GET_TAG_FROM_ARM, XSH_MODE_SLIT, xsh_msg, XSH_ORDER2D, xsh_order_list_free(), xsh_order_list_load(), xsh_rec_slit_size(), xsh_rectify_orders(), xsh_round_double(), and xsh_shift().

Referenced by xsh_scired_slit_nod_accurate().

cpl_frameset* xsh_rectify_ifu ( cpl_frame *  sci_frame,
cpl_frame *  orderlist_frame,
cpl_frameset *  wavesol_frameset,
cpl_frame *  model_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
cpl_frame *  spectralformat_frame,
cpl_frame *  slice_offset_frame,
cpl_frame *  slitmap_frame,
cpl_frameset **  rec_frameset_ext,
cpl_frameset **  rec_frameset_tab,
const char *  rec_prefix 
)
cpl_frame* xsh_rectify_orders ( cpl_frame *  sci_frame,
xsh_order_list orderlist,
cpl_frame *  wavesol_frame,
cpl_frame *  model_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
cpl_frame *  spectralformat_frame,
cpl_frame *  disp_tab_frame,
const char *  res_name,
const char *  tag,
cpl_frame **  res_frame_ext,
cpl_frame **  res_frame_tab,
int  min_index,
int  max_index,
double  slit_min,
int  nslit,
double  slit_shift 
)

Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters. Lambda min and max are taken from the spectralformat list. Slit min/max are hard coded. Range orders arve given.

Parameters:
sci_frame The input Science frame after sky subtaraction
orderlist The input Order Table Frame
wavesol_frame The input Wavesolution frame
model_frame The input model frame
instrument Pointer to instrument description structure
rectify_par Parameters for rectification
spectralformat_frame spectral format table
disp_tab_frame disp tab frame
res_name resampled frame filename
tag resampled frame tag
res_frame_ext resampled frame in ESO format
res_frame_tab resampled frame in ESO format table
min_index min index
max_index max index
slit_min slit min
nslit number of slit sampling points
slit_shift shift of nod position on slit
Returns:
Rectified frame

Definition at line 898 of file xsh_rectify.c.

References xsh_spectralformat::absorder, adjust_lambdas(), check, xsh_rectify_param::conserve_flux, xsh_pre::data, xsh_pre::data_header, fill_rectified(), xsh_spectralformat::lambda_max, xsh_spectralformat::lambda_min, xsh_rec_list::list, xsh_spectralformat_list::list, n, xsh_rec::nlambda, xsh_rec::nslit, xsh_rec_list::nslit, order, xsh_rectify_param::rectif_bin_lambda, xsh_rectify_param::rectif_bin_space, xsh_rectify_param::rectif_kernel, xsh_rectify_param::rectif_radius, xsh_rec_list::size, size, xsh_rec::slit, xsh_rec_list::slit_max, xsh_rec_list::slit_min, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, xsh_baryvel(), xsh_dispersol_list_free(), xsh_dispersol_list_load(), xsh_error_msg, xsh_model_config_load_best(), xsh_model_temperature_update_frame(), xsh_msg, xsh_msg_dbg_high, xsh_msg_dbg_medium, xsh_pre_free(), xsh_pre_get_bpmap(), xsh_pre_load(), XSH_QC_VRAD_BARYCOR, XSH_QC_VRAD_BARYCOR_C, XSH_QC_VRAD_HELICOR, XSH_QC_VRAD_HELICOR_C, xsh_rec_list_create(), xsh_rec_list_free(), xsh_rec_list_save(), xsh_rec_list_save2(), xsh_rec_list_save_table(), xsh_rec_list_set_data_size(), xsh_rec_list_update_header(), XSH_RECTIFY_TYPE_MODEL, XSH_RECTIFY_TYPE_POLY, xsh_round_double(), xsh_spectralformat_list_free(), xsh_spectralformat_list_load(), xsh_wavesol_free(), and xsh_wavesol_load().

Referenced by main(), xsh_rectify(), xsh_rectify_and_shift(), and xsh_rectify_orders_ifu().

cpl_frameset* xsh_rectify_orders_ifu ( cpl_frame *  sci_frame,
xsh_order_list orderlist,
cpl_frameset *  wavesol_frameset,
cpl_frame *  model_frame,
xsh_instrument instrument,
xsh_rectify_param rectify_par,
cpl_frame *  spectralformat_frame,
cpl_frame *  sliceoffset_frame,
cpl_frame *  slitmap_frame,
cpl_frameset **  res_frameset_ext,
cpl_frameset **  res_frameset_tab,
int  min_index,
int  max_index,
const char *  rec_prefix 
)

Create a grid in wavelength with the step in lambda and slit. Steps are defined in the parameters. Lambda min and max are taken from the spectralformat list. Slit min/max are hard coded.

Parameters:
[in] sci_frame Science frame after sky subtaraction
[in] orderlist Order traces structure
[in] wavesol_frameset Input Wavesolution frameset (containing the 3 slitlet wave solution: DOWN, CEN, UP)
[in] model_frame physical model cfg table frame
[in] instrument Pointer to instrument description structure
[in] rectify_par Parameters for rectification
[in] spectralformat_frame The frame for the spectral format
[in] sliceoffset_frame frame with measured offsets of each IFU slices
[in] slitmap_frame The SLIT MAP Image Frame
[out] res_frameset_ext resampled frame in ESO format
[out] res_frameset_tab resampled frame in ESO format (tab)
[in] min_index min index
[in] max_index max index
[in] rec_prefix recipe prefix (for proper PRO.CATG values)
Returns:
Rectified frame

Definition at line 1102 of file xsh_rectify.c.

References xsh_slice_offset::cen_down, xsh_slice_offset::cen_up, CENTER_IFU_SLITLET, check, LOWER_IFU_SLITLET, xsh_rectify_param::rectif_bin_space, UPPER_IFU_SLITLET, XSH_ASSURE_NOT_NULL, XSH_CMP_INT, xsh_get_slit_edges(), XSH_GET_TAG_FROM_ARM, xsh_instrument_get_arm(), xsh_msg, xsh_rectify_orders(), xsh_slice_offset_free(), and xsh_slice_offset_load().

Referenced by main(), xsh_geom_ifu(), and xsh_rectify_ifu().

static cpl_frame * xsh_shift ( cpl_frame *  rec_frame,
xsh_instrument instrument,
const char *  fname,
double  slit_shift,
cpl_frame **  res_frame_ext 
) [static]
cpl_frame* xsh_shift_rectified ( cpl_frame *  rec_frame,
cpl_frame *  loc_frame,
cpl_frame *  loc0_frame,
const char *  file_name,
xsh_combine_nod_param combine_nod_param,
xsh_rectify_param rectif_par,
xsh_instrument instrument,
cpl_frame **  res_frame_ext 
)

This function is used to shift a rectified frame to the position of the first frame (nodding observation). The shift is calculated either by using the localization table of the current and the first frame, or by using the NODTHROW, RELOFFSET and CUMOFFSET Keywords available in the header of the rectified frame.

Parameters:
[in] rec_frame Input rectified frame to be shifted
[in] loc_frame Localization frame used (or not) for shifting
[in] loc0_frame Localization of reference frame used (or not) for shifting
[in] combine_nod_param Parameters
[in] rectif_par rectify parameters
[in] instrument Instrument structure
[out] res_frame_ext resampled frame in ESO format
Returns:
The shifted frame

Definition at line 1655 of file xsh_rectify.c.

References check, shift_with_kw(), XSH_ASSURE_NOT_NULL, and xsh_msg.


Variable Documentation

cpl_vector* rec_profile = NULL [static]

Generated on 9 Mar 2011 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1