spacetelescope / stsynphot_refactor

Synthetic photometry using Astropy for HST and JWST
http://stsynphot.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
14 stars 10 forks source link

stsynphot will return error if there are any NaNs in the input spectrum #151

Closed janerigby closed 3 years ago

janerigby commented 3 years ago

When computing countrates in stsynphot, an error is returned if there are any NaNs in the input spectrum. See the code snippet below; if I don't replace the NaNs in the input spectrum, then I get this error pointing to the last line of code below: SynphotError: Integrated flux is NaN

It would be nice for the documentation to mention that this will happen if the input spectrum contains NaNs. Real spectra often do. :)

sp2 = load_a_megasaura_spectrum_fromRigbyetal2018a(yadda, yadda)
thisSS = (synphot.SourceSpectrum(Empirical1D, points=sp2['wave'].values*u.Angstrom, lookup_table=sp2['flam'].values * synphot.units.FLAM))
setup = 'wfc3,uvis1,f410m'
bp = stsynphot.band(setup)
obs = synphot.Observation(thisSS, bp, force='taper')
cr  = obs.countrate(stsynphot.conf.area)  #countrate

EDIT: Formatting

pllim commented 3 years ago

Hello! I apologize for any inconvenience caused. Are the doc updates at spacetelescope/synphot_refactor#319 to your satisfaction? Please leave your review there.