spacetelescope / pysynphot

Synthetic Photometry.
http://pysynphot.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
23 stars 21 forks source link

Icat Parameter Out of Bounds for Phoenix Models #151

Closed natashabatalha closed 1 year ago

natashabatalha commented 1 year ago

At the bounds of a parameter selection, Icat seems to always round up opposed to providing users with the nearest neighbor. For example:

import pysynphot as S

These work just fine:

sp = S.Icat('phoenix', 4000, 0.30001, 4.50)
sp = S.Icat('phoenix', 4000, 0.3, 5.0)

But this throws an error:

sp = S.Icat('phoenix', 4000, 0.30001, 5.0)

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nbatalh1/.conda/envs/pandexo2/lib/python3.9/site-packages/pysynphot-2.0.0-py3.9-macosx-10.9-x86_64.egg/pysynphot/catalog.py", line 125, in __init__
    sp1 = self._getSpectrum(list6[0],  catdir)
  File "/Users/nbatalh1/.conda/envs/pandexo2/lib/python3.9/site-packages/pysynphot-2.0.0-py3.9-macosx-10.9-x86_64.egg/pysynphot/catalog.py", line 209, in _getSpectrum
    raise exceptions.ParameterOutOfBounds(
pysynphot.exceptions.ParameterOutOfBounds: Parameter '[4000.0, 0.5, 5.0, 'phoenixp05/phoenixp05_4000.fits[g50]']' has no valid data.
>>> sp = s.Icat('phoenix', 4000, 0.30001, 5.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nbatalh1/.conda/envs/pandexo2/lib/python3.9/site-packages/pysynphot-2.0.0-py3.9-macosx-10.9-x86_64.egg/pysynphot/catalog.py", line 125, in __init__
    sp1 = self._getSpectrum(list6[0],  catdir)
  File "/Users/nbatalh1/.conda/envs/pandexo2/lib/python3.9/site-packages/pysynphot-2.0.0-py3.9-macosx-10.9-x86_64.egg/pysynphot/catalog.py", line 209, in _getSpectrum
    raise exceptions.ParameterOutOfBounds(
pysynphot.exceptions.ParameterOutOfBounds: Parameter '[4000.0, 0.5, 5.0, 'phoenixp05/phoenixp05_4000.fits[g50]']' has no valid data.

Program specs: `

S.__version__
'2.0.0'
pllim commented 1 year ago

I think the algorithm does not extrapolate and that is why you are seeing the error. The code is throwing error here:

https://github.com/spacetelescope/pysynphot/blob/f07c6c238ea8b6b922a302a3f858e4cf6cf6fab7/pysynphot/catalog.py#L125

It cannot find the end point to interpolate from.

If you wish to request this particular combo be supported, please contact the help desk at hsthelp.stsci.edu. We apologize for any inconvenience caused. Thank you.