Repository navigation
BUG: prevent masked values leaking into jackknife resamples - #20582
rajpreetcodes wants to merge 1 commit into
Conversation
|
Hi 👋 and thank you for your contribution! 🙏 This pull request is being closed automatically - but don't worry, this is not the end, and we may re-open it. For some background, we have recently started seeing a rapid increase in the number of pull requests opened. Some of these are from good-faith humans, but some of which are from autonomous LLM agents or humans using LLMs who do not have a genuine understanding of, or interest in, the project. We are therefore auto-closing pull requests from new contributors, but if you are a good-faith human, we want to make sure your pull request gets considered! So if you would like us to re-open your pull request so that it gets reviewed, you need to do two things:
The second step is important, as we may otherwise miss notifications about this pull request. To be clear, our AI policy does allow the use of LLMs as part of contributions, but we need to see authentic engagement and understanding from humans making the contribution. Notes for maintainersIf you know this is a genuine user and the PR is is compliance with the AI policy, you may re-open this straight away. After two successful merged pull requests, the user will be added to the allowlist and future PRs will no longer be closed automatically. This user has not made any pull requests to this repository prior to this one. In addition, here are some statistics on the user's activity on GitHub:
|
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
Hi @giles, this pull request addresses #20579 where masked elements in a MaskedArray leaked into resampled jackknife slices and corrupted downstream estimates and standard errors. I encountered this issue while running jackknife estimators on flagged astronomical time-series data. The PR includes the fix, comprehensive regression tests for MaskedArray inputs, and the towncrier changelog fragment. All test suites on CircleCI are green. Could maintainers please reopen this PR for review? |
Description
This pull request addresses #20579 where passing a masked array (numpy.ma.MaskedArray or astropy.utils.masked.Masked) to jackknife_resampling or jackknife_stats caused masked values to silently leak into the resampled iterations, producing incorrect estimates and standard errors.
In jackknife_resampling, allocating resamples = np.empty([n, n - 1]) as an ordinary ndarray stripped the mask upon row assignment (resamples[i] = np.delete(data, i)), which allowed invalid underlying masked values to enter subsequent calculations.
The fix compresses masked arrays to their valid unmasked observations prior to generating the jackknife resamples, matching statistical expectations for leave-one-out estimators with missing data. Regression tests covering MaskedArray resampling, statistics, and all-masked validation have been added.
Fixes #20579
AI Disclosure
N/A