CriresPipeline#
- class excalibuhr.pipeline.CriresPipeline(workpath, night, obs_mode='nod', clean_start=False, num_processes=4)[source]#
Bases:
object- Parameters:
workpath (str) – Path of the main reduction folder.
night (str) – The main folder will have subfolders named by dates of observations. In the folder of each night, there will be subfolders called
raw,cal, andout, where the raw data (both science and raw calibration), processed calibration files, and data products are stored respectively.obs_mode (str) – The observation mode, either ‘nod’ or ‘stare’.
clean_start (bool) – Set it to True to remove the infomation files when redoing the entire reduction.
num_processes (int) – number of parallel processes for processing nodding and extraction
Methods Summary
apply_correction([use_molecift])Method for apply telluric and instrument response correction using the output from run_molecfit and spec_response_cal.
cal_dark([clip, combine_mode])Method for combining dark frames per DIT while producing readout noise and bad pixel map.
cal_flat_norm([debug])Method for creating normalized flat field and extracting blaze function in each order.
cal_flat_raw([clip, combine_mode])Method for combining raw flat frames per wavelngth setting and producing bad pixel map.
cal_flat_trace([debug])Method for identifying traces of spectral order in the master FLAT frame.
cal_slit_curve([debug])Method for tracing slit curvature in the Fabry-Pérot Etalon (FPET) calibration frame.
download_rawdata_eso(login, **filters)Method for downloading raw data from eso archive using astroquery.
Method for extracting header information of raw data to a
pandas.DataFrameand a cvs text file.obs_extract([caltype, object, savename, ...])Method for extracting 1D spectrum from the 2D science frames.
Method for calibrating and processing science frames.
obs_nodding_combine([combine_mode, clip])Method for combining multiple nodding exposures at each nodding position A and B.
preprocessing([combine_mode])Method for running the preprocessing recipes including reducing calibration files, calibrating science frames, and combining indvidual frames at each nodding position.
refine_wlen_solution([debug])Method for refining wavelength solution by manimizing chi2 between the spectrum and the telluric transmission template on a order-by-order basis.
run_molecfit([object, data_type, ...])Method for running ESO's tool for telluric correction Molecfit.
run_recipes([combine, combine_mode, ...])Method for running the full chain of recipes.
run_skycalc([airmass, pwv])Method for obtaining the telluric transmission template using the Python wrapper of SkyCalc: https://skycalc-ipy.readthedocs.io
spec_response_cal(object, temp, vsini, vsys)Method for calibrating spectral shape using standard star observations.
Methods Documentation
- apply_correction(use_molecift=False)[source]#
Method for apply telluric and instrument response correction using the output from run_molecfit and spec_response_cal. The corrected spectrum is save to a text file.
- Parameters:
use_molecfit (bool) – If True, it uses the telluric model generated by molecfit. Otherwise, the standard stellar spectrum is used to correct for the telluric.
- cal_dark(clip=5, combine_mode='median')[source]#
Method for combining dark frames per DIT while producing readout noise and bad pixel map.
- Parameters:
clip (int) – sigma clipping threshold for rejecting bad pixels
combine_mode (str) – the way of combining raw dark frames by mean or median; median combine by defalut.
See also
- cal_flat_norm(debug=False)[source]#
Method for creating normalized flat field and extracting blaze function in each order.
See also
- cal_flat_raw(clip=5, combine_mode='median')[source]#
Method for combining raw flat frames per wavelngth setting and producing bad pixel map.
- Parameters:
clip (int) – sigma clipping threshold for rejecting bad pixels
combine_mode (str) – the way of combining raw flat frames by mean or median; median combine by defalut.
See also
- cal_flat_trace(debug=False)[source]#
Method for identifying traces of spectral order in the master FLAT frame.
See also
- cal_slit_curve(debug=False)[source]#
Method for tracing slit curvature in the Fabry-Pérot Etalon (FPET) calibration frame. Determine initial wavelength solution by mapping FPET lines to an evenly spaced wavelength grid.
See also
- download_rawdata_eso(login, **filters)[source]#
Method for downloading raw data from eso archive using astroquery.
- extract_header()[source]#
Method for extracting header information of raw data to a
pandas.DataFrameand a cvs text file.
- obs_extract(caltype='NOD_COMBINED', object=None, savename='', peak_frac=None, companion_sep=None, remove_star_bkg=False, remove_sky_bkg=False, aper_prim=20, aper_comp=10, extract_2d=True, extr_level=0.9, debug=False)[source]#
Method for extracting 1D spectrum from the 2D science frames. It works on either combined frames or individual exposures, as specified by the caltype option. It extracts all targets taken during the night if not specified with the object parameter.
- Parameters:
caltype (str) – Label of the file type to worked on: NODDING_COMBINED or NODDING_FRAME.
object (str) – name of the target to extract 1D spectrum. If not specified, all targets will be extracted.
savename (str) – customed label for the extratced spectrum (optional).
peak_frac (dict) – the fraction of target signal along the slit at A and B nodding position (a fraction of 0 is at the bottom of the slit and 1 at the top). If not specified, the code will determine the peak location from the whitelight PSF of the data.
companion_sep (float) – separation of the companion in arcsec
remove_star_bkg (bool) – whether to remove the stellar background near the resolved companion using polynomials at each wavelength channel.
remove_sky_bkg (bool) – whether to remove the sky background. This will be performed for the observations in ‘STARE’ mode.
aper_prim (int) – half of extraction aperture in pixel for the primary star
aper_comp (int) – half of extraction aperture in pixel for the companion
extr_level (float) – the extraction aperture will be automatically refined to include a sepcified fraction of the total flux in the derived PSF of the data. By default it encompasses 90% of the flux.
extract_2d (bool) – if True, the curvature of the trace in the 2D images will be corrected and the intermediate 2D data will be saved to .npz files.
debug (bool) – generate plots for debugging.
- obs_nodding()[source]#
Method for calibrating and processing science frames. If obs_mode=’nod’, it subtracts the AB nodding pairs to remove sky background. If obs_mode=’stare’, each frame will be treated separately and the sky background removal will be performed at a later stage.
- obs_nodding_combine(combine_mode='mean', clip=3)[source]#
Method for combining multiple nodding exposures at each nodding position A and B.
- Parameters:
combine_mode (str) – the way of combining frames: mean, median, or weighted. weighted applys a weighted average by the mean SNR squared of each exposure, which is estimated using the extratced spectrum of the target.
clip (int) – sigma clipping threshold for rejecting bad pixels
See also
- preprocessing(combine_mode='mean')[source]#
Method for running the preprocessing recipes including reducing calibration files, calibrating science frames, and combining indvidual frames at each nodding position.
- Parameters:
combine_mode (str) – The mode to use for combining the frames.
- refine_wlen_solution(debug=False)[source]#
Method for refining wavelength solution by manimizing chi2 between the spectrum and the telluric transmission template on a order-by-order basis. The calibrated spectrum of each target is saved to a fits file.
See also
- run_molecfit(object=None, data_type=None, wave_range=None, verbose=True)[source]#
Method for running ESO’s tool for telluric correction Molecfit.
- Parameters:
object (str) – Name of the star whose spectra is used for the telluric fitting. Default is to carry out fitting for every target.
data_type (str) – Label of the file type to fit for telluric absorption. The default value is SPEC_COMBINED_PRIMARY, i.e. the primary spectrum. It can also be individual frames in time-series observations.
wave_range (list of tuple) – list of lower and upper limit for wavelength ranges (in um) for molecfit fitting
verbose (bool) – Print output produced by
esorex.
See also
- run_recipes(combine=False, combine_mode='mean', savename='', companion_sep=None, remove_star_bkg=False, aper_prim=20, aper_comp=10, extract_2d=True, std_name=None, std_prop=None, run_molecfit=False, wave_range=None, debug=False)[source]#
Method for running the full chain of recipes.
- Parameters:
combine (bool) – If True, combine the individual frames at each nodding position.
combine_mode (str) – The mode to use for combining the frames, either ‘mean’, ‘median’, or ‘weighted’.
savename (str) – The prefix of the output file names for companion sources on slit.
companion_sep (float) – To extract spectra of the spatially resolved companion, provide the separation of the companion from the primary in arcsec.
remove_star_bkg (bool) – If True, remove the background of the star in the companion extraction. Note that this is experimental and should be used with caution.
aper_prim (int) – The aperture size for the primary star extraction.
aper_comp (int) – The aperture size for the companion extraction.
extract_2d (bool) – If True, rectify the 2d image and save the intermediate 2d data product.
std_name (str) – The name of the standard star. If std_prop is None the pipeline will attempt to automatically retrieve the star’s properties in place of std_prop.
std_prop (dict) – The properties of the standard star including the name, teff, vsini, and rv.
run_molecfit (bool) – If True, run the molecfit for telluric correction.
wave_range (list) – The wavelength range to use for the molecfit.
debug (bool) – If True, show the debug plots.
- run_skycalc(airmass=1.0, pwv=2.5)[source]#
Method for obtaining the telluric transmission template using the Python wrapper of SkyCalc: https://skycalc-ipy.readthedocs.io
- Parameters:
airmass (float) – airmass
pwv (float) – Precipitable water vapor (default: 2.5 mm)
- spec_response_cal(object, temp, vsini, vsys, mask_wave=[(2164, 2169)], debug=False)[source]#
Method for calibrating spectral shape using standard star observations.
- Parameters:
object (str) – Name of the standard star whose spectrum is used for the instrument response calibration.
temp (int) – effective temperature of the standard star
vsini (float) – rotational broadenning of the standard star
vsys (float) – systemic and barycentric velocity correction for the standard star
mask_wave (list of tuple) – list of lower and upper limit for wavelength ranges (in nm) that need to be masked when estimating the isntrument response. They are usually Hydrogen lines of the stellar spectrum.