DISCLAIMER: This manual for GEMINI GMOS reductions is just a guideline. It is something I have had to learn myself through toil, blood and sweat. If you want to use this manual to reduce GMOS, or maybe even other data, please do so, but be advised that this is *NOT THE* way of reducing multi-object spectra and it is absolutely *NOT* garantueed to be free of errors.

If you enjoyed this manual, have any suggestions/comments/questions/etc, you can send me an email on .

Creating the main bias

This is done using gbias.
PACKAGE = gmos
   TASK = gbias
    
inimages=                @bias  Input GMOS bias images or list
outbias = gS20050211S0044_bias  Output bias (zero level) image
(logfile=       biasPrep230305) Logfile
(rawpath=                     ) GPREPARE: Path for raw input images
(fl_over=                   no) Subtract overscan level
(fl_trim=                  yes) Trim overscan section
(key_bia=              BIASSEC) Header keyword for overscan strip image section
(key_dat=              DATASEC) Header keyword for data section (excludes the ov
(key_ron=              RDNOISE) Header keyword for readout noise
(key_gai=                 GAIN) Header keyword for gain (e-/ADU
(ron    =                  3.5) Readout noise value to use if keyword not found
(gain   =                  2.2) Gain value to use if keyword not found

(gaindb = gmos$data/gmosamps.dat) Database with gain data
(fl_vard=                   no) Create variance and data quality frames?
(sci_ext=                  SCI) Name of science extension
(var_ext=                  VAR) Name of variance extension
(dq_ext =                   DQ) Name of data quality extension
(bpm    =                     ) Bad Pixel Mask filename
(sat    =                65000) Saturation level in raw images

(fl_inte=                   no) Interactive overscan fitting
(median =                   no) Use median instead of average in column bias
(functio=            chebyshev) Overscan fitting function.
(order  =                    1) Order of overscan fitting function.
(low_rej=                   3.) Low sigma rejection factor.
(high_re=                   3.) High sigma rejection factor.
(niterat=                    3) Number of rejection iterations.

(combine=              average) Type of combination operation
(reject =            avsigclip) Type of rejection algorithm
(lthresh=                INDEF) Lower threshold for rejection before scaling
(hthresh=                INDEF) Upper threshold for rejection before scaling
(scale  =                 none) Image scaling
(zero   =                 none) Image zero point offset
(weight =                 none) Image weights
(statsec=                [*,*]) Image region for computing statistics
(key_exp=              EXPTIME) Header keyword for exposure time
(nlow   =                    0) minmax: Number of low pixels to reject
(nhigh  =                    1) minmax: Number of high pixels to reject
(nkeep  =                    1) Minimum to keep or maximum to reject
(mclip  =                  yes) Use median in sigma clipping algorithms?
(lsigma =                   3.) Lower sigma clipping factor
(hsigma =                   3.) Upper sigma clipping factor
(snoise =                  0.0) ccdclip: Sensitivity noise (electrons)
(sigscal=                  0.1) Tolerance for sigma clipping scaling correction
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(grow   =                   0.) Radius (pixels) for neighbor rejection

(verbose=                  yes) Verbose output?
(status =                    0) Exit status (0=good)
(scanfil=                     ) Internal use only
(flpar  =                   no) flush pfile on assign?
(mode   =                   ql)

General data reduction

Setup

First you have to set some variables.
set mdf=/home/westra/matrix/Gemini/cd01/proc_logs/
set gcalib=/home/westra/matrix/Gemini/reduction/bias/
set raw=/home/westra/matrix/Gemini/reduction/
or
set mdf=/home/westra/priv/matrix/Gemini/cd01/proc_logs/
set gcalib=/home/westra/priv/matrix/Gemini/reduction/bias/
set raw=/home/westra/priv/matrix/Gemini/reduction/
These directories are as follows: mdf contains the MDF of the observation, gcalib contains the bias files and raw has the raw data.

Preparing the flatfield

The first process to run in the gemini.gmos package is gsflat.
PACKAGE = gmos
   TASK = gsflat
    
      inflats = "S20050210S0121" Input flatfields
     specflat = "rgS20050210S0121_flat" Output normalized flat (MEF)
    fl_answer = yes             Continue interactive fitting?
 (fl_slitcorr = no)             Correct output for Illumination/Slit-Function
    (slitfunc = "")             Slit Function (MEF output of gsslitfunc)
     (fl_keep = yes)            Keep imcombined flat?
    (combflat = "rgS20050210S0121_comb") Filename for imcombined flat
     (fl_over = no)             Subtract overscan level
     (fl_trim = yes)            Trim off overscan region
     (fl_bias = yes)            Subtract bias image
     (fl_dark = no)             Subtract (scaled) dark image
   (fl_fixpix = no)             Interpolate across chip gaps
    (fl_vardq = no)             Create variance and data quality frames
        (bias = "gcalib$/gS20050211S0044_bias") Bias image
        (dark = "")             Dark image
 (key_exptime = "EXPTIME")      Exposure time header keyword
 (key_biassec = "BIASSEC")      Header keyword for overscan strip image section
 (key_datasec = "DATASEC")      Header keyword for data section (excludes the o
     (rawpath = "raw$")         GPREPARE: Path for input raw images
     (sci_ext = "SCI")          Name of science extension
     (var_ext = "VAR")          Name of variance extension
      (dq_ext = "DQ")           Name of data quality extension
     (key_mdf = "MASKNAME")     Header keyword for the MDF
     (mdffile = "")             MDF to use if keyword not found
      (mdfdir = "mdf$")         MDF database directory
         (bpm = "")             Name of bad pixel mask file or image
      (gaindb = "gmos$data/gmosamps.dat") Database with gain data
   (gratingdb = "gmos$data/GMOSgratings.dat") Gratings database file
    (filterdb = "gmos$data/GMOSfilters.dat") Filters database file
     (bpmfile = "gmos$data/chipgaps.dat") Info on location of chip gaps
    (refimage = "")             Reference image for slit positions
         (sat = 65000.)         Saturation level in raw images
     (xoffset = INDEF)          X offset in wavelength [nm]
     (yoffset = INDEF)          Y offset in unbinned pixels
        (yadd = 0.)             Additional pixels to add to each end of MOS sli
  (fl_usegrad = yes)            Use gradient method to find MOS slits
     (fl_emis = no)             mask emission lines from lamp (affected pixels 
    (fl_inter = no)             Fit response interactively?
    (fl_detec = no)             Fit response detector by detector rather than s
    (function = "spline3")      Fitting function for response
       (order = "29")           Order of fitting function, minimum value=1
  (low_reject = 3.)             Low rejection in sigma of response fit
 (high_reject = 3.)             High rejection in sigma of response fit
    (niterate = 2)              Number of rejection iterations in response fit
     (combine = "average")      Combination operation
      (reject = "avsigclip")    Rejection algorithm
       (scale = "mean")         Image scaling
        (zero = "none")         Image zeropoint offset
      (weight = "none")         Image weights
     (statsec = "")             Statistics section
  (lthreshold = INDEF)          Lower threshold
  (hthreshold = INDEF)          Upper threshold
        (nlow = 1)              minmax: Number of low pixels to reject
       (nhigh = 1)              minmax: Number of high pixels to reject
       (nkeep = 0)              Minimum to keep or maximum to reject
       (mclip = yes)            Use median in sigma clipping algorithms?
      (lsigma = 3.)             Lower sigma clipping factor
      (hsigma = 3.)             Upper sigma clipping factor
     (key_ron = "RDNOISE")      Keyword for readout noise in e-
    (key_gain = "GAIN")         Keyword for gain in electrons/ADU
         (ron = 3.5)            Readout noise rms in electrons
        (gain = 2.2)            Gain in e-/ADU
      (snoise = "0.0")          ccdclip: Sensitivity noise (electrons)
    (sigscale = 0.1)            Tolerance for sigma clipping scaling correction
       (pclip = -0.5)           pclip: Percentile clipping parameter
        (grow = 0.)             Radius (pixels) for neighbor rejection
 (ovs_flinter = no)             Interactive overscan fitting?
     (ovs_med = no)             Use median instead of average in column bias?
    (ovs_func = "chebyshev")    Overscan fitting function
   (ovs_order = 1)              Order of overscan fitting function
    (ovs_lowr = 3.)             Low sigma rejection factor
   (ovs_highr = 3.)             High sigma rejection factor
   (ovs_niter = 2)              Number of rejection iterations
     (logfile = "")             Logfile name
     (verbose = yes)            Verbose
      (status = 1)              Exit status (0=good)
    (scanfile = "")             Internal use only
       (flpar = no)             flush pfile on assign?
        (mode = "ql")           

Spectra specific data reduction

Setup

Set the instrumental resolution for gscrrej which is called from gsreduce. This value can be found by getting the FWHM using IRAF's implot on the arcframes.
gscrrej.datares=5.

Cutting up

Find the slit edges with gscut.
gscut rgS20050210S0121_comb fl_update+ gradimage=rgS20050210S0121_comb

Biassubtraction and flatfielding

Start reducing the images, where it will use the flatfields, biases and all other information it can find to finish the reduction. It also does a crude cosmic ray rejection.
gsreduce S20050210S0122 rawpath=raw$ fl_fixp- \
bias=gcalib$gS20050211S0044_bias.fits flat=rgS20050210S0121_flat.fits \
mdfdir=mdf$ fl_gscrrej+ refimage=rgS20050210S0121_comb
Now do apply everything, except flatfielding and cosmic rejection to the arc.
gsreduce S20050217S0011 rawpath=raw$ fl_fixp- \
fl_flat- fl_dark- bias=gcalib$gS20050211S0044_bias.fits \
mdfdir=mdf$ refimage=rgS20050210S0121_comb

Wavelength calibration

Find a wavelength solution for the arc.
gswavelength gsS20050217S0011 coordlist="linelists$cuar.dat" \
fwidth=11 cradius=5 minsep=5 aiddebug=s order=4 match=-5 \
fitcxord=4 fitcyord=2 thresh=1000 nsum=5 step=5 trace=no \
fl_addfeat-
Rectify the arcs and spectra.
gstransform gsS20050217S0011,gsS20050210S0122 \
wavtran=gsS20050217S0011
Do now exactly the same for frames with the same mask, but different wavelength settings.

Combing spectra with different wavelength settings

First, extract the spectra from the MEF created by the Gemini package. This is easiest done by using imcopy.
imcopy tgsS20050210S0122[SCI,2] spect122_02
imcopy tgsS20050210S0123[SCI,2] spect123_02
It is rather important which scombine routine is used now. Use the one from the noao.onedspec package. To make sure it is used, load this package!!!

Combining only *2* spectra

This is a tricky business. Assuming that the chipgaps are filled with extremely high values, this is not too hard to do. Use noao.onedspec.scombine to combine the spectra. Also great for getting rid of more artefacts is to use a low threshold next to the high one. To get rid of the cosmics, use the `minmax' rejection algorithm with only rejection of the high pixels. It's also important to use `average' combining, though with 2 images `median' is exactly the same and with the 1 pixel clipping only 1 pixel usually remains.

When using different exposure times, add this value to the respective spectra and update the `scale' and `weights' parameters to the value `exposure'.
PACKAGE = onedspec
   TASK = scombine
    
input   = spect122_02,spect123_02  List of input spectra
output  =              spect02  List of output spectra
(noutput=                     ) List of output number combined spectra
(logfile=               STDOUT) Log file

(apertur=                     ) Apertures to combine
(group  =            apertures) Grouping option
(combine=              average) Type of combine operation
(reject =               minmax) Type of rejection

(first  =                   no) Use first spectrum for dispersion?
(w1     =                INDEF) Starting wavelength of output spectra
(w2     =                INDEF) Ending wavelength of output spectra
(dw     =                INDEF) Wavelength increment of output spectra
(nw     =                INDEF) Length of output spectra
(log    =                   no) Logarithmic increments?
(scale  =                 none) Image scaling
(zero   =                 none) Image zero point offset
(weight =                 none) Image weights
(sample =                     ) Wavelength sample regions for statistics

(lthresh=                   0.) Lower threshold
(hthresh=               25000.) Upper threshold
(nlow   =                    0) minmax: Number of low pixels to reject
(nhigh  =                    1) minmax: Number of high pixels to reject
(nkeep  =                    1) Minimum to keep (pos) or maximum to reject (neg)
(mclip  =                  yes) Use median in sigma clipping algorithms?
(lsigma =                   3.) Lower sigma clipping factor
(hsigma =                   3.) Upper sigma clipping factor
(rdnoise=              RDNOISE) ccdclip: CCD readout noise (electrons)
(gain   =                 GAIN) ccdclip: CCD gain (electrons/DN)
(snoise =                   0.) ccdclip: Sensitivity noise (fraction)
(sigscal=                  0.1) Tolerance for sigma clipping scaling corrections
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(grow   =                    0) Radius (pixels) for 1D neighbor rejection
(blank  =                   0.) Value if there are no pixels
(mode   =                   ql)

Background subtraction

Remove the background with noao.twodspec.longslit.background.

Standard star reduction

Two new settings in comparison to normal: the mdf is now 1.0arcsec, which is delivered with the gemini-package and probably another data directory. This is set by
set mdf=gmos$data/
set gcalib=/home/westra/matrix/Gemini/reduction/bias/
set raw=/home/westra/matrix/Gemini/reduction/stdstar/LTT3864_81_84/
Make sure the right bias is there. Usually a 2x1 binning and central spectrum. Then apply as above gsflat. No cutting up this time, as it is only one spectrum! Check the instrumental resolution for the cosmic rejection. Seems to be the same as normally.
gscrrej.datares=5.
Reduce the spectra
gsreduce S20050208S0083,S20050208S0084 rawpath=raw$ fl_fixp- \
bias=gcalib$gS20050211S0019_bias.fits flat=rgS20050208S0081_flat.fits \
mdfdir=mdf$ fl_gscrrej+ refimage=rgS20050208S0081_comb
Do the arcs
gsreduce S20050208S0082 rawpath=raw$ fl_fixp- \
fl_flat- fl_dark- bias=gcalib$gS20050211S0019_bias.fits \
mdfdir=mdf$ refimage=rgS20050208S0081_comb
Add the wavelength solution (notice that yorder is now 3!!)
gswavelength gsS20050208S0082 coordlist="linelists$cuar.dat" \
fwidth=11 cradius=5 minsep=5 aiddebug=s order=4 match=-5 \
fitcxord=4 fitcyord=3 thresh=1000 nsum=5 step=5 trace=no \
fl_addfeat-
Rectify the arc and spectra
gstransform gsS20050208S0082,gsS20050208S0083,gsS20050208S0084 \
wavtran=gsS20050208S0082
Backgroundsubtract the standard star using gsskysub
PACKAGE = gmos
   TASK = gsskysub
    
input   = tgsS20050208S0083,tgsS20050208S0084  Input GMOS spectra
fl_answe=                INDEF  Continue with interactive fitting
(output =                     ) Output spectra
(outpref=                    s) Output prefix
(sci_ext=                  SCI) Name of science extension
(var_ext=                  VAR) Name of variance extension
(dq_ext =                   DQ) Name of data quality extension
(fl_vard=                   no) Propagate VAR/DQ planes
(long_sa=                    *) Sky sample for LONGSLIT
(mos_sam=                  0.9) MOS: Maximum fraction of slit length to use as s
(mosobjs=                   1.) MOS: Size of object aperture in arcsec
(naverag=                    1) Number of points in sample averaging
(functio=            chebyshev) Function to fit
(order  =                    2) Order for fit
(low_rej=                  2.5) Low rejection in sigma of fit
(high_re=                  2.5) High rejection in sigma of fit
(niterat=                    2) Number of rejection iterations
(grow   =                   0.) Rejection growing radius in pixels
(fl_inte=                  yes) Fit interactively
(logfile=                     ) Logfile name
(verbose=                  yes) Verbose?
(status =                    0) Exit status (0=good)
(scanfil=                     ) For internal use only
(mode   =                   ql)
Extract the spectra with gsextract
PACKAGE = gmos
   TASK = gsextract
    
inimages= stgsS20050208S0083,stgsS20050208S0084  Input images
(outimag=                     ) Output images
(outpref=                    e) Output prefix
(refimag=                     ) Reference images for tracing apertures
(apwidth=                   1.) Extraction aperture in arcsec (diameter)
(fl_inte=                  yes) Run interactively?
(find   =                  yes) Define apertures automatically?
(recente=                  yes) Recenter apertures?
(trace  =                  yes) Trace apertures?
(tfuncti=            chebyshev) Trace fitting function
(torder =                    2) Trace fitting function order
(tnsum  =                  100) Number of dispersion lines to sum for trace
(tstep  =                   50) Tracing step
(weights=                 none) Extraction weights (none|variance)

(clean  =                   no) Detect and replace bad pixels?
(lsigma =                   3.) Lower rejection threshold for cleaning
(usigma =                   3.) Upper rejection threshold for cleaning

(backgro=                  fit) Background subtraction method
(bfuncti=            chebyshev) Background function
(border =                    2) Order of background fit
(long_bs=    -300:-150,150:300) LONGSLIT: backgr sample regions, WRT aperture
(mos_bsa=                  0.8) MOS: fraction of slit length to use (bkg+obj)
(bnavera=                   10) Number of samples to average over
(bnitera=                    2) Number of rejection iterations
(blow_re=                  2.5) Background lower rejection sigma
(bhigh_r=                  2.5) Background upper rejection sigma
(bgrow  =                   0.) Background rejection growing radius (pix)

(fl_vard=                   no) Propagate VAR/DQ planes? (if yes, must use varia
(sci_ext=                  SCI) Name of science extension
(var_ext=                  VAR) Name of variance extension
(dq_ext =                   DQ) Name of data quality extension
(key_ron=              RDNOISE) Keyword for readout noise in e-
(key_gai=                 GAIN) Keyword for gain in electrons/ADU
(ron    =                  3.5) Default readout noise rms in electrons
(gain   =                  2.2) Default gain in e-/ADU
(logfile=                     ) Logfile
(verbose=                  yes) Verbose?
(status =                    0) Exit status (0=good)
(scanfil=                     ) Internal use
(mode   =                   ql)
Derive the standard using gsstandard. Multiple input gives one combined sensitivity function.
PACKAGE = gmos
   TASK = gsstandard
    
input   = estgsS20050208S0083,estgsS20050208S0083  Input image(s)
sfile   =                  std  Output flux file (used by SENSFUNC)
sfunctio=                 sens  Output root sensitivity function image name
(sci_ext=                  SCI) Name or number of science extension
(key_air=              AIRMASS) Header keyword for airmass
(key_exp=              EXPTIME) Header keyword for exposure time
(fl_inte=                  yes) Run the task interactively
(starnam=          l3864,l3864) Standard star name(s) in calibration list
(samesta=                  yes) Same star in all apertures
(apertur=                     ) Aperture selection list
(beamswi=                   no) Beam switch spectra
(bandwid=                INDEF) Bandpass width
(bandsep=                INDEF) Bandpass separation
(fnuzero=  3.6800000000000E-20) Absolute flux zero point
(caldir =                   ./) Directory containing calibration data
(observa=         Gemini-South) Observatory
(mag    =                     ) Magnitude of stars
(magband=                     ) Magnitude types/bands (U|B|V|R|I|J|H|K|L|Lprime|
(teff   =                     ) Effective temperature of spectral types
(ignorea=                  yes) Ignore apertures and make one sensitivity functi
(extinct= onedstds$ctioextinct.dat) Extinction file
(out_ext=          extinct.dat) Output revised extinction file
(functio=              spline3) Fitting function
(order  =                    6) Order of fit
(graphs =                   sr) Graphs per frame
(marks  =       plus cross box) Data mark types (marks deleted added)
(colors =              2 1 3 4) Colors (lines marks deleted added)
(verbose=                  yes) Verbose?
(logfile=                     ) Logfile name
(status =                    0) Exit status (0=good)
(scanfil=                     ) For internal use only
(mode   =                   ql)