natashabatalha / PandExo

A Community Tool for Transiting Exoplanet Science with the JWST & HST
https://natashabatalha.github.io/PandExo
GNU General Public License v3.0
34 stars 38 forks source link

ParameterOutOfBounds: crash for some stellar parameter values #85

Open iancrossfield opened 1 month ago

iancrossfield commented 1 month ago

When attempting a PandExo (v3) transit simulation and using the following 'star' input:

{'type': 'phoenix', 'starpath': 'filename_star', 'w_unit': 'Angs,um,nm,Hz,sec,cm', 'f_unit': 'FLAM or W/m2/um or erg/s/cm2/Hz or Jy', 'mag': 7.009, 'hmag': 'H Band Magnitude', 'jmag': 'J Band Magnitude', 'ref_wave': 2.2, 'temp': 4780.0, 'metal': 0.31, 'logg': 4.66, 'radius': 0.68, 'r_unit': 'R_sun'} The code crashes with ParameterOutOfBounds: Parameter '[4800.0, 0.5, 5.0, 'phoenixp05/phoenixp05_4800.fits[g50]']' has no valid data.

This seems to be because the file 'g50' field of file grp/hst/cdbs/grid/phoenix/phoenixp05/phoenixp05_4800.fits contains only zeros!

Not really a problem with PandExo per se -- just that slightly more rigorous error-catching could be useful to handle this (and any similar) odd edge-cases.

iancrossfield commented 1 month ago

For what it's worth, I got around this by hacking engine/jwst.py to read in the star_spec as:

try:
   star_spec = create.outTrans(pandexo_input['star'])
except:
   pandexo_input['star']['metal'] = min(0.3, pandexo_input['star']['metal'])
   star_spec = create.outTrans(pandexo_input['star'])
natashabatalha commented 1 month ago

Ugh.. These Phoenix files are full of issues.. Will implement a check for this moving to pandexo 4.