Skip to content

interpolation issue in ResolvedCluster() #109

Description

@rpoleski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions