Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle bad stars from supplement in one test #191

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

jeanconn
Copy link
Contributor

@jeanconn jeanconn commented Sep 12, 2024

Description

Handle bad stars (CLASS=100) from supplement in one test.

Without this fix you get this when the bad-color-stars-added supplement is promoted.

(ska3-flight-latest) flame:agasc jean$ pytest
=================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.11.8, pytest-7.4.4, pluggy-1.4.0
rootdir: /Users/jean/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-4.3.0
collected 77 items                                                                                                                                                                         

agasc/tests/test_agasc_1.py .......                                                                                                                                                  [  9%]
agasc/tests/test_agasc_2.py ..........sssss..........ss.F................                                                                                                            [ 67%]
agasc/tests/test_agasc_healpix.py .ssssssssss                                                                                                                                        [ 81%]
agasc/tests/test_obs_status.py ..............                                                                                                                                        [100%]

========================================================================================= FAILURES =========================================================================================
______________________________________________________________________________ test_supplement_get_agasc_cone ______________________________________________________________________________

    @pytest.mark.skipif(NO_MAGS_IN_SUPPLEMENT, reason="no mags in supplement")
    def test_supplement_get_agasc_cone():
        ra, dec = 282.53, -0.38  # Obsid 22429 with a couple of color1=1.5 stars
        stars1 = agasc.get_agasc_cone(
            ra, dec, date="2021:001", agasc_file=MINIAGASC_1P7, use_supplement=False
        )
        stars2 = agasc.get_agasc_cone(
            ra, dec, date="2021:001", agasc_file=MINIAGASC_1P7, use_supplement=True
        )
        ok = stars2["MAG_CATID"] == agasc.MAG_CATID_SUPPLEMENT
    
        change_names = ["MAG_CATID", "COLOR1", "MAG_ACA", "MAG_ACA_ERR"]
        for name in set(stars1.colnames) - set(change_names):
>           assert np.all(stars1[name] == stars2[name])
E           assert False
E            +  where False = <function all at 0x101fb9570>(<Column name=... 0\n  0\n  0\n  0 == <Column name=... 0\n  0\n  0\n  0
E            +    where <function all at 0x101fb9570> = np.all
E               Use -v to get more diff)

agasc/tests/test_agasc_2.py:432: AssertionError
================================================================================= short test summary info ==================================================================================
FAILED agasc/tests/test_agasc_2.py::test_supplement_get_agasc_cone - assert False
========================================================================= 1 failed, 59 passed, 17 skipped in 7.28s

Interface impacts

Testing

I had just copied the candidate supplement with no-color-bad-stars-added over the agasc_supplement in my ska data.

Unit tests

  • Mac arm64
jeanconn-fido> md5sum /proj/sot/ska/data/agasc/rc/promote/agasc_supplement.h5 
144e5faf28d2f93812bfe74210d1c3c7  /proj/sot/ska/data/agasc/rc/promote/agasc_supplement.h5
jeanconn-fido> Use "logout" to leave the shell.
jeanconn-fido> logout
Connection to localhost closed.
(ska3-flight-latest) flame:agasc jean$ md5 /Users/jean/ska/data/agasc/agasc_supplement.h5 
MD5 (/Users/jean/ska/data/agasc/agasc_supplement.h5) = 144e5faf28d2f93812bfe74210d1c3c7
(ska3-flight-latest) flame:agasc jean$ git rev-parse HEAD
4df95afbbbdd220700dee683acd716128f8e03af
(ska3-flight-latest) flame:agasc jean$ pytest
=================================================================================== test session starts ====================================================================================
platform darwin -- Python 3.11.8, pytest-7.4.4, pluggy-1.4.0
rootdir: /Users/jean/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-4.3.0
collected 77 items                                                                                                                                                                         

agasc/tests/test_agasc_1.py .......                                                                                                                                                  [  9%]
agasc/tests/test_agasc_2.py ..........sssss..........ss..................                                                                                                            [ 67%]
agasc/tests/test_agasc_healpix.py .ssssssssss                                                                                                                                        [ 81%]
agasc/tests/test_obs_status.py ..............                                                                                                                                        [100%]

============================================================================== 60 passed, 17 skipped in 8.14s

Independent check of unit tests by Javier

  • OSX:

Functional tests

No functional testing.

@jeanconn jeanconn merged commit 2eeddf0 into master Sep 25, 2024
2 checks passed
@jeanconn jeanconn deleted the supp-bad-star-change-class branch September 25, 2024 17:15
@javierggt javierggt mentioned this pull request Nov 7, 2024
@javierggt javierggt mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants