tomasstolker / species

Toolkit for atmospheric characterization of directly imaged exoplanets
https://species.readthedocs.io
MIT License
22 stars 9 forks source link

Reddening slope ism_red below unity truncates model wavelength range & Slightly too narrow wavelength range in spectral files #114

Closed gabrielastro closed 1 week ago

gabrielastro commented 1 month ago

Three somewhat linked problems:

According to the example in the documentation ("for example bounds={'ism_ext': (0., 10.), 'ism_red': (0., 20.)}") and from a quick look at the formula, RV < 1 should not be a problem mathematically [Edit: uh, it actually will! See below], so I do not know what is happening.

Thanks a lot!

gabrielastro commented 1 month ago

The filter profile of 2MASS/2MASS.H (1.4180-1.8710) lies outside the wavelength range of the spectrum. The returned synthetic flux is therefore set to NaN

[…]

Residuals (sigma):

[…]/species/plot/plot_spectrum.py:1299 […] -> 1299 max_tmp = np.max(np.abs(residuals.photometry[item][1][finite])) […]

ValueError: zero-size array to reduction operation maximum which has no identity


Now the "out of range" warning was because the model was being stored only up to 0.87 µm or so (maybe printing the spectrum range in the message "lies outside the wavelength range of the spectrum" would be helpful for debugging in the future, by the way), but just from reading the line the residuals array does contain at least one finite value (the SDSS ones), so `residuals.photometry[item][1][finite]` should not be zero-sized, no? I might be misinterpreting the error message, though. Mentioning just in case this is an issue too.
gabrielastro commented 1 month ago

Sorry, I should have guessed that a polynomial could become negative… For R_v < 0, indeed the Cardelli et al. (1989) extinction becomes negative at some wavelengths: Cardelli89+WangChen19 Therefore this was not buggy behaviour but effectively bad input on my part! My apologies.

The points above still remain, though. Thanks again!

tomasstolker commented 2 weeks ago
gabrielastro commented 1 week ago
tomasstolker commented 1 week ago

There is no extinction applied for wavelengths outside the range, which requires indeed some clarification. Or I could fix it to the extinction at the last wavelength, but I am not sure if that would be better...

gabrielastro commented 1 week ago

Hmm… Are there measurements of the ISM opacity below 0.125 µm in the literature? Or one could "just" reproduce the ISM curve with OpTool for instance and then compute the actual extinction down to smaller wavelengths. If the optical constants have been measured there… At larger wavelengths, Chiar & Thielens (2006) could be used up to 8 µm, and there must be data at longer wavelengths. Also, maybe Wang & Chen (2019) could be added but this is a separate thing.

tomasstolker commented 1 week ago

For the below 0.125 um it doesn't matter since there aren't any measurements of planets/stars, but for the MIR wavelengths it may impact fit results, e.g. when including L/M band photometry. I will leave it as it is, but should implement a more generic extinction approach at some point, that allows for other relations.

gabrielastro commented 1 week ago

Ok! Just for safety for plotting, fix the extinction especially at low wavelengths to the extrapolation, and document this anyway just for clarity?