test to fix weights - #118
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix a weights-related bug introduced in a newer version of flip by propagating the data-selection mask returned by prepare_data_position() and using it to keep weights aligned with masked positions during gridding.
Changes:
- Updated
prepare_data_position()to return the boolean selection mask used to filter positions. - Updated density and velocity gridding functions to capture that mask and apply it to weights.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+698
to
+705
| if data_weights is None: | ||
| data_weights = np.ones((data_positions.shape[0],)) | ||
| else: | ||
| data_weights = data_weights[mask_data] | ||
| if randoms_weights is None: | ||
| randoms_weights = np.ones((randoms_positions.shape[0],)) | ||
| else: | ||
| randoms_weights = randoms_weights[mask_data] |
Comment on lines
+838
to
+845
| if data_weights is None: | ||
| data_weights = np.ones((data_positions.shape[0],)) | ||
| else: | ||
| data_weights = data_weights[mask_data] | ||
| if randoms_weights is None: | ||
| randoms_weights = np.ones((randoms_positions.shape[0],)) | ||
| else: | ||
| randoms_weights = randoms_weights[mask_data] |
Comment on lines
+1230
to
+1238
| data_positions, _, _, mask_data = prepare_data_position( | ||
| data_position_sky, | ||
| rcom_max, | ||
| overhead, | ||
| ) | ||
| if count_weights is None: | ||
| count_weights = np.ones((data_positions.shape[0],)) | ||
| else: | ||
| count_weights = count_weights[mask_data] |
Comment on lines
610
to
615
| return ( | ||
| data_positions, | ||
| data_position_bandwith, | ||
| randoms_positions, | ||
| mask, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing a small bug introduced in the new version of flip