Skip to content

Replace deprecated np.in1d with np.isin#1127

Merged
andreicuceu merged 2 commits intomainfrom
copilot/refactor-numpy-in1d-replacement
Mar 23, 2026
Merged

Replace deprecated np.in1d with np.isin#1127
andreicuceu merged 2 commits intomainfrom
copilot/refactor-numpy-in1d-replacement

Conversation

Copy link
Contributor

Copilot AI commented Mar 23, 2026

numpy.in1d was deprecated in NumPy 1.24 and removed in recent versions, causing test failures. Replace all usages with the equivalent numpy.isin.

Changes

  • 9 files updated across py/picca/, py/picca/bin/, py/picca/pk1d/, py/picca/delta_extraction/, and tutorials/
# Before
w = np.in1d(catalogue["THING_ID"], drq_catalogue["THING_ID"])

# After
w = np.isin(catalogue["THING_ID"], drq_catalogue["THING_ID"])

np.isin is a drop-in replacement — identical signature and return behavior for all use cases here.

Original prompt

This section details on the original issue you should resolve

<issue_title>numpy.in1d is deprecated and needs to be removed</issue_title>
<issue_description>We need to refactor the code to use np.isin instead of np.in1d, as the latter is deprecated and has been removed in recent versions of numpy. A number of tests are failing due to this</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: andreicuceu <28951059+andreicuceu@users.noreply.github.com>
Agent-Logs-Url: https://github.com/igmhub/picca/sessions/a84f61d6-2f15-418c-8701-3552c51ed26b
Copilot AI changed the title [WIP] Refactor code to use np.isin instead of np.in1d Replace deprecated np.in1d with np.isin Mar 23, 2026
Copilot AI requested a review from andreicuceu March 23, 2026 21:40
@HiramHerrera HiramHerrera marked this pull request as ready for review March 23, 2026 22:09
Copy link
Collaborator

@HiramHerrera HiramHerrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look inoffensive to me and correctly address the deprecation of np.in1d in NumPy > 1.24.

Everything looks good to me.

@andreicuceu andreicuceu added this pull request to the merge queue Mar 23, 2026
Merged via the queue into main with commit c4b76ee Mar 23, 2026
12 checks passed
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.

numpy.in1d is deprecated and needs to be removed

3 participants