aburgasser/splat

model.py _loadInterpolatedModel cannot interpolate models with different resolutions

chihchunhsu opened this issue · 0 comments

The resolutions for the BT-Settl 2008 models are different, and the _loadInterpolatedModel function cannot interpolate if the resolutions are different.

In [29]: sp = spmd.getModel(instrument='NIRSPEC-O65-RAW',teff=2600,logg=5.5,z=0.0)
In [30]: len(sp.wave)
Out[30]: 5422

In [31]: sp = spmd.getModel(instrument='NIRSPEC-O65-RAW',teff=2700,logg=5.5,z=0.0)

In [32]: len(sp.wave)
Out[32]: 2711

In [33]: sp = spmd.getModel(instrument='NIRSPEC-O65-RAW',teff=2650,logg=5.5,z=0.0)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-33-0242638771bf> in <module>()
----> 1 sp = spmd.getModel(instrument='NIRSPEC-O65-RAW',teff=2650,logg=5.5,z=0.0)

~/projects/splat/splat/model.py in getModel(*args, **kwargs)
   2110 
   2111     '''
-> 2112     return loadModel(*args, **kwargs)
   2113 
   2114 

~/projects/splat/splat/model.py in loadModel(modelset, instrument, raw, sed, *args, **kwargs)
   2059         if file=='':
   2060             if kwargs['force']: raise NameError('\nCould not find '+kwargs['filename']+' locally\n\n')
-> 2061             else: sp = _loadInterpolatedModel(**kwargs)
   2062         else: kwargs['filename'] = kwargs['filename']+'.gz'
   2063 #                kwargs['local']=False

~/projects/splat/splat/model.py in _loadInterpolatedModel(*args, **kwargs)
   2274 # create interpolation
   2275         mflx = []
-> 2276         for i,w in enumerate(models[0].wave):
   2277             print("1",len(models[0].wave),len(models[0].flux),len(models[1].wave),len(models[1].flux))
   2278             print("2",len(models[2].wave),len(models[2].flux),len(models[3].wave),len(models[3].flux))

~/projects/splat/splat/model.py in <listcomp>(.0)
   2274 # create interpolation
   2275         mflx = []
-> 2276         for i,w in enumerate(models[0].wave):
   2277             print("1",len(models[0].wave),len(models[0].flux),len(models[1].wave),len(models[1].flux))
   2278             print("2",len(models[2].wave),len(models[2].flux),len(models[3].wave),len(models[3].flux))

IndexError: index 2711 is out of bounds for axis 0 with size 2711