aburgasser / splat

SpeX Prism Spectral Analysis Toolkit
MIT License
28 stars 46 forks source link

modelFitEMCEE error: local variable 'modelset' referenced before assignment #164

Open davesahman opened 2 years ago

davesahman commented 2 years ago

Hi Adam,

I hit a problem when running the modelFitEMCEE routine. See the attached extract from a Jupyter notebook for details. Hope this is an easy fix! Cheers, Dave.

davesahman commented 2 years ago

Hi Adam,

It looks like I didnt attach the error text to my original message. Here it is:-

from astropy.io import fits import astropy.units as u import numpy as np import splat import splat.plot as splot import splat.photometry as sphot import splat.empirical as semp import splat.model as spmod xx = splat.empirical.typeToTeff(20) teff,teff_e = semp.typeToTeff("M7") teff,teff_e

(<Quantity 2655.2141656 K>, <Quantity 100. K>)

sp = splat.getSpectrum(shortname='0415-0935')[0]

Retrieving 1 file

emcee_result = spmod.modelFitEMCEE(sp,t0=teff,g0=5.0,fit_metallicity=False,model='BTSettl2008',nwalkers=50,nsamples=500,output='test_modelfitEMCEE-1')


UnboundLocalError Traceback (most recent call last) /tmp/ipykernel_30983/1114820490.py in ----> 1 emcee_result = spmod.modelFitEMCEE(sp,t0=teff,g0=5.0,fit_metallicity=False,model='BTSettl2008',nwalkers=50,nsamples=500,output='test_modelfitEMCEE-1')

~/.local/lib/python3.8/site-packages/splat/model.py in modelFitEMCEE(specin, mset, instrument, initial, nofit, nwalkers, nsamples, threads, burn, propose_scale, verbose, **kwargs) 4180 4181 # check model name -> 4182 modelset = kwargs.get('model', modelset) 4183 modelset = kwargs.get('set', modelset) 4184 modelset = kwargs.get('model_set', modelset)

UnboundLocalError: local variable 'modelset' referenced before assignment