Open
Conversation
comane
reviewed
Mar 26, 2026
Comment on lines
+117
to
+120
| # filter from integrability outliers | ||
| log.info("Filtering out non-integrable replicas") | ||
| log.info(f"Integrability threshold: {integrability_threshold}") | ||
|
|
Member
There was a problem hiding this comment.
These run unconditionally even if filter_integrability=False
Comment on lines
+122
to
+139
| v_grid = pdf_array[ | ||
| :, FLAVOUR_TO_ID_MAPPING["V"], : | ||
| ] # extract V flavour from all replicas | ||
| mask = ( | ||
| np.abs(v_grid[:, :20].sum(axis=1)) <= integrability_threshold | ||
| ) # Sum first 20 x-points | ||
| # Count how many replicas are being discarded | ||
| n_discarded = (~mask).sum() # Count False values | ||
| n_kept = mask.sum() # Count True values | ||
| log.info( | ||
| f"Filtering V integrability: discarded {n_discarded} replicas, kept {n_kept}" | ||
| ) | ||
| pdf_array = pdf_array[mask, :, :] # keep only replicas where mask is 'true' | ||
|
|
||
| v3_grid = pdf_array[:, FLAVOUR_TO_ID_MAPPING["V3"], :] | ||
| mask = np.abs(v3_grid[:, :20].sum(axis=1)) <= integrability_threshold | ||
| n_discarded = (~mask).sum() | ||
| n_kept = mask.sum() |
Member
There was a problem hiding this comment.
The inner loop in here could be factored in something like:
for flavour in ["V", "V3", "V8", "T3", "T8"]:
grid = pdf_array[:, FLAVOUR_TO_ID_MAPPING[flavour], :]
mask = np.abs(grid[:, :20].sum(axis=1)) <= integrability_threshold
Comment on lines
+70
to
72
| filter_integrability: bool = True, | ||
| integrability_threshold: float = 0.5, | ||
| ): |
Member
There was a problem hiding this comment.
This new parameters should be documented in the docstring
Comment on lines
+125
to
+127
| mask = ( | ||
| np.abs(v_grid[:, :20].sum(axis=1)) <= integrability_threshold | ||
| ) # Sum first 20 x-points |
Member
There was a problem hiding this comment.
20 is a number that we might want to not keep hardcoded? If we want to keep it hardcoded, instead, then it needs explaining (eg 1e-7 ...)
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.
No description provided.