UVES Pipeline Reference Manual
5.4.6
|
Macros | |
#define | UVES_MIN_LINE_ROWS_TO_MAKE_FIT 5 |
#define | UVES_BLAZE_DUMMY_VAL 999. |
Functions | |
static cpl_error_code | extract_ff_rebin_merge (cpl_image *back_subbed, cpl_image *backsubbed_noise, const uves_propertylist *backsubbed_header, const cpl_image *master_flat, cpl_image *mflat_noise, const cpl_table *ordertable, const polynomial *order_locations, const cpl_table *linetable, const uves_propertylist *linetable_header[3], const polynomial *dispersion_relation[3], double slit_length, double slit_offset, int window, enum uves_chip chip, bool blaze_correct, bool tilt_corr, bool debug_mode, const cpl_parameterlist *parameters, const char *context, const char *mode, flatfielding_method ff_method, extract_method ex_method, merge_method m_method,cpl_image **x, uves_propertylist **x_header, cpl_image **fx, cpl_table **cosmic_mask, cpl_image **wave_map, cpl_image **flatfielded_variance, uves_propertylist **flatfielded_variance_header, cpl_image **resampled_spectrum, cpl_image **resampled_mf, cpl_image **merged_sky, cpl_image **rebinned_spectrum, cpl_image **rebinned_noise, uves_propertylist **rebinned_header, cpl_image **merged_spectrum, cpl_image **merged_noise, uves_propertylist **merged_header, cpl_table **info_tbl, cpl_table **order_trace) |
Reduce one extraction window. More... | |
static cpl_image * | subtract_sky (cpl_image *rebinned_obj, cpl_image *rebinned_obj_noise, uves_propertylist *rebinned_obj_header, const cpl_image *rebinned_sky1, const cpl_image *rebinned_sky1_noise, const uves_propertylist *rebinned_sky1_header, const cpl_image *rebinned_sky2, const cpl_image *rebinned_sky2_noise, const uves_propertylist *rebinned_sky2_header, cpl_image **merged_obj, cpl_image **merged_obj_noise, uves_propertylist *merged_obj_header, const cpl_image *merged_sky1, const cpl_image *merged_sky1_noise, const uves_propertylist *merged_sky1_header, const cpl_image *merged_sky2, const cpl_image *merged_sky2_noise, const uves_propertylist *merged_sky2_header, double obj_slit, double sky1_slit, double sky2_slit) |
Subtract sky from extracted spectrum. More... | |
static cpl_image * | subtract_sky_row (cpl_image *obj, cpl_image *obj_noise, double obj_start, double obj_end, double obj_slit, const cpl_image *sky1, const cpl_image *sky1_noise, double sky1_start, double sky1_end, double sky1_slit, const cpl_image *sky2, const cpl_image *sky2_noise, double sky2_start, double sky2_end, double sky2_slit, int row, double wavestep, double *common_start, double *common_end) |
Subtract sky from 1 row of spectrum. More... | |
static double | get_offset (const cpl_image *back_subbed, const cpl_table *ordertable, const polynomial *order_locations, double search_range, int nsamples, double *doffset) |
Measure object offset w.r.t. slit center. More... | |
static cpl_image * | uves_get_blaze_ratio (const cpl_image *spectrum, const cpl_image *spectrum_noise) |
Get (normalized) object to flat-field blaze function ratio. More... | |
cpl_parameterlist * | uves_reduce_define_parameters (void) |
Define recipe parameters used for reducing a frame. More... | |
cpl_error_code | uves_reduce (const cpl_image *raw_image, const uves_propertylist *raw_header, const uves_propertylist *rotated_header, const cpl_image *master_bias, const uves_propertylist *mbias_header, const cpl_image *master_dark, const uves_propertylist *mdark_header, const cpl_image *master_flat, const uves_propertylist *mflat_header, const cpl_table *ordertable, const polynomial *order_locations, const cpl_table *linetable[3], const uves_propertylist *linetable_header[3], const polynomial *dispersion_relation[3], enum uves_chip chip, bool debug_mode, const cpl_parameterlist *parameters, const char *rec_id, const char *mode, cpl_image **x, uves_propertylist **x_header, cpl_image **fx, cpl_table **cosmic_mask, cpl_image **wave_map, cpl_image **background, cpl_image **flatfielded_variance, uves_propertylist **flatfielded_variance_header, cpl_image **resampled_spectrum, cpl_image **resampled_mf, cpl_image **merged_sky, cpl_image **rebinned_spectrum, cpl_image **rebinned_noise, uves_propertylist **rebinned_header, cpl_image **merged_spectrum, cpl_image **merged_noise, uves_propertylist **merged_header, cpl_image **reduced_rebinned_spectrum, cpl_image **reduced_rebinned_noise, cpl_image **reduced_spectrum, cpl_image **reduced_noise, cpl_table **info_tbl, double *extraction_slit, cpl_table **order_trace) |
Reduce a science frame. More... | |
static polynomial * | interpolate_wave (const polynomial *dispersion_relation[3], const uves_propertylist *linetable_header[3], double objoffset) |
1st order line tilt correction More... | |
static double | uves_get_airmass (const double z) |
cpl_image * | uves_normalize_spectrum (const cpl_image *spectrum, const cpl_image *spectrum_error, const uves_propertylist *spectrum_header, const uves_propertylist *raw_header, int n_traces, enum uves_chip chip, const cpl_table *atm_extinction, bool correct_binning, cpl_image **scaled_error) |
Normalize a spectrum. More... | |
This module is for reducing a science frame.
|
static |
Reduce one extraction window.
back_subbed | The de-biased, dark subtracted, background subtracted, possibly already flat-fielded image in (pixel, pixel)-space |
backsubbed_noise | Noise of back_subbed |
backsubbed_header | FITS header of back_subbed |
master_flat | The master flat frame. May be NULL if flatfielding is not performed. |
mflat_noise | Noise of master_flat |
ordertable | Order table describing the order locations on the raw image |
order_locations | The polynomial describing the order positions |
linetable | Line table used for the current extraction window |
linetable_header | Line table header containing offsets for previously obtained dispersion relations |
dispersion_relation | The dispersion relations, will be interpolated depending on offset |
slit_length | Length (in spatial direction, in pixels) of current extraction window. |
slit_offset | Offset of current extraction window (applies only to linear/average, not optimal/2d extraction) |
window | Extraction window number. Must be 1, 2, 3, for lower sky, object, upper sky, respectively. Not used in optimal/2d extraction modes. |
chip | The CCD chip id |
blaze_correct | Correct (empirically) for the different shapes of object/flat-field blaze function? |
tilt_corr | Correct for line tilt? If not, the appropriate dispersion solutions are used for object/sky (without interpolation) |
debug_mode | If true, intermediate results are saved to the current directory |
parameters | Parameters used for extraction and rebinning. |
context | Use parameters belonging to this context |
ff_method | The flat-fielding method. |
ex_method | Extraction method. |
m_method | The order merging method. |
x | (Output) If non-NULL, this will contain the extracted spectrum (recipe product only in 2d mode) |
x_header | (Output) If non-NULL, the header belonging to x |
fx | (Output) If non-NULL, the extracted, flat-fielded spectrum (recipe product only in 2d mode) |
cosmic_mask | (Output) Used only for optimal extraction |
flatfielded_variance | (Output) If non-NULL, variance of ff. spectrum |
flatfielded_variance_header | (Output) Header of flatfielded_variance |
resampled_spectrum | (Output) Extracted + rebinned. Not ff. May be NULL |
resampled_mf | (Output) Extracted + rebinned master flat-field. May be NULL |
merged_sky | (Output) For optimal extraction, the merged sky spectrum |
rebinned_spectrum | (Output) Extracted, flat-fielded, rebinned spectrum |
rebinned_noise | (Output) Error (1 sigma) of rebinned_spectrum |
rebinned_header | (Output) Header describing geometry of rebinned_spectrum and rebinned_noise |
merged_spectrum | (Output) The merged spectrum |
merged_noise | (Output) Noise (1 sigma) of merged_spectrum |
merged_header | (Output) Header belonging to merged_spectrum and merged_noise |
info_tbl | table with information on object location, FWHM, and S/N |
As its name sort of implies, this function
Definition at line 1745 of file uves_reduce.c.
References check, check_nomsg, interpolate_wave(), passure, uves_extract(), uves_flatfielding(), uves_get_blaze_ratio(), uves_get_wave_map(), uves_image_mflat_detect_blemishes(), uves_merge_orders(), uves_msg, uves_msg_debug, uves_msg_low, uves_msg_warning, uves_pfits_get_firstabsorder(), uves_pfits_get_lastabsorder(), uves_polynomial_convert_to_table(), uves_polynomial_delete(), uves_polynomial_duplicate(), uves_propertylist_copy_property_regexp(), uves_propertylist_duplicate(), and uves_rebin().
Referenced by uves_reduce().
|
static |
Subtract sky from extracted spectrum.
rebinned_obj | The rebinned object spectrum |
rebinned_obj_noise | Noise of rebinned object spectrum |
rebinned_obj_header | Header of rebinned object spectrum |
rebinned_sky1 | The rebinned lower sky spectrum |
rebinned_sky1_noise | Noise of rebinned lower sky spectrum |
rebinned_sky1_header | Header of rebinned lower sky spectrum |
rebinned_sky2 | The rebinned upper sky spectrum |
rebinned_sky2_noise | Noise of rebinned upper sky spectrum |
rebinned_sky2_header | Header of rebinned upper sky spectrum |
merged_obj | The merged object spectrum |
merged_obj_noise | Noise of merged object spectrum |
merged_obj_header | Header of merged object spectrum |
merged_sky1 | The merged lower sky spectrum |
merged_sky1_noise | Noise of merged lower sky spectrum |
merged_sky1_header | Header of merged lower sky spectrum |
merged_sky2 | The merged upper sky spectrum |
merged_sky2_noise | Noise of merged upper sky spectrum |
merged_sky2_header | Header of merged upper sky spectrum |
obj_slit | Extraction slit length (object) |
sky1_slit | Extraction slit length (lower sky) |
sky2_slit | Extraction slit length (upper sky) |
Due to (slightly) different dispersion relations, the ranges of sky and object spectra might not be exactly identical. This function takes care of subtracting the sky from rebinned and merged spectra while aligning the proper wavelengths bin with each other.
Definition at line 2658 of file uves_reduce.c.
References check, passure, subtract_sky_row(), uves_pfits_get_cdelt1(), uves_pfits_get_crval1(), uves_pfits_get_wend(), uves_pfits_get_wstart(), uves_pfits_set_crval1(), uves_pfits_set_wend(), and uves_pfits_set_wstart().
Referenced by uves_reduce().
|
static |
Subtract sky from 1 row of spectrum.
obj | The object spectrum |
obj_noise | Noise of object spectrum |
obj_start | Wavelength of first bin of row |
obj_end | Wavelength of last bin to consider |
obj_slit | Object slit length |
sky1 | The lower sky spectrum (or NULL if not extracted) |
sky1_noise | Noise of lower sky spectrum |
sky1_start | Wavelength of first bin of row |
sky1_end | Wavelength of last bin to consider |
sky1_slit | Lower sky slit length |
sky2 | The upper sky spectrum (or NULL if not extracted) |
sky2_noise | Noise of upper sky spectrum |
sky2_start | Wavelength of first bin of row |
sky2_end | Wavelength of last bin to consider |
sky2_slit | Upper sky slit length |
row | Row (order number) of spectrum images to process |
wavestep | Width of one win (same for obj/sky spectra) |
common_start | (output) Minimum common wavelength |
common_end | (output) Maximum common wavelength |
This function subtracts sky from (only) the specified row of the input spectrum. Before subtraction, the fluxes are properly scaled according to extraction slit lengths.
Definition at line 2905 of file uves_reduce.c.
References check, uves_average_images(), uves_msg_debug, and uves_msg_low.
Referenced by subtract_sky().
|
static |
Measure object offset w.r.t. slit center.
back_subbed | The input image |
ordertable | The order table. Used to get min/max order numbers |
order_locations | Polynomial describing the order locations |
search_range | The half search window height (in pixels) |
nsamples | Number of sample points per order |
doffset | (out) If non-null, the measured width (1 sigma) of the object is returned. |
This function finds the flux centroid (in y-direction) of nsamples median collapsed chunks in each order and returns the mean centroid position (average of all orders).
Definition at line 3127 of file uves_reduce.c.
References passure, and uves_polynomial_evaluate_2d().
Referenced by uves_reduce().
|
static |
Get (normalized) object to flat-field blaze function ratio.
spectrum | The extracted, flat-fielded spectrum in (pixel, order)-space |
spectrum_noise | Noise associated with spectrum |
Due to the different blaze function profile of flat/science spectra (for unknown reason) there will be order scale ripples when merging. This function
This function
Definition at line 3249 of file uves_reduce.c.
References assure_mem, check, check_nomsg, passure, uves_error_reset, uves_filter_image_median(), uves_polynomial_delete(), uves_polynomial_evaluate_1d(), and uves_polynomial_regression_1d().
Referenced by extract_ff_rebin_merge().
cpl_parameterlist* uves_reduce_define_parameters | ( | void | ) |
Define recipe parameters used for reducing a frame.
See source code or 'esorex –man-page' for a description of each parameter.
Definition at line 188 of file uves_reduce.c.
cpl_error_code uves_reduce | ( | const cpl_image * | raw_image, |
const uves_propertylist * | raw_header, | ||
const uves_propertylist * | rotated_header, | ||
const cpl_image * | master_bias, | ||
const uves_propertylist * | mbias_header, | ||
const cpl_image * | master_dark, | ||
const uves_propertylist * | mdark_header, | ||
const cpl_image * | master_flat, | ||
const uves_propertylist * | mflat_header, | ||
const cpl_table * | ordertable, | ||
const polynomial * | order_locations, | ||
const cpl_table * | linetable[3], | ||
const uves_propertylist * | linetable_header[3], | ||
const polynomial * | dispersion_relation[3], | ||
enum uves_chip | chip, | ||
bool | debug_mode, | ||
const cpl_parameterlist * | parameters, | ||
const char * | rec_id, | ||
const char * | mode, | ||
cpl_image ** | x, | ||
uves_propertylist ** | x_header, | ||
cpl_image ** | fx, | ||
cpl_table ** | cosmic_mask, | ||
cpl_image ** | wave_map, | ||
cpl_image ** | background, | ||
cpl_image ** | flatfielded_variance, | ||
uves_propertylist ** | flatfielded_variance_header, | ||
cpl_image ** | resampled_spectrum, | ||
cpl_image ** | resampled_mf, | ||
cpl_image ** | merged_sky, | ||
cpl_image ** | rebinned_spectrum, | ||
cpl_image ** | rebinned_noise, | ||
uves_propertylist ** | rebinned_header, | ||
cpl_image ** | merged_spectrum, | ||
cpl_image ** | merged_noise, | ||
uves_propertylist ** | merged_header, | ||
cpl_image ** | reduced_rebinned_spectrum, | ||
cpl_image ** | reduced_rebinned_noise, | ||
cpl_image ** | reduced_spectrum, | ||
cpl_image ** | reduced_noise, | ||
cpl_table ** | info_tbl, | ||
double * | extraction_slit, | ||
cpl_table ** | order_trace | ||
) |
Reduce a science frame.
raw_image | the image to reduce (pre and overscan are already removed) |
raw_header | FITS header of raw image |
rotated_header | Header describing the geometry of the raw image after rotation and removal of pre- and overscan areas |
master_bias | The master bias image. If NULL, no bias subtraction is done. |
master_dark | The master dark image. If NULL, no dark subtraction is done. |
mdark_header | The master dark header containing the master dark exposure time. |
master_flat | Master flat image. May be NULL, but only if no flatfielding is requested. |
mflat_header | The master flat header. Contains the number of input flat frames which is needed to generate the master flat noise image. |
ordertable | Order table describing the order locations on the raw image |
order_locations | The polynomial describing the order positions |
linetable | Length 3 array of linetable for sky, object, sky. |
linetable_header | Length 3 array of linetable headers for sky, object, sky. |
dispersion_relation | Length 3 array of dispersion relations for sky, object, sky. |
chip | The CCD chip id |
debug_mode | If true, intermediate results are saved to the current directory |
parameters | Parameters used for background subtraction, flat-fielding, extraction and rebinning. Add parameters to the caller recipe by calling uves_propagate_parameters_step() from the recipe_create() function |
rec_id | Use parameters belonging to this recipe |
mode | mode to set different default params (efficiencY) |
x | (Output) In 2d extraction mode, the extracted spectrum |
x_header | (Output) In 2d extraction mode, header of extracted spectrum |
fx | (Output) In 2d extraction mode, the flat-fielded, extracted spectrum |
cosmic_mask | (Output) In optimal extraction mode, the list of hot pixels |
background | (Output) The background that was subtracted from the raw image |
flatfielded_variance | (Output) If non-NULL variance of extracted+flatfielded (not resampled) object |
flatfielded_variance_header | (Output) If non-NULL header of flatfielded_variance |
resampled_spectrum | (Output) Extracted + resampled but not FF object. If input is NULL, this is not produced |
resampled_mf | (Output) Extracted + resampled master flat. If input is NULL, this is not produced |
merged_sky | (Output) Input pointer must be non-NULL. Returned is the sky spectrum, or NULL if no sky was extracted (image slicer or 2d modes) |
rebinned_spectrum | (Output) The resampled 2d spectrum (non sky-subtracted) |
rebinned_noise | (Output) Noise (1 sigma) of rebinned_spectrum |
rebinned_header | (Output) Header describing geometry of rebinned_spectrum (and of course rebinned_noise) |
merged_spectrum | (Output) The merged spectrum (non sky-subtracted) |
merged_noise | (Output) Noise (1 sigma) of merged_spectrum |
merged_header | (Output) Header belonging to merged_spectrum and merged_noise |
reduced_rebinned_spectrum | (Output) The sky subtracted spectrum rebinned to (wavelength, order) space (i.e. non-merged). |
reduced_rebinned_noise | (Output) Noise (1 sigma) of reduced_rebinned_spectrum |
reduced_spectrum | (Output) Merged, sky-subtracted spectrum |
reduced_noise | (Output) Noise (1 sigma) of reduced_spectrum |
info_tbl | (output) table with information on object location, FWHM, and S/N |
extraction_slit | (output) extraction slit actually used |
order_trace | (Output) In optimal extraction mode, table describing the measured spatial profile |
This function pre-processes the input image:
uves_backsub_spline()
),Then, if optimal extraction:
extract_ff_rebin_merge()
).If linear/average extraction,
If 2d extraction,
extract_ff_rebin_merge()
). In 2d extraction mode, no sky subtraction can be performed as the object position is not defined. Definition at line 575 of file uves_reduce.c.
References assure_nomsg, check, extract_ff_rebin_merge(), get_offset(), passure, subtract_sky(), uves_define_noise(), uves_flatfielding(), uves_get_extract_method(), uves_get_flatfield_method(), uves_get_merge_method(), uves_msg, uves_msg_low, uves_msg_warning, uves_pfits_get_datancom(), uves_pfits_get_exptime(), uves_pfits_get_slit1_name(), uves_pfits_get_slitlength_pixels(), uves_pfits_set_hs(), uves_propertylist_append_c_double(), uves_propertylist_contains(), uves_propertylist_get_double(), uves_propertylist_has(), uves_subtract_bias(), and uves_subtract_dark().
Referenced by uves_response_efficiency(), and uves_scired_process_chip().
|
static |
1st order line tilt correction
dispersion_solution | calibration solutions |
linetable_header | describing where dispersion solutions were obtained |
objoffset | object slit position |
Definition at line 1567 of file uves_reduce.c.
References uves_msg, uves_msg_debug, uves_pfits_get_offset(), uves_polynomial_add_2d(), uves_polynomial_delete(), uves_polynomial_duplicate(), and uves_polynomial_rescale().
Referenced by extract_ff_rebin_merge().
cpl_image* uves_normalize_spectrum | ( | const cpl_image * | spectrum, |
const cpl_image * | spectrum_error, | ||
const uves_propertylist * | spectrum_header, | ||
const uves_propertylist * | raw_header, | ||
int | n_traces, | ||
enum uves_chip | chip, | ||
const cpl_table * | atm_extinction, | ||
bool | correct_binning, | ||
cpl_image ** | scaled_error | ||
) |
Normalize a spectrum.
spectrum | The 1d (merged) or 2d (non-merged or 2d extracted+merged) spectrum to be normalized |
spectrum_error | Error (1 sigma) of spectrum, or NULL. |
spectrum_header | Header describing the geometry of the input spectrum |
raw_header | Header of the raw frame |
n_traces | Number of spatial bins (1 unless 2d extracted) |
chip | CCD chip |
atm_extinction | The table of extinction coefficients |
correct_binning | Flag indicating whether or not to divide by the x-binning factor |
scaled_error | (output) If non-NULL, error of output spectrum |
The spectrum is divided by exposure time, gain and (optionally) binning. Also corrected for atmospheric extinction using the provided table of extinction coefficients.
Bad pixels are propagated.
Definition at line 146 of file uves_reduce_utils.c.
References assure_nomsg, check, uves_msg, uves_msg_error, uves_msg_warning, uves_pfits_get_airmass_end(), uves_pfits_get_airmass_start(), uves_pfits_get_biny(), uves_pfits_get_cdelt1(), uves_pfits_get_crval1(), uves_pfits_get_exptime(), uves_pfits_get_gain(), uves_pfits_get_tel_alt_start(), uves_pfits_get_wstart(), and uves_spline_hermite_table().
Referenced by uves_response_efficiency(), and uves_scired_process_chip().