BrownDwarf / gollum

A microservice for programmatic access to precomputed synthetic spectral model grids in astronomy
https://gollum-astro.readthedocs.io/
MIT License
20 stars 5 forks source link

test_phoenix.py produces warnings, and its operation is unclear #109

Closed rhdtownsend closed 3 months ago

rhdtownsend commented 4 months ago

When attempting to run test_phoenix.py, I get the following warnings:

(gollum_dev) townsend@laphroaig ~/devel/gollum/tests $ py.test -vs test_phoenix.py
============================================================== test session starts ===============================================================
platform darwin -- Python 3.12.3, pytest-8.2.0, pluggy-1.5.0 -- /Users/townsend/miniconda3/envs/gollum_dev/bin/python3.12
cachedir: .pytest_cache
rootdir: /Users/townsend/devel/gollum
configfile: pyproject.toml
plugins: anyio-4.3.0, asdf-3.2.0
collected 3 items                                                                                                                                

test_phoenix.py::test_spectrum PASSED
test_phoenix.py::test_resample PASSED
Processing Teff=5100K|log(g)=2.50|Z=+0.5: 100%|████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 111.64it/s]
PASSED

================================================================ warnings summary ================================================================
tests/test_phoenix.py::test_spectrum
  /Users/townsend/devel/gollum/src/gollum/precomputed_spectrum.py:117: RuntimeWarning: invalid value encountered in sqrt
    + np.sqrt(1 - x2) * (2 - 2 * u1 - 4 / 3 * u2 * u2 * x2),

tests/test_phoenix.py::test_spectrum
  /Users/townsend/devel/gollum/src/gollum/precomputed_spectrum.py:175: AstropyDeprecationWarning: The radial_velocity function is deprecated and may be removed in a future version.
          Use set_radial_velocity_to or shift_spectrum_to instead.
    shifted_spec.radial_velocity = rv * u.km / u.s

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================= 3 passed, 2 warnings in 2.60s ==========================================================

I'm guessing that gollum is automatically downloading a spectrum from the Phoenix server in Germany, but it's not clear where this spectrum is being placed. I had guessed it would be in ~/library/raw/PHOENIX, but there's nothing there. Can you clarify?

Review link: https://github.com/openjournals/joss-reviews/issues/6601

Sujay-Shankar commented 4 months ago

I've dealt with the warnings in the recent commit, and yes, we download the spectra from the PHOENIX server. While we currently don't support or claim to support downloading and explicitly storing PHOENIX spectra, there is some caching behavior that astropy does when we use their IO API, so calling download on the same spectrum again is faster due to their hidden machinery.