예제 #1
0
파일: kast_redux.py 프로젝트: cenko/python
def red_science(image, flats, spath, object=None, arc='Arc-Red.fits', 
                smooth='BD284211.smooth.fits', telluric='telluric.fits',
                sens='BD284211.sens', biassec=REDBIAS, trimsec=REDTRIM, 
                outflat='Flat-Red.fits', gain=REDGAIN, rdnoise=REDRDNOISE):

    '''Full reduction of KAST science spectra on red CCD'''

    # Bias subtract everything first
    redbias(image, biassec=biassec, trimsec=trimsec)
    redbias(flats, biassec=biassec, trimsec=trimsec)

    # Create and apply flat-field
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc(image[0], ccdtype='', noproc=no, fixpix=no, overscan=no, 
                 trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no,
                 fringecor=no, readcor=no, scancor=no, flat=outflat)

    # Cosmic ray rejection
    #iraf.lacos_spec(image[0], 'c%s' % image[0], 'cm%s' % image[0],
    #                gain=gain, readn=rdnoise, xorder=9, yorder=3,
    #                sigclip=4.5, sigfrac=0.5, objlim=1.0, niter=3)

    # Extract spectrum
    if object==None:
        object=get_head(image, 'OBJECT')
    iraf.apall('%s' % image[0], output=object, references='', interactive=yes, 
               find=yes, recenter=yes, resize=yes, edit=yes, trace=yes, 
               fittrace=yes, extract=yes, extras=yes, review=no, 
               background='fit', weights='variance', pfit='fit1d', 
               readnoise=rdnoise, gain=gain)

    # Apply wavelength solution to standard
    shutil.copy('%s/%s' % (spath, arc), '.')
    shutil.copy('%s/database/id%s' % (spath, arc.rstrip('.fits')), 'database')
    iraf.refspec(object, references=arc, sort="", group="", override=yes,
                 confirm=no, assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Smooth
    shutil.copy('%s/%s' % (spath, smooth), '.')
    iraf.sarith('%s.w' % object, '/', smooth, '%s.s' % object)

    # Create and apply telluric correction
    shutil.copy('%s/%s' % (spath, telluric), '.')
    iraf.telluric('%s.s' % object, '%s.t' % object, telluric, xcorr=yes,
                  tweakrms=yes, interactive=yes, sample='6850:6950,7575:7700')

    # Flux calibration
    shutil.copy('%s/%s.0001.fits' % (spath, sens), '.')
    iraf.calibrate('%s.t' % object, '%s.f' % object, extinct=yes, flux=yes,
                   extinction='onedstds$kpnoextinct.dat', 
                   observatory='Lick', sensitivity=sens, airmass='',
                   exptime='')

    return
예제 #2
0
파일: kast_redux.py 프로젝트: cenko/python
def blue_science(image, spath, object=None, flat='Flat-Blue.fits', 
                 arc='Arc-Blue.fits', smooth='BD284211.smooth.fits',
                 sens='BD284211.sens', biassec1=BLUEBIAS1, trimsec1=BLUETRIM1,
                 biassec2=BLUEBIAS2, trimsec2=BLUETRIM2, gain=BLUEGAIN, 
                 rdnoise=BLUERDNOISE):

    '''Full reduction of KAST science spectra on blue CCD'''

    # Bias subtract everything first
    bluebias(image, biassec1=biassec1, trimsec1=trimsec1, biassec2=biassec2,
             trimsec2=trimsec2)

    # Apply flat-field
    shutil.copy('%s/%s' % (spath, flat), '.')
    iraf.ccdproc('j%s' % image[0], ccdtype='', noproc=no, fixpix=no, 
                 overscan=no, trim=no, zerocor=no, darkcor=no, flatcor=yes, 
                 illumcor=no, fringecor=no, readcor=no, scancor=no, 
                 flat=flat)

    # Cosmic ray rejection
   #iraf.lacos_spec('j%s' % image[0], 'cj%s' % image[0], 'cmj%s' % image[0],
   #                gain=gain, readn=rdnoise, xorder=9, yorder=3,
   #                sigclip=4.5, sigfrac=0.5, objlim=1.0, niter=3)

    # Extract spectrum
    if object==None:
        object=get_head(image, 'OBJECT')
    iraf.apall('j%s' % image[0], output=object, references='', 
               interactive=yes, find=yes, recenter=yes, resize=yes, edit=yes, 
               trace=yes, fittrace=yes, extract=yes, extras=yes, review=no, 
               background='fit', weights='variance', pfit='fit1d', 
               readnoise=rdnoise, gain=gain)

    # Apply wavelength solution to standard
    shutil.copy('%s/%s' % (spath, arc), '.')
    shutil.copy('%s/database/id%s' % (spath, arc.rstrip('.fits')), 'database')
    iraf.refspec(object, references=arc, sort="", group="", override=yes,
                 confirm=no, assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Smooth
    shutil.copy('%s/%s' % (spath, smooth), '.')
    iraf.sarith('%s.w' % object, '/', smooth, '%s.s' % object)

    # Flux calibration
    shutil.copy('%s/%s.0001.fits' % (spath, sens), '.')
    iraf.calibrate('%s.s' % object, '%s.f' % object, extinct=yes, flux=yes,
                   extinction='onedstds$kpnoextinct.dat', 
                   observatory='Lick', sensitivity=sens, airmass='',
                   exptime='')

    return
예제 #3
0
os.system("rm "+extracted_filename+" "+calibrated_filename)

# Run the spectral extraction program.

iraf.apextract.setParam("dispaxis", "1")

iraf.apall(input=filename, find="No", recenter="No", resize="No",interactive="Yes")




# Make sure that the dispersion axis is in the header.

iraf.hedit(images=[filename], fields=["DISPAXIS"], value=["1"], add="Yes")
iraf.identify(filename[:-5], coordli=home+"/Downloads/HgNe(1).dat",
              section="line 105 125",
              crval=crval,
              cdelt=dispersion,
              fwidth=5)

# Tell the extracted spectrum what the wavelength solutions are.
iraf.hedit(images=[extracted_filename],
           fields=["REFSPEC1"], \
        value=[filename], add="Yes")
iraf.refspec(input = extracted_filename,referen=filename[:-5],sort='',group='',confirm='no')
iraf.dispcor(input=extracted_filename,
             output=calibrated_filename)

# Plot the extracted spectrum?
iraf.splot(calibrated_filename)
예제 #4
0
파일: kast_redux.py 프로젝트: cenko/python
def red_standard(image, arcs, flats, object=None, biassec=REDBIAS, 
                 trimsec=REDTRIM, outflat='Flat-Red.fits', gain=REDGAIN,
                 rdnoise=REDRDNOISE, arc='Arc-Red.fits', 
                 caldir='home$standards/'):

    '''Reduce and calibrate standard star observation with red CCD'''

    
    # Bias subtract everything first
    redbias(image, biassec=biassec, trimsec=trimsec)
    redbias(arcs, biassec=biassec, trimsec=trimsec)
    redbias(flats, biassec=biassec, trimsec=trimsec)

    # Create and apply flat-field
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc(image[0], ccdtype='', noproc=no, fixpix=no, overscan=no, 
                 trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no,
                 fringecor=no, readcor=no, scancor=no, flat=outflat)
    arcimages=','.join(arcs)
    iraf.ccdproc(arcs, ccdtype='', noproc=no, fixpix=no, overscan=no, 
                 trim=no, zerocor=no, darkcor=no, flatcor=yes, illumcor=no,
                 fringecor=no, readcor=no, scancor=no, flat=outflat)

    # Extract spectrum of standard
    if object==None:
        object=get_head(image, 'OBJECT')
    iraf.apall(image[0], output=object, references='', interactive=yes, 
               find=yes, recenter=yes, resize=yes, edit=yes, trace=yes, 
               fittrace=yes, extract=yes, extras=yes, review=no, 
               background='fit', weights='variance', pfit='fit1d', 
               readnoise=rdnoise, gain=gain)

    # Extract arc and fit wavelength solution
    iraf.imarith(arcs[0], '+', arcs[1], 'Arc-Sum.fits')
    reference_arc('Arc-Sum.fits', arc, image[0])

    # Apply wavelength solution to standard
    iraf.refspec(object, references=arc, sort="", group="", override=yes,
                 confirm=no, assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Remove absorption features and smooth
    iraf.splot('%s.w' % object, 1, 1)
    iraf.gauss('temp1[*,1,1]', '%s.smooth' % object, 3.0)
    iraf.sarith('%s.w' % object, '/', '%s.smooth' % object, '%s.s' % object)

    # Create and apply telluric correction
    iraf.sarith('%s.w' % object, '/', 'temp1', 'telluric')
    iraf.splot('telluric', 1, 1)
    iraf.telluric('%s.s' % object, '%s.t' % object, 'telluric', xcorr=no,
                  tweakrms=no, interactive=no, sample='6850:6950,7575:7700')

    # Define bandpasses for standard star calculation
    iraf.standard('%s.t' % object, '%s.std' % object, 
                  extinction='onedstds$kpnoextinct.dat', caldir=caldir,
                  observatory='Lick', interact=yes, star_name=object, 
                  airmass='', exptime='')

    # Determine sensitivity function
    iraf.sensfunc('%s.std' % object, '%s.sens' % object, 
                  extinction='onedstds$kpnoextinct.dat', 
                  newextinction='extinct.dat', observatory='Lick',
                  function='legendre', order=3, interactive=yes)

    return
예제 #5
0
파일: kast_redux.py 프로젝트: cenko/python
def blue_standard(image, arcs, flats, object=None, biassec1=BLUEBIAS1,
                  trimsec1=BLUETRIM1, biassec2=BLUEBIAS2, 
                  trimsec2=BLUETRIM2, outflat='Flat-Blue.fits', gain=BLUEGAIN,
                  rdnoise=BLUERDNOISE, arc='Arc-Blue.fits', 
                  caldir='home$standards/'):

    '''Reduce and calibrate standard star observation with blue CCD'''
  
    # Bias subtract everything first
    bluebias(image, biassec1=biassec1, trimsec1=trimsec1, biassec2=biassec2,
             trimsec2=trimsec2)
    bluebias(arcs, biassec1=biassec1, trimsec1=trimsec1, biassec2=biassec2,
             trimsec2=trimsec2)
    bluebias(flats, biassec1=biassec1, trimsec1=trimsec1, biassec2=biassec2,
             trimsec2=trimsec2)

    # Create and apply flat-field
    for i in range(len(flats)):
        flats[i]='j%s' % flats[i]
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc('j%s' % image[0], ccdtype='', noproc=no, fixpix=no, 
                 overscan=no, trim=no, zerocor=no, darkcor=no, flatcor=yes, 
                 illumcor=no, fringecor=no, readcor=no, scancor=no, 
                 flat=outflat)
    iraf.ccdproc('j%s' % arcs[0], ccdtype='', noproc=no, fixpix=no, 
                 overscan=no, trim=no, zerocor=no, darkcor=no, flatcor=yes, 
                 illumcor=no, fringecor=no, readcor=no, scancor=no, 
                 flat=outflat)

    # Extract spectrum of standard
    if object==None:
        object=get_head(image, 'OBJECT')
    iraf.apall('j%s' % image[0], output=object, references='', interactive=yes, 
               find=yes, recenter=yes, resize=yes, edit=yes, trace=yes, 
               fittrace=yes, extract=yes, extras=yes, review=no, 
               background='fit', weights='variance', pfit='fit1d', 
               readnoise=rdnoise, gain=gain)

    # Extract arc and fit wavelength solution
    reference_arc('j%s' % arcs[0], arc, 'j%s' % image[0])

    # Apply wavelength solution to standard
    iraf.refspec(object, references=arc, sort="", group="", override=yes,
                 confirm=no, assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Remove absorption features and smooth
    iraf.splot('%s.w' % object, 1, 1)
    iraf.gauss('temp1[*,1,1]', '%s.smooth' % object, 3.0)
    iraf.sarith('%s.w' % object, '/', '%s.smooth' % object, '%s.s' % object)

    # Define bandpasses for standard star calculation
    iraf.standard('%s.s' % object, '%s.std' % object, 
                  extinction='onedstds$kpnoextinct.dat', caldir=caldir,
                  observatory='Lick', interact=yes, star_name=object, 
                  airmass='', exptime='')

    # Determine sensitivity function
    iraf.sensfunc('%s.std' % object, '%s.sens' % object, 
                  extinction='onedstds$kpnoextinct.dat', 
                  newextinction='extinct.dat', observatory='Lick',
                  function='legendre', order=3, interactive=yes)

    return
예제 #6
0
iraf.apall(input=filename,
           find="No",
           recenter="No",
           resize="No",
           interactive="Yes")

# Make sure that the dispersion axis is in the header.

iraf.hedit(images=[filename], fields=["DISPAXIS"], value=["1"], add="Yes")
iraf.identify(filename[:-5],
              coordli=home + "/Downloads/HgNe(1).dat",
              section="line 105 125",
              crval=crval,
              cdelt=dispersion,
              fwidth=5)

# Tell the extracted spectrum what the wavelength solutions are.
iraf.hedit(images=[extracted_filename],
           fields=["REFSPEC1"], \
        value=[filename], add="Yes")
iraf.refspec(input=extracted_filename,
             referen=filename[:-5],
             sort='',
             group='',
             confirm='no')
iraf.dispcor(input=extracted_filename, output=calibrated_filename)

# Plot the extracted spectrum?
iraf.splot(calibrated_filename)
예제 #7
0
def blue_science(image,
                 spath,
                 object=None,
                 flat='Flat-Blue.fits',
                 arc='Arc-Blue.fits',
                 smooth='BD284211.smooth.fits',
                 sens='BD284211.sens',
                 biassec1=BLUEBIAS1,
                 trimsec1=BLUETRIM1,
                 biassec2=BLUEBIAS2,
                 trimsec2=BLUETRIM2,
                 gain=BLUEGAIN,
                 rdnoise=BLUERDNOISE):
    '''Full reduction of KAST science spectra on blue CCD'''

    # Bias subtract everything first
    bluebias(image,
             biassec1=biassec1,
             trimsec1=trimsec1,
             biassec2=biassec2,
             trimsec2=trimsec2)

    # Apply flat-field
    shutil.copy('%s/%s' % (spath, flat), '.')
    iraf.ccdproc('j%s' % image[0],
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=flat)

    # Cosmic ray rejection
    #iraf.lacos_spec('j%s' % image[0], 'cj%s' % image[0], 'cmj%s' % image[0],
    #                gain=gain, readn=rdnoise, xorder=9, yorder=3,
    #                sigclip=4.5, sigfrac=0.5, objlim=1.0, niter=3)

    # Extract spectrum
    if object == None:
        object = get_head(image, 'OBJECT')
    iraf.apall('j%s' % image[0],
               output=object,
               references='',
               interactive=yes,
               find=yes,
               recenter=yes,
               resize=yes,
               edit=yes,
               trace=yes,
               fittrace=yes,
               extract=yes,
               extras=yes,
               review=no,
               background='fit',
               weights='variance',
               pfit='fit1d',
               readnoise=rdnoise,
               gain=gain)

    # Apply wavelength solution to standard
    shutil.copy('%s/%s' % (spath, arc), '.')
    shutil.copy('%s/database/id%s' % (spath, arc.rstrip('.fits')), 'database')
    iraf.refspec(object,
                 references=arc,
                 sort="",
                 group="",
                 override=yes,
                 confirm=no,
                 assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Smooth
    shutil.copy('%s/%s' % (spath, smooth), '.')
    iraf.sarith('%s.w' % object, '/', smooth, '%s.s' % object)

    # Flux calibration
    shutil.copy('%s/%s.0001.fits' % (spath, sens), '.')
    iraf.calibrate('%s.s' % object,
                   '%s.f' % object,
                   extinct=yes,
                   flux=yes,
                   extinction='onedstds$kpnoextinct.dat',
                   observatory='Lick',
                   sensitivity=sens,
                   airmass='',
                   exptime='')

    return
예제 #8
0
def red_science(image,
                flats,
                spath,
                object=None,
                arc='Arc-Red.fits',
                smooth='BD284211.smooth.fits',
                telluric='telluric.fits',
                sens='BD284211.sens',
                biassec=REDBIAS,
                trimsec=REDTRIM,
                outflat='Flat-Red.fits',
                gain=REDGAIN,
                rdnoise=REDRDNOISE):
    '''Full reduction of KAST science spectra on red CCD'''

    # Bias subtract everything first
    redbias(image, biassec=biassec, trimsec=trimsec)
    redbias(flats, biassec=biassec, trimsec=trimsec)

    # Create and apply flat-field
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc(image[0],
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=outflat)

    # Cosmic ray rejection
    #iraf.lacos_spec(image[0], 'c%s' % image[0], 'cm%s' % image[0],
    #                gain=gain, readn=rdnoise, xorder=9, yorder=3,
    #                sigclip=4.5, sigfrac=0.5, objlim=1.0, niter=3)

    # Extract spectrum
    if object == None:
        object = get_head(image, 'OBJECT')
    iraf.apall('%s' % image[0],
               output=object,
               references='',
               interactive=yes,
               find=yes,
               recenter=yes,
               resize=yes,
               edit=yes,
               trace=yes,
               fittrace=yes,
               extract=yes,
               extras=yes,
               review=no,
               background='fit',
               weights='variance',
               pfit='fit1d',
               readnoise=rdnoise,
               gain=gain)

    # Apply wavelength solution to standard
    shutil.copy('%s/%s' % (spath, arc), '.')
    shutil.copy('%s/database/id%s' % (spath, arc.rstrip('.fits')), 'database')
    iraf.refspec(object,
                 references=arc,
                 sort="",
                 group="",
                 override=yes,
                 confirm=no,
                 assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Smooth
    shutil.copy('%s/%s' % (spath, smooth), '.')
    iraf.sarith('%s.w' % object, '/', smooth, '%s.s' % object)

    # Create and apply telluric correction
    shutil.copy('%s/%s' % (spath, telluric), '.')
    iraf.telluric('%s.s' % object,
                  '%s.t' % object,
                  telluric,
                  xcorr=yes,
                  tweakrms=yes,
                  interactive=yes,
                  sample='6850:6950,7575:7700')

    # Flux calibration
    shutil.copy('%s/%s.0001.fits' % (spath, sens), '.')
    iraf.calibrate('%s.t' % object,
                   '%s.f' % object,
                   extinct=yes,
                   flux=yes,
                   extinction='onedstds$kpnoextinct.dat',
                   observatory='Lick',
                   sensitivity=sens,
                   airmass='',
                   exptime='')

    return
예제 #9
0
def blue_standard(image,
                  arcs,
                  flats,
                  object=None,
                  biassec1=BLUEBIAS1,
                  trimsec1=BLUETRIM1,
                  biassec2=BLUEBIAS2,
                  trimsec2=BLUETRIM2,
                  outflat='Flat-Blue.fits',
                  gain=BLUEGAIN,
                  rdnoise=BLUERDNOISE,
                  arc='Arc-Blue.fits',
                  caldir='home$standards/'):
    '''Reduce and calibrate standard star observation with blue CCD'''

    # Bias subtract everything first
    bluebias(image,
             biassec1=biassec1,
             trimsec1=trimsec1,
             biassec2=biassec2,
             trimsec2=trimsec2)
    bluebias(arcs,
             biassec1=biassec1,
             trimsec1=trimsec1,
             biassec2=biassec2,
             trimsec2=trimsec2)
    bluebias(flats,
             biassec1=biassec1,
             trimsec1=trimsec1,
             biassec2=biassec2,
             trimsec2=trimsec2)

    # Create and apply flat-field
    for i in range(len(flats)):
        flats[i] = 'j%s' % flats[i]
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc('j%s' % image[0],
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=outflat)
    iraf.ccdproc('j%s' % arcs[0],
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=outflat)

    # Extract spectrum of standard
    if object == None:
        object = get_head(image, 'OBJECT')
    iraf.apall('j%s' % image[0],
               output=object,
               references='',
               interactive=yes,
               find=yes,
               recenter=yes,
               resize=yes,
               edit=yes,
               trace=yes,
               fittrace=yes,
               extract=yes,
               extras=yes,
               review=no,
               background='fit',
               weights='variance',
               pfit='fit1d',
               readnoise=rdnoise,
               gain=gain)

    # Extract arc and fit wavelength solution
    reference_arc('j%s' % arcs[0], arc, 'j%s' % image[0])

    # Apply wavelength solution to standard
    iraf.refspec(object,
                 references=arc,
                 sort="",
                 group="",
                 override=yes,
                 confirm=no,
                 assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Remove absorption features and smooth
    iraf.splot('%s.w' % object, 1, 1)
    iraf.gauss('temp1[*,1,1]', '%s.smooth' % object, 3.0)
    iraf.sarith('%s.w' % object, '/', '%s.smooth' % object, '%s.s' % object)

    # Define bandpasses for standard star calculation
    iraf.standard('%s.s' % object,
                  '%s.std' % object,
                  extinction='onedstds$kpnoextinct.dat',
                  caldir=caldir,
                  observatory='Lick',
                  interact=yes,
                  star_name=object,
                  airmass='',
                  exptime='')

    # Determine sensitivity function
    iraf.sensfunc('%s.std' % object,
                  '%s.sens' % object,
                  extinction='onedstds$kpnoextinct.dat',
                  newextinction='extinct.dat',
                  observatory='Lick',
                  function='legendre',
                  order=3,
                  interactive=yes)

    return
예제 #10
0
def red_standard(image,
                 arcs,
                 flats,
                 object=None,
                 biassec=REDBIAS,
                 trimsec=REDTRIM,
                 outflat='Flat-Red.fits',
                 gain=REDGAIN,
                 rdnoise=REDRDNOISE,
                 arc='Arc-Red.fits',
                 caldir='home$standards/'):
    '''Reduce and calibrate standard star observation with red CCD'''

    # Bias subtract everything first
    redbias(image, biassec=biassec, trimsec=trimsec)
    redbias(arcs, biassec=biassec, trimsec=trimsec)
    redbias(flats, biassec=biassec, trimsec=trimsec)

    # Create and apply flat-field
    make_flat(flats, outflat, gain=gain, rdnoise=rdnoise)
    iraf.ccdproc(image[0],
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=outflat)
    arcimages = ','.join(arcs)
    iraf.ccdproc(arcs,
                 ccdtype='',
                 noproc=no,
                 fixpix=no,
                 overscan=no,
                 trim=no,
                 zerocor=no,
                 darkcor=no,
                 flatcor=yes,
                 illumcor=no,
                 fringecor=no,
                 readcor=no,
                 scancor=no,
                 flat=outflat)

    # Extract spectrum of standard
    if object == None:
        object = get_head(image, 'OBJECT')
    iraf.apall(image[0],
               output=object,
               references='',
               interactive=yes,
               find=yes,
               recenter=yes,
               resize=yes,
               edit=yes,
               trace=yes,
               fittrace=yes,
               extract=yes,
               extras=yes,
               review=no,
               background='fit',
               weights='variance',
               pfit='fit1d',
               readnoise=rdnoise,
               gain=gain)

    # Extract arc and fit wavelength solution
    iraf.imarith(arcs[0], '+', arcs[1], 'Arc-Sum.fits')
    reference_arc('Arc-Sum.fits', arc, image[0])

    # Apply wavelength solution to standard
    iraf.refspec(object,
                 references=arc,
                 sort="",
                 group="",
                 override=yes,
                 confirm=no,
                 assign=yes)
    iraf.dispcor(object, '%s.w' % object, confirm=no, listonly=no)

    # Remove absorption features and smooth
    iraf.splot('%s.w' % object, 1, 1)
    iraf.gauss('temp1[*,1,1]', '%s.smooth' % object, 3.0)
    iraf.sarith('%s.w' % object, '/', '%s.smooth' % object, '%s.s' % object)

    # Create and apply telluric correction
    iraf.sarith('%s.w' % object, '/', 'temp1', 'telluric')
    iraf.splot('telluric', 1, 1)
    iraf.telluric('%s.s' % object,
                  '%s.t' % object,
                  'telluric',
                  xcorr=no,
                  tweakrms=no,
                  interactive=no,
                  sample='6850:6950,7575:7700')

    # Define bandpasses for standard star calculation
    iraf.standard('%s.t' % object,
                  '%s.std' % object,
                  extinction='onedstds$kpnoextinct.dat',
                  caldir=caldir,
                  observatory='Lick',
                  interact=yes,
                  star_name=object,
                  airmass='',
                  exptime='')

    # Determine sensitivity function
    iraf.sensfunc('%s.std' % object,
                  '%s.sens' % object,
                  extinction='onedstds$kpnoextinct.dat',
                  newextinction='extinct.dat',
                  observatory='Lick',
                  function='legendre',
                  order=3,
                  interactive=yes)

    return