Quickstart with LT/SPRAT¶
Using the SPRAT instrument on the Liverpool Telescope as an example quickstart. We are only showing one science spectrum until the end where all the reduced science and standard spectra are shown.
Import all the required libraries:
import sys import numpy as np from astropy.io import fits from aspired import image_reduction from aspired import spectral_reduction import plotly.io as pio # If using jupyter notebook pio.renderers.default = 'notebook' # If you want to display it in your default browser pio.renderers.default = 'browser' # If you want the image pio.renderers.default = 'png'
In order to perform image reduction, users have to provide a file list of the spectra to be reduced. Alternatively, a fits.hdu.image.PrimaryHDU object can be supplied For the science spectral image, the file list is contained in examples/sprat_LHS6328.list
#flat, sprat_LHS6328_Hiltner102_raw/v_slit_red_1.fits.gz dark, sprat_LHS6328_Hiltner102_raw/v_dark_1.fits.gz arc, sprat_LHS6328_Hiltner102_raw/v_a_20180810_13_1_0_1.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_e_20180810_12_1_0_0.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_e_20180810_12_2_0_0.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_e_20180810_12_3_0_0.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_e_20180810_12_4_0_0.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_e_20180810_12_5_0_0.fits.gz
To reduce the image with the built-in reduction method ImageReduction, execute the following, the rederer options are those of plotly’s:
science_frame = image_reduction.ImageReduction() science_frame.add_filelist('examples/sprat_LHS6328.list') science_frame.load_data() science_frame.reduce() science_frame.inspect()
and for the standard spectral image, the file list is contained in examples/sprat_Hiltner102.list
#flat, sprat_LHS6328_Hiltner102_raw/v_slit_red_1.fits.gz dark, sprat_LHS6328_Hiltner102_raw/v_dark_1.fits.gz arc, sprat_LHS6328_Hiltner102_raw/v_a_20180810_28_1_0_1.fits.gz light, sprat_LHS6328_Hiltner102_raw/v_s_20180810_27_1_0_0.fits.gz
Similar to the science frame, execute the following:
standard_frame = image_reduction.ImageReduction() standard_frame.add_filelist('examples/sprat_Hiltner102.list') standard_frame.load_data() standard_frame.reduce() standard_frame.inspect()
With the image reduced, we can start performing spectral reduction, starting from the 2D spectrum. The arc frames listed in the filelist were also loaded, and they are propagated to the TwoDSpec automatically:
science2D = spectral_reduction.TwoDSpec(science_frame) standard2D = spectral_reduction.TwoDSpec(standard_frame)
To trace the respective brightest spectrum in the science and standard frames, run
science2D.ap_trace() standard2D.ap_trace()
And then extract the spectra from the traces by using the ap_extract() method. The science spectrum is optimally extracted with an aperture with the default size of 7 pixel on each side of the trace, the sky is measured by fitting a, by default, first order polynomial to the sky region of 5 pixels on each side from the aperture by default. The aperture and the sky regions are separated by 3 pixels by default. After the extraction, display the results with the default renderer (plotly graph in a browser).
science2D.ap_extract() standard2D.ap_extract()
The two spectra from the science frame: