Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interpolation issue in ResolvedCluster() #109

Open
rpoleski opened this issue Oct 1, 2024 · 0 comments
Open

interpolation issue in ResolvedCluster() #109

rpoleski opened this issue Oct 1, 2024 · 0 comments

Comments

@rpoleski
Copy link

rpoleski commented Oct 1, 2024

This simple code:

import warnings
warnings.filterwarnings("error", category=RuntimeWarning)
from spisea.imf import imf
from spisea import synthetic
import numpy as np

isochrone = synthetic.IsochronePhot(9.83, 0., 10, 0.3)
imf = imf.IMF_broken_powerlaw(np.array([0.11, 0.5, 120.]), np.array([-1.3, -2.3]))
cluster = synthetic.ResolvedCluster(isochrone, imf, 1.0e4)

fails with such an error message:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    cluster = synthetic.ResolvedCluster(isochrone, imf, 1.0e4)
  File "/.../SPISEA/spisea/synthetic.py", line 162, in __init__
    star_systems = self._make_star_systems_table(mass, isMulti, sysMass)
  File "/.../SPISEA/spisea/synthetic.py", line 219, in _make_star_systems_table
    star_systems['Teff'] = self.iso_interps['Teff'](star_systems['mass'])
  File "/usr/local/lib64/python3.8/site-packages/scipy/interpolate/polyint.py", line 78, in __call__
    y = self._evaluate(x)
  File "/usr/local/lib64/python3.8/site-packages/scipy/interpolate/interpolate.py", line 682, in _evaluate
    y_new = self._call(self, x_new)
  File "/usr/local/lib64/python3.8/site-packages/scipy/interpolate/interpolate.py", line 630, in _call_linear
    slope = (y_hi - y_lo) / (x_hi - x_lo)[:, None]
RuntimeWarning: divide by zero encountered in true_divide

Changing age from 9.83 to 9.8 solves the error but I'm guessing there is some deeper bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant