Example #1
0
def fitcoords(images, data_path='.', params={}):
    """
    Run iraf fitcoords to fit 2D function to wavelength as a function of 
    column and line number. 

    Parameters
    ----------
    images : str
        Image(s) to be reidentified.
    data_path : str
        Directory that contains the data.
    params : dict
        Iraf fitcoords  parameters.
    """

    _check_working_dir(data_path)

    logger.info('running iraf fitcoords')

    iraf.fitcoords.unlearn()
    iraf.fitcoords.function = params.pop('function', 'legendre')
    iraf.fitcoords.xorder = params.pop('xorder', 5)
    iraf.fitcoords.yorder = params.pop('yorder', 3)
    iraf.fitcoords.interactive = params.pop('interactive', 'yes')

    images = images.replace('.fits', '')
    iraf.fitcoords(images=images)
Example #2
0
def wal(lstfile):
    iraf.noao()
    iraf.twodspec()
    iraf.longslit()
    iraf.identify(images = 'Lamp'
        , section = 'middle column', database = 'database'
        , coordlist = 'linelists$idhenear.dat', units = '', nsum = 10
        , match = -3.0, maxfeatures = 50, zwidth = 100.0
        , ftype = 'emission', fwidth = 20.0, cradius = 5.0
        , threshold = 0.0, minsep = 2.0, function = 'chebyshev'
        , order = 6, sample = '*', niterate = 0
        , low_reject = 3.0, high_reject = 3.0, grow = 0.0
        , autowrite = False, graphics = 'stdgraph', cursor = ''
        , crval = '', cdelt = '')
    iraf.reidentify(reference = 'Lamp'
        , images = 'Lamp', interactive = 'no', section = 'column'
        , newaps = True, override = True, refit = True, trace = False
        , step = 10, nsum = 10, shift = 0.0, search = 0.0, nlost = 5
        , cradius = 7.0, threshold = 0.0, addfeatures = False
        , coordlist = 'linelists$idhenear.dat', match = -3.0, maxfeatures = 50
        , minsep = 2.0, database = 'database', logfiles = 'logfile'
        , plotfile = '', verbose = False, graphics = 'stdgraph', cursor = ''
        , answer = 'yes', crval = '', cdelt = '', mode = 'al')
    iraf.fitcoords(images = 'Lamp'
        , fitname = 'Lamp', interactive = True, combine = False, database = 'database'
        , deletions = 'deletions.db', function = 'chebyshev', xorder = 6
        , yorder = 6, logfiles = 'STDOUT,logfile', plotfile = 'plotfile'
        , graphics = 'stdgraph', cursor = '', mode = 'al')
    iraf.longslit(dispaxis = 2)
    iraf.transform(input = '%ftbo%ftbo%@' + lstfile
        , output = '%wftbo%wftbo%@' + lstfile, minput = '', moutput = ''
        , fitnames = 'LampLamp', database = 'database', interptype = 'spline3'
        , flux = True)
Example #3
0
def make_lambda_solution(arc_list,fcnamedict):
    irf_prm.set_identify_calibration(iraf.identify)
    irf_prm.set_reidentify_calibration(iraf.reidentify)
    irf_prm.set_fitcoords_calibration(iraf.fitcoords)
    for arc in arc_list:
        iraf.identify(images=arc)
        iraf.reidentify(reference=arc,images=arc)
        iraf.fitcoords(images=arc[:-5],fitname=fcnamedict[arc])
    return
Example #4
0
def fitcoords():
    iraf.twodspec()
    iraf.longslit()
    iraf.fitcoords(images='Lamp',
                   fitname='Lamp',
                   interactive='yes',
                   combine='no',
                   database='database',
                   deletions='deletions.db',
                   function='chebyshev',
                   xorder=6,
                   yorder=6)
Example #5
0
def standard_trace(standard_list,supplement_list,outname='star'):
    irf_prm.set_identify_standard(iraf.identify)
    irf_prm.set_reidentify_standard(iraf.reidentify)
    irf_prm.set_fitcoords_standard(iraf.fitcoords)
    all_standards = ''
    for standrd in standard_list:
        iraf.identify(images=standrd)
        iraf.reidentify(reference=standrd,images=standrd)
        all_standards += standrd[:-5]+','
    for supplement in supplement_list:
        iraf.identify(images=supplement)
        iraf.reidentify(reference=supplement,images=supplement)
        all_standards += supplement[:-5]+','
    iraf.fitcoords(images=all_standards,fitname=outname)
    return
Example #6
0
def wal(lstfile, lampname):
    iraf.noao()
    iraf.twodspec()
    iraf.longslit()
    # iraf.identify(images = 'Lamp.fits', section = 'middle column',
    #     database = 'database', coordlist = 'linelists$idhenear.dat',
    #     nsum = 10, match = -3.0, maxfeatures = 50, zwidth = 100.0,
    #     ftype = 'emission', fwidth = 20.0, cradius = 7.0, threshold = 0.0,
    #     minsep = 2.0, function = 'chebyshev', order = 6, sample = '*',
    #     niterate = 0, low_reject = 3.0, high_reject = 3.0, grow = 0.0,
    #     autowrite = 'no')

    #    iraf.reidentify(reference = 'Lamp', images = 'Lamp', interactive = 'no',
    #            section = 'column', newaps = 'yes', override = 'yes', refit = 'yes',
    #            trace = 'no', step = 10, nsum = 10, shift = 0.0, search = 0.0,
    #            nlost = 5, cradius = 7.0, threshold = 0.0, addfeatures = 'no',
    #            coordlist = 'linelists$idhenear.dat', match = -3.0,
    #            maxfeatures = 50, minsep = 2.0, database = 'database')

    iraf.identify(images=lampname,
                  section='middle column',
                  database='database',
                  coordlist='linelists$idhenear.dat',
                  units='',
                  nsum=10,
                  match=-3.0,
                  maxfeatures=50,
                  zwidth=100.0,
                  ftype='emission',
                  fwidth=20.0,
                  cradius=7.0,
                  threshold=0.0,
                  minsep=2.0,
                  function='chebyshev',
                  order=6,
                  sample='*',
                  niterate=0,
                  low_reject=3.0,
                  high_reject=3.0,
                  grow=0.0,
                  autowrite=False,
                  graphics='stdgraph',
                  cursor='',
                  crval='',
                  cdelt='')
    iraf.reidentify(reference=lampname,
                    images=lampname,
                    interactive='no',
                    section='column',
                    newaps=True,
                    override=True,
                    refit=True,
                    trace=False,
                    step=10,
                    nsum=10,
                    shift=0.0,
                    search=0.0,
                    nlost=5,
                    cradius=7.0,
                    threshold=0.0,
                    addfeatures=False,
                    coordlist='linelists$idhenear.dat',
                    match=-3.0,
                    maxfeatures=50,
                    minsep=2.0,
                    database='database',
                    logfiles='logfile',
                    plotfile='',
                    verbose=False,
                    graphics='stdgraph',
                    cursor='',
                    answer='yes',
                    crval='',
                    cdelt='',
                    mode='al')
    iraf.fitcoords(images=lampname,
                   fitname=lampname,
                   interactive=True,
                   combine=False,
                   database='database',
                   deletions='deletions.db',
                   function='chebyshev',
                   xorder=6,
                   yorder=6,
                   logfiles='STDOUT,logfile',
                   plotfile='plotfile',
                   graphics='stdgraph',
                   cursor='',
                   mode='al')
    iraf.longslit(dispaxis=2)
    iraf.transform(input='%ftbo%ftbo%@' + lstfile,
                   output='%wftbo%wftbo%@' + lstfile,
                   minput='',
                   moutput='',
                   fitnames=lampname + lampname,
                   database='database',
                   interptype='spline3',
                   flux=True)
Example #7
0
    #     graphics = "stdgraph",\
    #     cursor = "",\
    #     answer = "yes",\
    #     crval = "",\
    #     cdelt = "",\
    #     aidpars = "")

    ### Run fitcoords to fit coordinate and get ready for transformation
    ### xorder and yorder specifies the fitting orders
    iraf.fitcoords(
        images = im_slice + "_" + string.split(arc_name,".")[0],\
        fitname = "",\
        interactive = 0,\
        combine = 0,\
        database = "database",\
        deletions = "deletions.db",\
        function = "chebyshev",\
        xorder = 6,\
        yorder = 2,\
        logfiles = "STDOUT,logfile",\
        plotfile = "plotfile",\
        graphics = "stdgraph")

    ### Run transform according to the results of fitcoords
    ### This is the final step
    ### The product is a nicely straightened fits file
    os.system("rm -f t" + im_slice + "_" + file_name)
    for i in arc_list:
        os.system("rm -f t" + im_slice + "_" + i)
    
    image_to_reduce = im_slice + "_" + file_name + ","