Vectorize Rrup and Rjb - #78
Merged
Merged
Conversation
Contributor
Author
|
@claude review |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the seismic source geometry distance APIs to support vectorized RRup and Rjb computations (computing distances for many points in one call), aligning the implementation and tests with array-based workflows.
Changes:
- Vectorize
Plane.rrup_distance/Plane.rjb_distanceandFault.rrup_distance/Fault.rjb_distanceto acceptN×3point arrays and return per-point distances. - Update Hypothesis/property tests to exercise multi-point inputs and assert array outputs; add a single-point regression test for
Plane.rjb_distance. - Require
shapely>=2.0to use vectorized geometry construction (shapely.points).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_sources.py | Updates tests to validate vectorized RRup/Rjb behavior and adds a single-point Rjb regression test. |
| source_modelling/sources.py | Implements vectorized RRup/Rjb computations for Plane and Fault with scalar fallback for single-point inputs. |
| pyproject.toml | Bumps Shapely dependency to >=2.0 to support new vectorized Shapely usage. |
Suppressed comments (3)
source_modelling/sources.py:857
rjb_distanceis vectorized and can return an array, but the return type annotation and docstring still say it returns afloat. This is a public API/type contract mismatch.
def rjb_distance(self, points: np.ndarray) -> float:
"""Return the closest projected distance between the fault and the points.
Parameters
----------
source_modelling/sources.py:1401
Fault.rjb_distanceis vectorized and can return an array, but the return annotation/docstring still declare afloatreturn. This should be updated to avoid misleading API consumers and type checking errors.
def rjb_distance(self, points: np.ndarray) -> float:
"""Return the closest projected distance between the fault and the points.
Parameters
----------
source_modelling/sources.py:1338
Fault.rrup_distancenow returns either a scalar or an array depending on the input shape, but it is still annotated/docstringed as returningfloat. Update the public contract to reflect the vectorized behavior.
def rrup_distance(self, points: np.ndarray) -> float:
"""Compute RRup Distance between a fault and a point.
Parameters
----------
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
@claude review |
claudio525
marked this pull request as ready for review
August 11, 2026 05:01
claudio525
requested review from
AndrewRidden-Harper,
joelridden and
lispandfound
August 11, 2026 05:01
lispandfound
previously approved these changes
Aug 12, 2026
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.