Script to match an input spectrum to the line lists


In [4]:
# imports
import json

from astropy.table import Table

import arclines

Testing

LRISb spectrum


In [3]:
test_arc_path = arclines.__path__[0]+'/data/sources/'
src_file = 'lrisb_600_4000_PYPIT.json'
with open(test_arc_path+src_file,'r') as f:
    pypit_fit = json.load(f)

In [6]:
spec = pypit_fit['spec']
tbl = Table()
tbl['spec'] = spec
tbl.write(arclines.__path__[0]+'/tests/files/LRISb_600_spec.ascii',format='ascii')

Run

arclines_match LRISb_600_spec.ascii 4000. 1.26 CdI,HgI,ZnI

Kastr


In [7]:
test_arc_path = '/Users/xavier/local/Python/PYPIT-development-suite/REDUX_OUT/Kast_red/600_7500_d55/MF_kast_red/'
src_file = 'MasterWaveCalib_A_01_aa.json'
with open(test_arc_path+src_file,'r') as f:
    pypit_fit = json.load(f)

In [8]:
spec = pypit_fit['spec']
tbl = Table()
tbl['spec'] = spec
tbl.write(arclines.__path__[0]+'/tests/files/Kastr_600_7500_spec.ascii',format='ascii')

Run

arclines_match Kastr_600_7500_spec.ascii 7500. 2.35 HgI,NeI,ArI

Check dispersion


In [10]:
pix = np.array(pypit_fit['xfit'])*(len(spec)-1.)
wave = np.array(pypit_fit['yfit'])
disp = (wave-np.roll(wave,1))/(pix-np.roll(pix,1))
disp


Out[10]:
array([ 2.34131867,  2.28662701,  2.3032545 ,  2.31847492,  2.34357542,
        2.30925354,  2.33332071,  2.36453387,  2.32462773,  2.3749673 ,
        2.31999043,  2.33874475,  2.34388078,  2.35997203,  2.32940272,
        2.36848258,  2.3063928 ,  2.36044792,  2.36702026,  2.36280899,
        2.35944074,  2.37837135,  2.36594476,  2.37554864,  2.36812976,
        2.37014177,  2.35869518,  2.37151191,  2.36478659,  2.31255329,
        2.3683453 ,  2.35900124,  2.33726945,  2.33102636,  2.32923909])

Ran without UNKNWN -- Excellent

LRISr -- 600/7500


In [11]:
test_arc_path = arclines.__path__[0]+'/data/sources/'
src_file = 'lrisr_600_7500_PYPIT.json'
with open(test_arc_path+src_file,'r') as f:
    pypit_fit = json.load(f)

In [12]:
spec = pypit_fit['spec']
tbl = Table()
tbl['spec'] = spec
tbl.write(arclines.__path__[0]+'/tests/files/LRISr_600_7500_spec.ascii',format='ascii')

Run

arclines_match LRISr_600_7500_spec.ascii 7000. 1.6 ArI,HgI,KrI,NeI,XeI
Need UNKNOWNS for better performance
arclines_match LRISr_600_7500_spec.ascii 7000. 1.6 ArI,HgI,KrI,NeI,XeI --unknowns

Am scanning now (successfully)

RCS at MMT


In [14]:
range(5,-1,-1)


Out[14]:
[5, 4, 3, 2, 1, 0]

Run

arclines_match data/test_arcs/MMT_RCS_600_6310.hdf5 7000. 1.6 ArI,NeI

In [ ]: