Skip to content

Long Slit Reductions

Steve Crawford edited this page May 19, 2017 · 13 revisions

This tutorial goes through all the steps to produce flux- and wavelength-calibrated 1-D spectra from longslit SALT observations using the PySALT

Data for Tutorial

The following data files will be used for this tutorial. They include observations of a relatively bright AGN to monitor its variability. The files include observations to fully calibrate the data and include the following files:

P201205010024.fits[0][0][short]: MCG-6-30-15
P201205010025.fits[0][0][short]: MCG-6-30-15
P201205010026.fits[0][0][short]: ARC
P201205010027.fits[0][0][short]: FLAT
P201205010028.fits[0][0][short]: FLAT
P201205010029.fits[0][0][short]: FLAT
P201205010030.fits[0][0][short]: FLAT
P201205010031.fits[0][0][short]: FLAT
P201205010057.fits[0][0][short]: LTT4364

The observations were made with the RSS spectrograph at moderate resolution. A tarball containing all of the files is available [http://pysalt.salt.ac.za/tutorials/longslit_tut.tar.gz here].

Basic Data Reductions

Most of the basic data reductions are already done by the pipeline, but we can step through this process to replicate what the pipeline is doing. All the tasks are available to use in PyRAF and the basic data reductions for SALT are done using the saltred package. The package can be loaded by starting PyRAF:

--> pyraf
--> pysalt
--> saltred

If the package has successfully been installed, you should see the pysalt and saltred packages load.

All of the tasks can be run from the command line or from epar and then executed. HELP files are also available for each of the tasks.

The basic data reductions includes preparing the data, correcting for gain, cross-talk, and overscan. Each of these steps is run from its own task.

The first step is to prepare the data. This tasks checks for necessary keywords and can also create variance and badpixelmaps.

 saltprepare (images='P*.fits', outimages="", outpref='p', createvar='no', badpixelimage="", 
 clobber='no', logfile='salt.log', verbose='yes')

The next step is to correct for the gain of the different CCDs. Each amplifier has its own gain correction and this information is in the image headers. A database gain file can be used or the gain levels are also reported in the FITS headers.

 saltgain (images='pP*.fits', outimages="", outpref='g',  gaindb="", usedb='no', mult='yes', 
 clobber='yes', logfile='salt.log', verbose='yes')

We also perform a correction for the cross-talk between the amplifiers that occurs during the readout of the chips. This example use the xtalk coefficients listed in the FITS headers.

 saltxtalk(images='g*fits', outimages="", outpref='x', xtalkfile="", usedb='no', clobber='no', 
 logfile='salt.log', verbose='yes')

To correct for CCD bias, we only use the overscan region at this time and use the task saltbias:

 saltbias(images='x*.fits', outimages="", outpref='b', subover='yes', trim='yes', subbias='no', 
 masterbias='bias.fits', median='no', function='polynomial', order='3', rej_lo='3.0', rej_hi='3.0', 
 niter='10', plotover='no', turbo='no', clobber='no', logfile='salt.log', verbose='yes')

The pipeline currently does not include corrections for cosmic rays or flatfielding. The corrections for cosmic rays can be applied using saltcrclean.

 saltcrclean (images='b*fits', outimages="", outpref='c', crtype='edge', thresh='10.0', mbox='25', 
 bthresh='5.0', flux_ratio='0.2', bbox='25', gain='1.0', rdnoise='5.0', fthresh='5.0', bfactor='2', 
 gbox='3', maxiter='5', multithread='no', clobber='yes', logfile='salt.log', verbose='yes')

To apply a flatfield correction, we will need to create the flatfields:

The five flatfield images can be combined into a single frame by using saltcombine.

 saltcombine(images="cbxgpP201205010027.fits,cbxgpP201205010028.fits,cbxgpP201205010029.fits,cbxgpP201205010030.fits,cbxgpP201205010031.fits", outimage="masterflat.fits", combine="median", reject="None", mask='no', weight='no', blank='0.0', scale="None", statsec="", lthresh="", hthresh="", clobber='no', logfile="salt.log", verbose='yes', mode="h") 

Note: It is suggested to apply an illumination correction to the master flat prior to applying that to the data by using saltillum.

 saltillum(images='masterflat.fits', outpref="i", outimages="", mbox='11', clobber='yes')

This can then be applied to the data set using saltflat.

saltflat(images='cbxgpP201205010024.fits,cbxgpP201205010025.fits,cbxgpP201205010026.fits,cbxgpP201205010057.fits',  outimages="", outpref='f',flatimage='imasterflat.fits',minflat='0',clobber='yes', logfile='salt.log',verbose='yes')

Finally, the images from the different extensions can be mosaicked into a single frame.

 saltmosaic(images='fc*.fits', outimages="", outpref='m', geomfile='/Users/crawford/iraf/pysalt/data/rss/RSSgeom.dat', 
 interp='linear', geotran='yes', cleanup='yes', clobber='no', logfile='salt.log', verbose='yes')

If you are on the ASTRO.CAPE server, you should be able to point to: geomfile='/salt/iraf/pysalt/data/rss/RSSgeom.dat'

Or alternativily, fill in the bit before /pysalt/ with the path to the pysalt version you are using.

Spectroscopic Wavelength Calibrations

All spectroscopic reductions are done using the saltspec package. These include wavelength calibration, sky subtraction, aperture calibration, and flux calibration.

After loading the saltspec package, the first step is to determine the wavelength calibration for your data. The wavelength calibration is done by identifying lines of a known spectra in an Arc lamp. Download the appropriate (check the 'LAMPID' header in the ARC fits file) line atlas from http://pysalt.salt.ac.za/lineatlas/lineatlas.html .

See https://github.com/saltastro/pysalt/wiki/Short-Long-Slit-Reductions for usage details of the task specidentify.

specidentify(images='mfcbxgpP201205010026.fits', linelist='Ar.txt', outfile='db.sol', guesstype='rss', guessfile="", 
automethod='Matchlines', function='legendre', order='3', rstep='200', rstart='middlerow', mdiff='20', thresh='3', niter='5', 
startext='0', inter='yes', clobber='no', logfile='salt.log', verbose='yes')

The next step is rectify the images. We are going to apply the same wavelength calibration to the target observation. This can be done using specrectify:

specrectify(images='mfcbxgpP201205010024.fits,mfcbxgpP201205010025.fits',  outimages="", outpref='x', solfile='db.sol', 
caltype='line',  function='legendre', order='3', inttype='interp', w1='None', w2='None', dw='None', nw='None', blank='0.0', 
clobber='yes', logfile='salt.log', verbose='yes')

Extraction of Spectra

Then we will sky-subtract the target observation. At the moment, this is best done by identifying a sky section in the image. So it will be helpful to bring image mfcbxgpP201111050105.fits up in a ds9 image and identify an off-sky portion for the image. This can be done using specsky.

specsky(images='xmfcbxgpP*.fits', outimages="", outpref='s', method='normal', section='[800:1000]', clobber='yes', logfile='salt.log', verbose='yes')

Finally we will extract the 1-D spectra. After examining the image, identify the region to extract and run specextract.

specextract(images='sxmfcbxgpP201205010024.fits', outfile='agn.txt', method='normal', section='[1006:1050]', thresh='3.0', 
minsize='3.0', outformat='ascii', convert='yes', clobber='yes', logfile='salt.log', verbose='yes')

Flux Calibration

After extracting the spectra, sensitivity curves and flux calibration can be completed with specsens and speccal. Extinction curves and calibration spectra are available as part of the PySALT data package.

Expected Result

An example of a wavelength calibrated spectra as above is available here