timothydmorton / isochrones

Pythonic stellar model grid access; easy MCMC fitting of stellar properties
http://isochrones.readthedocs.org
MIT License
120 stars 62 forks source link

Some MIST_Isochrone.isochrone() cause ZeroDivisionError #64

Closed rickyegeland closed 6 years ago

rickyegeland commented 6 years ago

The following results in ZeroDivisionError. This seems to happen for feh values which lie exactly on the MIST grids, but not for all ages. For example, age=9.0 works fine.

mist = MIST_Isochrone()
iso3 = mist.isochrone(8.0, feh=0.0)
majkelx commented 6 years ago

same for me


In [9]: mist = MIST_Isochrone()

In [10]: mist.isochrone(7.0)
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-10-e7668f475c95> in <module>()
----> 1 mist.isochrone(7.0)

/Users/michal/.pyenv/versions/anaconda2-4.3.0/envs/astro/lib/python2.7/site-packages/isochrones/isochrone.pyc in isochrone(self, age, feh, minm, maxm, dm, return_df, distance, AV)
    410 
    411         Ms = self.mass(ms,ages,feh)
--> 412         Rs = self.radius(ms,ages,feh)
    413         logLs = self.logL(ms,ages,feh)
    414         loggs = self.logg(ms,ages,feh)

/Users/michal/.pyenv/versions/anaconda2-4.3.0/envs/astro/lib/python2.7/site-packages/isochrones/isochrone.pyc in radius(self, *args)
    193 
    194     def radius(self, *args):
--> 195         return np.sqrt(G*self.mass(*args)*MSUN/10**self.logg(*args))/RSUN
    196 
    197     def Teff(self, *args):

/Users/michal/.pyenv/versions/anaconda2-4.3.0/envs/astro/lib/python2.7/site-packages/isochrones/isochrone.pyc in logg(self, mass, age, feh)
    679 
    680     def logg(self, mass, age, feh):
--> 681         return self.interp_value(mass, age, feh, self.logg_col)
    682 
    683     def logL(self, mass, age, feh):

/Users/michal/.pyenv/versions/anaconda2-4.3.0/envs/astro/lib/python2.7/site-packages/isochrones/isochrone.pyc in interp_value(self, mass, age, feh, icol)
    747             return interp_values(mass, age, feh, icol,
    748                                 self.grid, self.mass_col,
--> 749                                 self.ages, self.fehs, self.grid_Ns)
    750 

ZeroDivisionError: division by zero