Skip to content

test to fix weights - #118

Merged
corentinravoux merged 2 commits into
mainfrom
fix_weight
Jul 7, 2026
Merged

test to fix weights#118
corentinravoux merged 2 commits into
mainfrom
fix_weight

Conversation

@corentinravoux

Copy link
Copy Markdown
Owner

Fixing a small bug introduced in the new version of flip

Copilot AI review requested due to automatic review settings July 6, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 thread flip/data_vector/mesh.py Outdated
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 thread flip/data_vector/mesh.py Outdated
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 thread flip/data_vector/mesh.py Outdated
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 thread flip/data_vector/mesh.py
Comment on lines 610 to 615
return (
data_positions,
data_position_bandwith,
randoms_positions,
mask,
)
@corentinravoux
corentinravoux merged commit 9c1e831 into main Jul 7, 2026
3 checks passed
@corentinravoux
corentinravoux deleted the fix_weight branch July 7, 2026 13:08
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