Skip to content

Replace np.in1d with np.isin#225

Merged
javierggt merged 1 commit intomasterfrom
in1d
Dec 9, 2025
Merged

Replace np.in1d with np.isin#225
javierggt merged 1 commit intomasterfrom
in1d

Conversation

@javierggt
Copy link
Copy Markdown
Contributor

@javierggt javierggt commented Dec 4, 2025

Description

Remove some warnings by replacing all uses of np.in1d with np.isin.

Interface impacts

Testing

Unit tests

  • Linux (tests used proseco @b7c8104 needed for test_bad_star_set and not the numpy 2 PR that fixes the warnings)
(ska3-flight) jgonzale sparkles $ git rev-parse HEAD
98f47b27a1066f61c51124bffe4c1a2faf421a30
(ska3-flight) jgonzale sparkles $ pytest sparkles
==================================================================== test session starts =====================================================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /proj/sot/ska/jgonzalez/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 128 items                                                                                                                                          

sparkles/tests/test_checks.py ..................................................................................................                       [ 76%]
sparkles/tests/test_find_er_catalog.py .....                                                                                                           [ 80%]
sparkles/tests/test_review.py .....................                                                                                                    [ 96%]
sparkles/tests/test_yoshi.py ....                                                                                                                      [100%]

=============================================================== 128 passed in 94.25s (0:01:34) ===============================================================
(ska3-flight) jgonzale sparkles $ conda activate ska3-flight-2026.0rc4
(ska3-flight-2026.0rc4) jgonzale sparkles $ pytest sparkles
==================================================================== test session starts =====================================================================
platform linux -- Python 3.13.10, pytest-9.0.1, pluggy-1.6.0
rootdir: /proj/sot/ska/jgonzalez/git
configfile: pytest.ini
plugins: timeout-2.4.0, anyio-4.12.0
collected 128 items                                                                                                                                          

sparkles/tests/test_checks.py ..................................................................................................                       [ 76%]
sparkles/tests/test_find_er_catalog.py .....                                                                                                           [ 80%]
sparkles/tests/test_review.py .....................                                                                                                    [ 96%]
sparkles/tests/test_yoshi.py ....                                                                                                                      [100%]

====================================================================== warnings summary ======================================================================
sparkles/sparkles/tests/test_checks.py: 108 warnings
sparkles/sparkles/tests/test_find_er_catalog.py: 10 warnings
sparkles/sparkles/tests/test_review.py: 91 warnings
sparkles/sparkles/tests/test_yoshi.py: 2 warnings
  /proj/sot/ska/jgonzalez/git/proseco/proseco/guide.py:964: DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    bad = np.in1d(cand_guides["id"], list(ACA.bad_star_set))

sparkles/sparkles/tests/test_checks.py::test_include_exclude[ACAReviewTable]
sparkles/sparkles/tests/test_checks.py::test_include_exclude[ACACheckTable]
sparkles/sparkles/tests/test_review.py::test_roll_options_with_include_ids
  /proj/sot/ska/jgonzalez/git/proseco/proseco/acq.py:856: DeprecationWarning: `in1d` is deprecated. Use `np.isin` instead.
    ok = np.in1d(cand_acqs["id"], self.include_ids)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================== 128 passed, 214 warnings in 85.17s (0:01:25) ========================================================

Independent check of unit tests by Jean

  • osx pre-hope
(latest) flame:sparkles jean$ pytest
=============================================================== test session starts ===============================================================
platform darwin -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/jean/git
configfile: pytest.ini
plugins: anyio-4.7.0, timeout-2.3.1
collected 128 items                                                                                                                               

sparkles/tests/test_checks.py ..................................................................................................            [ 76%]
sparkles/tests/test_find_er_catalog.py .....                                                                                                [ 80%]
sparkles/tests/test_review.py .....................                                                                                         [ 96%]
sparkles/tests/test_yoshi.py ....                                                                                                           [100%]

================================================================ warnings summary =================================================================
sparkles/sparkles/tests/test_review.py::test_jupiter_not_present
sparkles/sparkles/tests/test_review.py::test_jupiter_not_present
  /Users/jean/miniforge3/envs/latest/lib/python3.12/site-packages/bs4/builder/_lxml.py:124: DeprecationWarning: The 'strip_cdata' option of HTMLParser() has never done anything and will eventually be removed.
    parser = parser(

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

Functional tests

No functional testing.

@javierggt javierggt changed the base branch from master to numpy2 December 4, 2025 20:47
@javierggt javierggt requested review from jeanconn and taldcroft and removed request for jeanconn December 9, 2025 17:59
Base automatically changed from numpy2 to master December 9, 2025 18:16
@javierggt javierggt merged commit 1111cb5 into master Dec 9, 2025
2 checks passed
@javierggt javierggt deleted the in1d branch December 9, 2025 19:05
This was referenced Jan 20, 2026
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