I used imhead to create an imhead.list file for each night's observations. Using this, I created an @ file of Zeros for each night. I then ran zerocombine on these files.

noao.imred.ccdred.zerocombine
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = ccdred
   TASK = zerocombine
    
input   =          @zeros.list  List of zero level images to combine
(output =                 Zero) Output zero level name
(combine=              average) Type of combine operation
(reject =               minmax) Type of rejection
(ccdtype=                 zero) CCD image type to combine
(process=                   no) Process images before combining?
(delete =                   no) Delete input images after combining?
(clobber=                   no) Clobber existing output image?
(scale  =                 none) Image scaling
(statsec=                     ) Image section for computing statistics
(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=                   0.) ccdclip: CCD readout noise (electrons)
(gain   =                   1.) ccdclip: CCD gain (electrons/DN)
(snoise =                   0.) ccdclip: Sensitivity noise (fraction)
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(blank  =                   0.) Value if there are no pixels

I used hedit to set biassec in images hedit *.????.fits BIASSEC [2696:2708,1:256]

I used ccdproc to zero correct all the images.

noao.imred.ccdred.zerocombine
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = ccdred
   TASK = ccdproc
    
images  =               *.fits  List of CCD images to correct
(output =                     ) List of output CCD images
(ccdtype=                     ) CCD image type to correct
(max_cac=                    0) Maximum image caching memory (in Mbytes)
(noproc =                   no) List processing steps only?

(fixpix =                   no) Fix bad CCD lines and columns?
(oversca=                  yes) Apply overscan strip correction?
(trim   =                  yes) Trim the image?
(zerocor=                  yes) Apply zero level correction?
(darkcor=                   no) Apply dark count correction?
(flatcor=                   no) Apply flat field correction?
(illumco=                   no) Apply illumination correction?
(fringec=                   no) Apply fringe correction?
(readcor=                   no) Convert zero level image to readout correction?
(scancor=                   no) Convert flat field image to scan correction?
(readaxi=                 line) Read out axis (column|line)
(fixfile=                     ) File describing the bad lines and columns
(biassec=                image) Overscan strip image section
(trimsec=                     ) Trim data section
(zero   =                 Zero) Zero level calibration image
(dark   =                     ) Dark count calibration image
(flat   =                     ) Flat field images
(illum  =                     ) Illumination correction images
(fringe =                     ) Fringe correction images
(minrepl=                   1.) Minimum flat field value
(scantyp=            shortscan) Scan type (shortscan|longscan)
(nscan  =                    1) Number of short scan lines

(interac=                  yes) Fit overscan interactively?
(functio=            chebyshev) Fitting function
(order  =                    3) Number of polynomial terms or spline pieces
(sample =                    *) Sample points to fit
(naverag=                    1) Number of sample points to combine
(niterat=                    1) Number of rejection iterations
(low_rej=                   3.) Low sigma rejection factor
(high_re=                   3.) High sigma rejection factor
(grow   =                   1.) Rejection growing radius


I combined the flats from Nov. 30 into Flat.fits, and created two flats for Dec. 1, one with the filter (sFlat.fits) and one without the filter (qFlat.fits).

noao.imred.ccdred.zerocombine
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = ccdred
   TASK = flatcombine
    
input   =         @sflats.list  List of flat field images to combine
(output =                sFlat) Output flat field root name
(combine=              average) Type of combine operation
(reject =              ccdclip) Type of rejection
(ccdtype=                 flat) CCD image type to combine
(process=                  yes) Process images before combining?
(subsets=                  yes) Combine images by subset parameter?
(delete =                   no) Delete input images after combining?
(clobber=                   no) Clobber existing output image?
(scale  =                 mode) Image scaling
(statsec=                     ) Image section for computing statistics
(nlow   =                    1) 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)
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(blank  =                   1.) Value if there are no pixels

I used imarith to divide the quartz flats from each night; the std dev for any given point was around or less than 1%, so I used imcombine to create a combined flat (cFlat.fits) using the mean of the two.

I then used response to normalize this flat, creating nFlat.fits.

noao.twodspec.longslit.response
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = longslit
   TASK = response

calibrat=                cFlat  Longslit calibration images
normaliz=                cFlat  Normalization spectrum images
response=                nFlat  Response function images
(interac=                  yes) Fit normalization spectrum interactively?
(thresho=                INDEF) Response threshold
(sample =                    *) Sample of points to use in fit
(naverag=                    1) Number of points in sample averaging
(functio=              spline3) Fitting function
(order  =                   13) Order of fitting function
(low_rej=                   3.) Low rejection in sigma of fit
(high_re=                   3.) High rejection in sigma of fit
(niterat=                    1) Number of rejection iterations
(grow   =                   0.) Rejection growing radius
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input

I ran ccdproc again, changing:
(flatcor= yes) Apply flat field correction?
(flat = Flat) Flat field images
(interac= no) Fit overscan interactively?
(order = 4) Number of polynomial terms or spline pieces
(grow = 0.) Rejection growing radius


I combined the twilight images from each night using imcombine, then used response to normalize the image, and illumination to normalize in the other direction.

images.immatch.imcombine

                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = immatch
   TASK = imcombine
    
input   =            @twi.list  List of images to combine
output  =                  Sky  List of output images
(headers=                     ) List of header files (optional)
(bpmasks=                     ) List of bad pixel masks (optional)
(rejmask=                     ) List of rejection masks (optional)
(nrejmas=                     ) List of number rejected masks (optional)
(expmask=                     ) List of exposure masks (optional)
(sigmas =                     ) List of sigma images (optional)
(logfile=               STDOUT) Log file

(combine=              average) Type of combine operation
(reject =                 none) Type of rejection
(project=                   no) Project highest dimension of input images?
(outtype=                 real) Output image pixel datatype
(outlimi=                     ) Output limits (x1 x2 y1 y2 ...)
(offsets=                 none) Input image offsets
(masktyp=                 none) Mask type
(maskval=                   0.) Mask value
(blank  =                   0.) Value if there are no pixels

(scale  =                 mode) Image scaling
(zero   =                 none) Image zero point offset
(weight =                 none) Image weights
(statsec=                     ) Image section for computing statistics
(expname=                     ) Image header exposure time keyword

(lthresh=                INDEF) Lower threshold
(hthresh=                INDEF) Upper threshold
(nlow   =                    1) 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=                   0.) ccdclip: CCD readout noise (electrons)
(gain   =                   1.) 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 neighbor rejection

noao.imred.specred.response
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = response

calibrat=             Sky.fits  Longslit calibration images
normaliz=             Sky.fits  Normalization spectrum images
response=            nSky.fits  Response function images
(interac=                  yes) Fit normalization spectrum interactively?
(thresho=                INDEF) Response threshold
(sample =                    *) Sample of points to use in fit
(naverag=                    1) Number of points in sample averaging
(functio=             legendre) Fitting function
(order  =                    8) Order of fitting function
(low_rej=                   2.) Low rejection in sigma of fit
(high_re=                   3.) High rejection in sigma of fit
(niterat=                    5) Number of rejection iterations
(grow   =                   3.) Rejection growing radius
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input

The dispersion bins were deleted and re-selected, to avoid major lines.

noao.imred.specred.illumination
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = illumination

images  =            nSky.fits  Longslit calibration images
illumina=            iSky.fits  Illumination function images
(interac=                  yes) Interactive illumination fitting?
(bins   =                     ) Dispersion bins
(nbins  =                    5) Number of dispersion bins when bins = ""
(sample =                    *) Sample of points to use in fit
(naverag=                    1) Number of points in sample averaging
(functio=              spline3) Fitting function
(order  =                    3) Order of fitting function
(low_rej=                   3.) Low rejection in sigma of fit
(high_re=                   2.) High rejection in sigma of fit
(niterat=                    1) Number of rejection iterations
(grow   =                   2.) Rejection growing radius
(interpo=                poly3) Interpolation type
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input


I ran ccdproc, changing:
(illumco= yes) Apply illumination correction?
(illum = nSky) Illumination correction images


Using hselect, I created a list of stars and a list of arcs for each night. I used apall to extract the spectra.

noao.imred.specred.apall
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = apall
    
input   =          @stars.list  List of input images
(output =                     ) List of output spectra
(apertur=                     ) Apertures
(format =            multispec) Extracted spectra format
(referen=                     ) List of aperture reference images
(profile=                     ) List of aperture profile images

(interac=                  yes) Run task interactively?
(find   =                  yes) Find apertures?
(recente=                  yes) Recenter apertures?
(resize =                  yes) Resize apertures?
(edit   =                  yes) Edit apertures?
(trace  =                  yes) Trace apertures?
(fittrac=                  yes) Fit the traced points interactively?
(extract=                  yes) Extract spectra?
(extras =                  yes) Extract sky, sigma, etc.?
(review =                  yes) Review extractions?

(line   =                INDEF) Dispersion line
(nsum   =                 -500) Number of dispersion lines to sum or median

                                # DEFAULT APERTURE PARAMETERS

(lower  =                  -5.) Lower aperture limit relative to center
(upper  =                   5.) Upper aperture limit relative to center
(apidtab=                     ) Aperture ID table (optional)

                                # DEFAULT BACKGROUND PARAMETERS

(b_funct=            chebyshev) Background function
(b_order=                    2) Background function order
(b_sampl=        -40:-20,20:40) Background sample regions
(b_naver=                  -21) Background average or median
(b_niter=                    0) Background rejection iterations
(b_low_r=                   3.) Background lower rejection sigma
(b_high_=                   3.) Background upper rejection sigma
(b_grow =                   0.) Background rejection growing radius

                                # APERTURE CENTERING PARAMETERS

(width  =                  11.) Profile centering width
(radius =                  10.) Profile centering radius
(thresho=                   0.) Detection threshold for profile centering

                                # AUTOMATIC FINDING AND ORDERING PARAMETERS

nfind   =                    1  Number of apertures to be found automatically
(minsep =                   5.) Minimum separation between spectra
(maxsep =                1000.) Maximum separation between spectra
(order  =           increasing) Order of apertures

                                # RECENTERING PARAMETERS

(aprecen=                     ) Apertures for recentering calculation
(npeaks =                INDEF) Select brightest peaks
(shift  =                  yes) Use average shift instead of recentering?

                                # RESIZING PARAMETERS

(llimit =                 -10.) Lower aperture limit relative to center
(ulimit =                  10.) Upper aperture limit relative to center
(ylevel =                  0.1) Fraction of peak or intensity for automatic widt
(peak   =                  yes) Is ylevel a fraction of the peak?
(bkg    =                  yes) Subtract background in automatic width?
(r_grow =                   0.) Grow limits by this factor
(avglimi=                   no) Average limits over all apertures?

                                # TRACING PARAMETERS

(t_nsum =                  100) Number of dispersion lines to sum
(t_step =                   50) Tracing step
(t_nlost=                    3) Number of consecutive times profile is lost befo
(t_funct=             legendre) Trace fitting function
(t_order=                    5) Trace fitting function order
(t_sampl=                    *) Trace sample regions
(t_naver=                    1) Trace average or median
(t_niter=                    2) Trace rejection iterations
(t_low_r=                   3.) Trace lower rejection sigma
(t_high_=                   3.) Trace upper rejection sigma
(t_grow =                   0.) Trace rejection growing radius

                                # EXTRACTION PARAMETERS

(backgro=                  fit) Background to subtract
(skybox =                    1) Box car smoothing length for sky
(weights=             variance) Extraction weights (none|variance)
(pfit   =                fit1d) Profile fitting type (fit1d|fit2d)
(clean  =                  yes) Detect and replace bad pixels?
(saturat=               60000.) Saturation level
(readnoi=                    3) Read out noise sigma (photons)
(gain   =                    1) Photon gain (photons/data number)
(lsigma =                   4.) Lower rejection threshold
(usigma =                   4.) Upper rejection threshold
(nsubaps=                    1) Number of subapertures per aperture

The aperture trace changes between 2-4 pixels from one end to the other.
30nov05.0130 had a bad trace (lots of bumps), it also had a double spike, check image.
In the log, for 30nov05.0162-164, it says 'funny things happen'; 162 appears to be blank. I ignored these.
1dec05.0213 has a note in the log saying the star is on three positions on the slit; I only see two. (?) 1dec05.0239 has a brighter star offset, and a fainter stars centered; I chose the centered one.
1dec05.0267 has four equally bright stars, I chose the one closest to the center.
1dec05.0269 has one bright star on the edge, and a fainter one in the center; I chose the center one.
1dec05.0288 has very low counts and a bad trace
1dec05.0302 had a bumpy trace
1dec05.0311 has four stars, I chose the brightest one.
1dec05.0321 and 1dec05.0322 have very low counts and bad traces

Using the log, I made a .cl (arcsref.cl) file of arcs and the images they refer to, which I used to run apall for each night, changing:
(interac= no) Run task interactively?
(recente= no) Recenter apertures?
(trace = no) Trace apertures?
(review = no) Review extractions?
(backgro= none) Background to subtract

The filenames I used for the extracted arcs are date.arc#.star#.ms
1dec05.0274 does not exist? this should be an arc.


To wavelength calibrate the spectra, I used the calibration from the previous MMT data. I copied the arc spectra which I had used as a reference for that data into the 30nov05 directory as test.ms, and ran reid, refspec and dispcor on an arc and a star from the new data. The fit was good, and the process did not generate any errors, so I used reid on all of the arcs.

noao.imred.specred.reidentify
                                   I R A F  
                    Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = reidentify
    
referenc=         test.ms.fits  Reference image
images  =  *.????.????.ms.fits  Images to be reidentified
(interac=                  yes) Interactive fitting?
(section=          middle line) Section to apply to two dimensional images
(newaps =                  yes) Reidentify apertures in images not in reference?
(overrid=                   no) Override previous solutions?
(refit  =                  yes) Refit coordinate function?

(trace  =                   no) Trace reference image?
(step   =                   10) Step in lines/columns/bands for tracing an image
(nsum   =                   10) Number of lines/columns/bands to sum
(shift  =                   0.) Shift to add to reference features (INDEF to sea
(search =                   0.) Search radius
(nlost  =                    4) Maximum number of features which may be lost

(cradius=                   5.) Centering radius
(thresho=                   0.) Feature threshold for centering
(addfeat=                   no) Add features from a line list?
(coordli= linelists$idhenear.dat) User coordinate list
(match  =                  -3.) Coordinate list matching limit
(maxfeat=                   50) Maximum number of features for automatic identif
(minsep =                   2.) Minimum pixel separation

(databas=             database) Database
(logfile=              logfile) List of log files
(plotfil=                     ) Plot file for residuals
(verbose=                  yes) Verbose output?
(graphic=             stdgraph) Graphics output device
(cursor =                     ) Graphics cursor input

answer  =                  yes  Fit dispersion function interactively?
crval   =                       Approximate coordinate (at reference pixel)
cdelt   =                       Approximate dispersion
(aidpars=                     ) Automatic identification algorithm parameters

1dec05.0330.0327.ms has an RMS of 1.27, as it is not an arc (image deleted). I keep getting errors when I try to extract an arc using this star as a reference, so I will continue to work on it.

I ran refspec using a .cl file, refspec.cl, for each day's data.

noao.imred.specred.refspectra
                                       I R A F  
                        Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = refspectra

input   =     teststar.ms.fits  List of input spectra
(referen=      testarc.ms.fits) List of reference spectra
(apertur=                     ) Input aperture selection list
(refaps =                     ) Reference aperture selection list
(ignorea=                   no) Ignore input and reference apertures?
(select =              average) Selection method for reference spectra
(sort   =                   jd) Sort key
(group  =                  ljd) Group key
(time   =                   no) Is sort key a time?
(timewra=                  17.) Time wrap point for time sorting
(overrid=                   no) Override previous assignments?
(confirm=                  yes) Confirm reference spectrum assignments?
(assign =                  yes) Assign the reference spectra to the input spectrum?
(logfile=       STDOUT,logfile) List of logfiles
(verbose=                   no) Verbose log output?
answer  =                  YES  Accept assignment?

I ran dispcor on all the stars.

noao.imred.specred.dispcor
                                       I R A F  
                        Image Reduction and Analysis Facility
PACKAGE = specred
   TASK = dispcor
    
input   =        @starsms.list  List of input spectra
output  =     w//@starsms.list  List of output spectra
(lineari=                  yes) Linearize (interpolate) spectra?
(databas=             database) Dispersion solution database
(table  =                     ) Wavelength table for apertures
(w1     =                3513.) Starting wavelength
(w2     =                5520.) Ending wavelength
(dw     =                 0.75) Wavelength interval per pixel
(nw     =                 2685) Number of output pixels
(log    =                   no) Logarithmic wavelength scale?
(flux   =                  yes) Conserve flux?
(samedis=                   no) Same dispersion in all apertures?
(global =                   no) Apply global defaults?
(ignorea=                   no) Ignore apertures?
(confirm=                   no) Confirm dispersion coordinates?
(listonl=                   no) List the dispersion coordinates only?
(verbose=                  yes) Print linear dispersion assignments?
(logfile=                     ) Log file


Using the log, I double-checked the headers, and corrected the few which were incorrectly labeled.