Skip to content

Vectorize Rrup and Rjb - #78

Merged
claudio525 merged 11 commits into
mainfrom
rrup_rjb
Aug 12, 2026
Merged

Vectorize Rrup and Rjb#78
claudio525 merged 11 commits into
mainfrom
rrup_rjb

Conversation

@claudio525

Copy link
Copy Markdown
Contributor

No description provided.

@claudio525
claudio525 requested a lite review from Copilot August 9, 2026 22:32
@claudio525

Copy link
Copy Markdown
Contributor Author

@claude review

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 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_distance and Fault.rrup_distance / Fault.rjb_distance to accept N×3 point 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.0 to 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_distance is vectorized and can return an array, but the return type annotation and docstring still say it returns a float. 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_distance is vectorized and can return an array, but the return annotation/docstring still declare a float return. 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_distance now returns either a scalar or an array depending on the input shape, but it is still annotated/docstringed as returning float. 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.

Comment thread source_modelling/sources.py Outdated
@claudio525

Copy link
Copy Markdown
Contributor Author

@claude review

@claudio525
claudio525 marked this pull request as ready for review August 11, 2026 05:01
lispandfound
lispandfound previously approved these changes Aug 12, 2026
Comment thread source_modelling/sources.py Outdated
Comment thread source_modelling/sources.py Outdated
@claudio525
claudio525 merged commit 1c00cf2 into main Aug 12, 2026
7 checks passed
@claudio525
claudio525 deleted the rrup_rjb branch August 12, 2026 22:18
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.

3 participants