# Reductions for SOAR-4m data (Oct 30-31, 2017): # Note that the spectrum we want is always very # near the same position in the slit; for the # default TRIMSEC values, the spectrum is always # near or at line 440. (This exact value may # change if the TRIMSEC values are changed, but # will be the same value for all the 2D spectra # processed with the same TRIMSEC values; e.g., # for the TRIMSEC values I used here, the target # is generally near or at line 405 after the 2D # processing.) Open up ds9 and an xgterm window. Then, within the xgterm window: % cd ~/IRAF #(or your IRAF directory, where your login.cl and/or loginuser.cl are) % pyraf --> cd /Users/dtucker/Desktop/Data/Reductions/2017-10-30 --> imhead *.fits --> hselect *.fits $I,obstype,object yes # Preliminaries #-------------- Check over the log to make sure there were no mistakes in any of the file names or if any of the files are junk ("not to be used"). You might also use IRAF's hedit to fix any obvious FITS header issues at this point (e.g., if the log says the OBJECT name in the header is incorrect for a given file or set of files). It is easier to deal with such issues now than later in the data reduction process. #2D Spectra #---------- # plot dome flat exposure to verify trimsec and biassec regions... # Open with ds9, as well as: --> display 0030_dflat_100p_7s.fits 1 --> implot 0030_dflat_100p_7s.fits # the following looks like a good range for the BIASSEC: --> hedit *.fits TRIMSEC "[350:2050,36:864]" update+ ve- --> hedit *.fits BIASSEC "[1:7,36:864]" add+ ve- --> ccdlist *.fits --> hselect *.fits $I,trimsec,biassec yes --> unlearn ccdred --> setinstrument # choose specphot # for ccdproc, set biassec=image, trimsec=image, zero=Zero, order=3 # Create master bias ("zero") frame... --> hselect *.fits $I 'OBSTYPE=="BIAS"' > bias.list --> zerocombine @bias.list o=Zero ccdtype='' # ... then take a look at it... --> display Zero 1 # Combine flats... --> files *_dflat*.fits > flat.list --> epar flatcombine --> flatcombine @flat.list o=Flat subsets- ccdtype='' --> display Flat.fits 1 # Create list of images (science objects, standard stars, and # wavelength-calibration arc lamps) to be processed by ccdproc... --> hselect *.fits $I 'OBSTYPE == "OBJECT"' > objcomp.list --> hselect *comp*.fits $I 'OBSTYPE == "COMP"' >> objcomp.list (you can edit frames you don't want to process out from objcomp.list if you so desire...) # Fit the overscan, trim, and apply the master bias (zero) frame Zero... --> ccdlist @objcomp.list --> ccdproc @objcomp.list --> ccdlist @objcomp.list # Create response function... --> response Flat Flat Resp # use the following when running response: fit interactively: yes :func spline3 :order 100 f k h q # Display the response image... --> display Resp.fits 1 # Flatten 2D spectra (along the spatial direction of slit) --> ccdproc @objcomp.list flatcor+ flat=Resp --> ccdlist @objcomp.list #1D Spectra #---------- # Which spectrophotometric standards were observed? --> hselect @objcomp.list $I,imagetyp,object 'OBSTYPE=="OBJECT"' # Turns out that both LTT7987 and LTT2415 are both in the IRAF # onedstds library of spectrophotometric standards. # # There are several versions of the LTT7987 and LTT2415 calibration # files in the IRAF onedstds library. The l7987blue.dat and # l2415blue.dat files in the ctionewcal subdirectory cover # the range of wavelengths in the SOAR spectra with a reasonable # wavelength resolution. Let's use them. --> dir onedstds$ --> page onedstds$README # The calibrated LTT7987 spectrum in onedstds$ctionewcal/l7987blue.dat: --> page onedstds$ctionewcal/l7987blue.dat # The calibrated LTT2415 spectrum in onedstds$ctionewcal/l2415blue.dat: --> page onedstds$ctionewcal/l2415blue.dat # Note that the fluxes in these files are in AB magnitudes; # this is how the IRAF sensfunc task likes its spectrophotometric files. # Now epar specred... --> epar specred (extinct= onedstds$ctioextinct.dat) Extinction file (caldir = onedstds$ctionewcal/) Standard star calibration directory # Now do all the other prep work for running the IRAF task doslit... # Grab the SOAR4m HgAr+Ne linelist from # http://data.darkenergysurvey.org/public_calib/DESCalibObsRuns/SOAR-Oct2017/goodman_hgarne.dat # and the plots of the HgAr and HgAr+Ne wavecal spectra from # http://www.ctio.noao.edu/soar/sites/default/files/Instrument_Plots/400m1_HgAr_3000-7000.pdf # and # http://www.ctio.noao.edu/soar/sites/default/files/GOODMAN/HgArNe_400M2_GG455_full.pdf # # Copy th linelist goodman_hgarne.dat into the current directory where you are # reducing this night's data. # Edit doslit params... --> epar doslit (readnoi= rdnoise) Read out noise sigma (photons) (gain = gain) Photon gain (photons/data number) (datamax= 55000.0) Max data value / cosmic ray threshold (dispcor= yes) Dispersion correct spectra? (extcor = yes) Extinction correct spectra? (fluxcal= yes) Flux calibrate spectra? (resize = no) Automatically resize apertures? (splot = yes) Plot the final spectrum? # Edit sparams... --> epar sparams (line = 405) Default dispersion line (nsum = 15) Number of dispersion lines to sum or median (extras = yes) Extract sky, sigma, etc.? (lower = -8.) Lower aperture limit relative to center (upper = 8.) Upper aperture limit relative to center (t_step = 10) Tracing step -- BACKGROUND SUBTRACTION PARAMETERS -- (backgro= fit) Background to subtract (b_funct= chebyshev) Background function (b_order= 2) Background function order (b_sampl= -25:-15,15:25) Background sample regions (b_naver= -3) Background average or median -- ARC DISPERSION FUNCTION PARAMETERS -- (coordli= goodman_hgarne.dat) Line list -- AUTOMATIC ARC ASSIGNMENT PARAMETERS -- (select = following) Selection method for reference spectra (sort = ut) Sort key (group = ) Group key (time = yes) Is sort key a time? # Set observatory to SOAR... --> observatory set soar # Run setairmass... --> hselect @objcomp.list $I,obstype,object,lst,equinox,ut,date-obs,exptime yes --> epar setairmass (equinox= equinox) Equinox keyword (years) (st = lst) Local siderial time keyword (hours) (ut = ut) Universal time keyword (hours) (date = date-obs) Observation date keyword (exposur= exptime) Exposure time keyword (seconds) # Edit standard params... --> epar standard output = std Output flux file (used by SENSFUNC) # Edit sensfunc params... --> epar sensfunc standard= std Input standard star data file (from STANDARD) sensitiv= sens Output root sensitivity function imagename # Edit calibrate params... --> epar calibrate (extinction= onedstds$ctioextinct.dat) Extinction file (sensiti= sens) Image root name for sensitivity spectra # Prepare the object lists... # ... first the target (science) images --> copy objcomp.list target.list --> !xemacs target.list & # delete the arc lamp exposures and the std stars. # here, LTT7987 and LTT2415 are our only std stars # ... next the arc comparison lamp exposures --> copy objcomp.list comp.list --> !xemacs comp.list & # delete everything but the arc lamp exposures # ... finally the spectrophotometric stds --> copy objcomp.list stds.list --> !xemacs stds.list & # delete everything but standard stars # here, LTT7987 and LTT2415 are our only std stars --> hselect @target.list $I,obstype,object yes --> hselect @comp.list $I,obstype,object yes --> hselect @stds.list $I,obstype,object yes # Using the automated matching between targets and reference wavecals # in doslit/sparams (the nearest wavecal in time following the target # is used as the reference spectrum). However, one can also explicitly # create a reference table, as below, if one wants... ## Now create a reference table, linking the science and standard star ## exposures to their respective arc comparison lamp exposures: #--> files @target.list > reftable #--> files @stds.list >> reftable #--> !emacs reftable & ## For the current night, the reference table should look like ## the following (minus the "## " on each line): ## 0134_xxx.fits 0133_comp.fits ## 0135_yyy.fits 0133_comp.fits ## 0136_obj264.fits 0139_comp264.fits ## 0137_obj264.fits 0139_comp264.fits ## 0138_obj264.fits 0139_comp264.fits ## 0144_obj266.fits 0148_comp266.fits ## 0145_obj266.fits 0148_comp266.fits ## 0146_obj266.fits 0148_comp266.fits ## 0147_obj266.fits 0148_comp266.fits ## 0153_obj269.fits 0156_comp269.fits ## 0154_obj269.fits 0156_comp269.fits ## 0155_obj269.fits 0156_comp269.fits ## 0161_obj270.fits 0164_comp270.fits ## 0162_obj270.fits 0164_comp270.fits ## 0163_obj270.fits 0164_comp270.fits ## 0169_obj271.fits 0172_comp271.fits ## 0170_obj271.fits 0172_comp271.fits ## 0171_obj271.fits 0172_comp271.fits ## 0177_obj273.fits 0180_comp273.fits ## 0178_obj273.fits 0180_comp273.fits ## 0179_obj273.fits 0180_comp273.fits ## 0185_obj274.fits 0189_comp276.fits ## 0186_obj276.fits 0189_comp276.fits ## 0187_obj276.fits 0189_comp276.fits ## 0188_obj276.fits 0189_comp276.fits ## 0194_obj278.fits 0197_comp278.fits ## 0195_obj278.fits 0197_comp278.fits ## 0196_obj278.fits 0197_comp278.fits ## 0202_obj284.fits 0207_comp288.fits ## 0203_obj285.fits 0207_comp288.fits ## 0204_obj288.fits 0207_comp288.fits ## 0205_obj288.fits 0207_comp288.fits ## 0206_obj288.fits 0207_comp288.fits ## 0212_obj289.fits 0215_comp289.fits ## 0213_obj289.fits 0215_comp289.fits ## 0214_obj289.fits 0215_comp289.fits ## 0220_obj314.fits 0223_comp314.fits ## 0221_obj314.fits 0223_comp314.fits ## 0222_obj314.fits 0223_comp314.fits ## 0228_obj315.fits 0232_comp317.fits ## 0229_obj317.fits 0232_comp317.fits ## 0230_obj317.fits 0232_comp317.fits ## 0231_obj317.fits 0232_comp317.fits ## 0237_obj322.fits 0246_comp327.fits ## 0238_obj327.fits 0246_comp327.fits ## 0239_obj327.fits 0246_comp327.fits ## 0240_obj327.fits 0246_comp327.fits ## 0251_obj331.fits 0254_comp331.fits ## 0252_obj331.fits 0254_comp331.fits ## 0253_obj331.fits 0254_comp331.fits ## 0259_obj360.fits 0262_comp360.fits ## 0260_obj360.fits 0262_comp360.fits ## 0261_obj360.fits 0262_comp360.fits ## 0267_obj369.fits 0270_comp369.fits ## 0268_obj369.fits 0270_comp369.fits ## 0269_obj369.fits 0270_comp369.fits ## 0275_obj372.fits 0278_comp372.fits ## 0276_obj372.fits 0278_comp372.fits ## 0277_obj372.fits 0278_comp372.fits ## 0283_obj373.fits 0286_comp373.fits ## 0284_obj373.fits 0286_comp373.fits ## 0285_obj373.fits 0286_comp373.fits ## 0291_obj374.fits 0294_comp374.fits ## 0292_obj374.fits 0294_comp374.fits ## 0293_obj374.fits 0294_comp374.fits ## 0299_obj381.fits 0302_comp381.fits ## 0300_obj381.fits 0302_comp381.fits ## 0301_obj381.fits 0302_comp381.fits ## 0307_obj389.fits 0310_comp389.fits ## 0308_obj389.fits 0310_comp389.fits ## 0309_obj389.fits 0310_comp389.fits ## 0126_ltt7987.fits 0129_comp_ltt7987.fits ## 0127_ltt7987.fits 0129_comp_ltt7987.fits ## 0128_ltt7987.fits 0129_comp_ltt7987.fits ## 0315_ltt2415.fits 0318_ltt2415.fits ## 0316_ltt2415.fits 0318_ltt2415.fits ## 0317_ltt2415.fits 0318_ltt2415.fits # ... and finally run doslit... # with reftable: --> doslit @target.list arcs=@comp.list arctable="reftable" standar=@stds.list # or without reftable: --> doslit @target.list arcs=@comp.list standar=@stds.list # Now, median-combine the individual 1D (".ms.fits") spectra for each science target; e.g.: --> files ????_obj266.ms.fits > obj266.list --> scombine @obj266.list SSSJ202720.8-472359_obj266.ms.fits combine=median scale=median --> splot SSSJ202720.8-472359_obj266.ms.fits # Convert each of the IRAF 1D combined spectra into ASCII format # (suitable for plotting in, e.g., TOPCAT)... # In the resulting ASCII table, column 1 is the wavelength (in Angstroms) # and column2 is the specific flux (in erg/cm2/s/Angstrom) --> onedspec --> wspectext SSSJ202720.8-472359_obj266.ms.fits SSSJ202720.8-472359_obj266.ms.txt header-