ellawang44 / Breidablik

Interpolate lithium spectra and predict lithium abundance for late-type stars
MIT License
3 stars 0 forks source link

Warning/error after testing installation #8

Open mlldantas opened 5 days ago

mlldantas commented 5 days ago

Issue Description:

I am finding an error when running python -m pytest after installing the package. I am installing it by cloning the package in the github repository. I don't know how to correct it.

An important detail: I do not know how to answer some of the questions requested during the installation, so I am putting here my answers as well.

Error:

(base) mlldantas@morpheus:~/Breidablik$ python -m pytest
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.0.0
rootdir: /home/mlldantas/Breidablik
plugins: anyio-4.2.0, hypothesis-6.104.2
collected 43 items                                                             

breidablik/analysis/test_read.py sssss                                   [ 11%]
breidablik/analysis/test_tools.py ..........                             [ 34%]
breidablik/interpolate/test_grid_check.py .                              [ 37%]
breidablik/interpolate/test_nlte.py ...                                  [ 44%]
breidablik/interpolate/test_rew.py ...                                   [ 51%]
breidablik/interpolate/test_scalar.py ..........                         [ 74%]
breidablik/interpolate/test_spectra.py ..........F                       [100%]

=================================== FAILURES ===================================
___________________ Test_predict_flux.test_warning_abundance ___________________

self = <breidablik.interpolate.test_spectra.Test_predict_flux object at 0x71613da91c50>

    def test_warning_abundance(self):
        with warnings.catch_warnings(record = True) as w:
            warnings.simplefilter('always')
            Test_predict_flux.models.predict_flux(5000, 2.5, -2, -1)
            Test_predict_flux.models.predict_flux(5000, 2.5, -2, 5)
>           assert len(w) == 2
E           assert 1 == 2
E            +  where 1 = len([<warnings.WarningMessage object at 0x71613dae50d0>])

breidablik/interpolate/test_spectra.py:94: AssertionError
=========================== short test summary info ============================
FAILED breidablik/interpolate/test_spectra.py::Test_predict_flux::test_warning_abundance - assert 1 == 2

Steps to reproduce:

git clone https://github.com/ellawang44/Breidablik

cd Breidablik/

./install

Do you wish to download the data from Balder? [Y/n] Y

replace Balder/wavelengths.dat? [y]es, [n]o, [A]ll, [N]one, [r]ename: A

Do you wish to add this package to the python path? [Y/n] Y

Environment:

Python version: 3.11.7 OS: Ubuntu 22.04.1

Image: image

ellawang44 commented 4 days ago

Thank you for running the tests! I've fixed this in the latest commit, so it should resolve itself if you git pull.

This was caused by an update to the code which did not propagate through to the tests. Previously we warned users when they were extrapolating in abundances, but through testing, we found that extrapolating to very low abundances still behaved as expected. I've updated the tests so it no longer expects a warning to be thrown for low abundance extrapolation.