WHT/ISIS¶
In this example, we reduced a faint low-resolution spectrum of an ultracool white dwarf taken with the Intermediate-dispersion Spectrograph and Imaging System (ISIS) on the William Herschel Telescope (WHT).
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
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. In all the following lines, we are saving the plotly figures as iframes that can be viewed and interacted by using a browser:
# Set the dispersion direction Saxis = 0 science_frame = image_reduction.ImageReduction() science_frame.add_filelist('isis_pso1801p6254.list') science_frame.set_properties(saxis=Saxis) science_frame.reduce() science_frame.inspect( filename='reduced_image_pso1801p6254', save_iframe=True)
and for the standard spectral image, the file list is contained in isis_g93m48.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('isis_g93m48.list') standard_frame.set_properties(saxis=Saxis) standard_frame.reduce() standard_frame.inspect()
With the image reduced, we can start performing spectral reduction, starting from the 2D spectrum with the customised setting to provide the appropriate read noise, gain, seeing and spatial masking:
# spec mask spatial_mask = np.arange(450, 650) # initialise the two spectral_reduction.TwoDSpec() pso = spectral_reduction.TwoDSpec( science_frame, spatial_mask=spatial_mask, readnoise=4.5, cosmicray=False, gain=0.98, seeing=1.1, silence=True) g93 = spectral_reduction.TwoDSpec( standard_frame, spatial_mask=spatial_mask, readnoise=4.5, cosmicray=False, gain=0.98, seeing=1.1, silence=True)
To trace the respective brightest spectrum in the science and standard frames, run
pso.ap_trace(save_iframe=True, filename='pso_trace') g93.ap_trace(save_iframe=True, filename='g93_trace')