Ancillary outputs of the extraction script include the airmass, the FWHM of each trace, the recorded sky values in each of the regions to the left and right of each trace, the maximum counts along the length of the trace, and the measured x-pixel locations of the traces at each y-pixel. These values can be used as diagnostics of the extraction process and also as input parameters for subsequent decorrelation analyses.
This flux is given as a function of y-pixel position and so post-extraction processing is required to convert these positions into calibrated wavelengths. To demonstrate this process, I again use the data of WASP-80b which the example extraction was performed on in section 3.6.2.
Initially, I begin with removing cosmic rays from the spectra. While the extraction code does make an attempt to remove cosmic rays that fall within the background regions by performing a sigma clip, it does not do the same for cosmic rays falling within the aperture. I experimented with using the Laplacian edge detection method of van Dokkum (2001) in order to mask cosmic rays within the entire frame before extraction. However, I found that the parameters governing this required tweaking from frame to frame which is undesirable when reducing hundreds of frames. For this reason, I decided to deal with the cosmic rays falling within the aperture during post-extraction.
To locate cosmic rays, I normalise all of the night’s spectra by a spectrum free of cosmic rays, and locate all points that deviate from the normalised spectra. This is effective at locating cosmic rays as they produce large residuals in the normalised spectrum. In more recent reductions I have added a function which uses a median
filter to locate cosmic rays, using the medfilt function within the scipy python
library (Jones et al., 2001). The median filter calculates the median in a sliding
box of a defined width, typically ∼ 7 pixels, which slides across the extracted 1D
spectrum. This running median can then be used to locate pixels that deviate significantly from the median, which are potentially cosmic rays.
Before removing each cosmic ray, I check that the flagged cosmics are indeed real as sometimes large absorption features do not divide perfectly, particularly as this is done before the spectra are aligned in pixel space. Once the flagged events have been confirmed, the remaining real cosmics are replaced by linearly interpo- lating between the nearest neighbouring pixels that are unaffected. An example of this process is shown in Fig. 3.20.
Once all the spectra have been cleaned of cosmic rays they can be aligned in pixel space. This is done by cross-correlating a number of absorption features within each spectrum with a reference spectrum. Sub pixel resolution is achieved by fitting a quadratic to the peaks in the cross-correlation functions and solving for
the minimum, using a python script written by James McCormac. The reference
spectrum is typically chosen to be near the mid point of the observations. The cross-correlation of each absorption feature with the reference returns the shift in pixels, allowing them to be aligned into the frame of the reference. An example of these shifts for a number of different features is shown in Fig. 3.21. In this case, the
200 250 300 350 Y pixel 0 5000 10000 15000 20000 25000 30000 35000 Inte grated counts Frame 311 200 250 300 350 Y pixel 0 5000 10000 15000 20000 25000 30000 35000 Inte grated counts Frame 311
Figure 3.20: Top panel: examples of cosmic rays (at the positions of the vertical red lines) in the extracted stellar spectrum (blue line). Bottom panel: the same portion of the spectrum following the removal of the cosmic rays using the method described in the text.
Figure 3.21: A plot showing the measured shifts of 15 absorption features over the course of a night’s observations with respect to a reference frame. These features are located across the spectrum and so produce different amplitude shifts, as features nearer the edges of the spectrum are typically shifted by a larger amount. This plot signifies that there are a number of steps in these features, which are associated with manual guiding corrections made to the telescope during the observations. shifts are characterised by high frequency shifts in the features’ positions, associated with the error in the shift measurement, and lower frequency steps, associated with guiding corrections made to the telescope during the observations.
With the shift in pixel position resulting from the cross-correlation and the reference pixel of the absorption features, I fit a polynomial to describe the shifts as a function of y-pixel, resulting in a ‘pixel solution’ for each frame’s spectrum. An example of this is shown in Fig. 3.22.
Next, each frame’s spectrum is resampled onto the same grid as the reference spectrum by resampling the ‘pixel solutions’ onto the pixel grid of the reference. The cross-correlation step was necessary in order to relate each individual frame’s pixel solution to that of the reference frame. The resampling is necessary as the spectra of the target and comparison need to be well aligned in wavelength space for accurate differential spectroscopy. The factors contributing to the shifts in the features include both astrophysical and instrumental effects but is mainly due to refraction in the Earth’s atmosphere, which causes the curvature of the spectra on the CCD and is slightly different for the two stars. The instrumental effects include
0 200 400 600 800 1000 1200 1400 Recorded pix el positions 0 200 400 600 800 1000 1200 1400
Reference pixel positions
−0.5 0.0 0.5
Residuals
Figure 3.22: Top panel: a plot of the measured pixel positions of certain features for an example frame against the reference frame’s pixel positions. These positions are indicated by the red points and the black line shows the third-order polynomial used to describe this relation. Bottom panel: the residuals, in pixels, once the polynomial in the top panel has been subtracted.
1340 1360 1380 1400 1420 1440 Y pixel 100000 120000 140000 160000 180000 200000 220000 Inte grated counts
Figure 3.23: An example portion of a number of spectra extracted from different frames for the same object. The grey lines indicate the spectra before resampling and the blue lines are the same spectra following the resampling method discussed in the text. These spectra are offset in y for clarity.
flexure of the instrument as the telescope observes through differing elevations. The
astrophysical effects are negligible at the resolution used here (R≈400) but include
the Doppler shift in the absorption lines due to the orbital motion of the exoplanet and the Earth, and for other applications this effect would be measured. However, my science goals are not concerned with radial velocity measurements and so I do not make scientific use of the shifts in the absorption lines.
To perform the resampling, I make use of pysynphot4 which conserves flux
during the resampling process. An example portion of a spectrum before and after resampling is shown in Fig. 3.23.
With the spectra aligned in pixel space, I next perform a wavelength cali-
bration to assign each pixel a wavelength in ˚A. I begin with using arc spectra to get
an initial estimate of the wavelength solution. A narrower slit is used for the arcs as the wide slit produces wide arc lines which cannot be used for calibration. The narrow slit also avoids saturation which occurs when we try to take arc spectra with a wide slit.
4
3000 4000 5000 6000 7000 8000 9000 W av elength (˚ A ) 0 200 400 600 800 1000 1200 1400 Y pixel −10 −5 0 5 10 Residuals (˚ A )
Figure 3.24: Example wavelength calibration. Top panel: the black points show the fitted centres, in y-pixels, of 16 absorption lines in an extracted stellar spectrum against the wavelength of these lines. The blue line is a quadratic polynomial fitted to the black points. Bottom panel: the residuals showing the difference between the quadratic polynomial and the measured line centres at the locations of the 16 lines. To perform the arc calibration, the arc spectra are first extracted at the locations of the stellar traces. I then compare the locations of the peaks of the lines in the arc spectra to the instrument-specific tabulated arc values. Using the
tabulated wavelength in ˚A and the measured peak position in the arc spectra, I use
a cubic polynomial to describe the pixel position as a function of wavelength. This polynomial serves as a useful start point to the wavelength calibration that I perform on the stellar spectra themselves, although the arc solution is offset due to the different slit used. To perform this absolute wavelength calibration, I use synthetic telluric and stellar spectra to identify absorption lines within the stellar spectra. I then fit a Gaussian to each of these absorption lines to retrieve the centre of the line in terms of pixels. With this I can then relate the true wavelength of the absorption feature to the pixel position of the absorption feature using a polynomial. An example of this is shown in Fig. 3.24. This results in wavelength calibrated and aligned spectra, examples of which are shown in Fig. 3.25. This figure shows the end product of this extraction and calibration process.
4000 5000 6000 7000 8000 9000 Wavelength ( ˚A) 0.0 0.2 0.4 0.6 0.8 1.0 Normalised flux
Figure 3.25: Example wavelength calibrated spectra for the target and comparison
(blue and red solid lines, respectively). The green line shows an atlas9 template
stellar spectrum (Kurucz, 1993) and the black line shows a template telluric spec- trum (generated by Amanda Doyle using UCLSYN; Smith & Dworetsky, 1988; Smith, 1992; Smalley et al., 2001), both of which were used for the identification of lines in the extracted spectra. The vertical dashed lines indicate the central posi- tions of lines used for calibration. All spectra in this plot have been normalised to unity for clarity.
Following the alignment of the spectra and the wavelength calibration, I am able to construct wavelength-dependent light curves for different portions of the spectrum. The method I chose to do this has varied between my analyses and so I describe this process in more detail in Chapters 5 and 6.