Skip to content

Corner orientation#14

Merged
lispandfound merged 27 commits intomainfrom
corner_orientation
Dec 16, 2024
Merged

Corner orientation#14
lispandfound merged 27 commits intomainfrom
corner_orientation

Conversation

@lispandfound
Copy link
Copy Markdown
Contributor

This pull request includes changes to the source_modelling/sources.py file, focusing on refactoring and improving the robustness of the code, as well as adding new tests in the tests/test_sources.py file to ensure the correctness of the changes.

Refactoring and Improvements:

  • Changed @staticmethod to @classmethod for factory methods in Point, Plane, and Fault classes, and replaced explicit class names with Self for better maintainability and readability. [1] [2] [3] [4] [5] [6] [7]
  • Modified the Plane class constructor to validate the input bounds and ensure they form a valid plane.
  • Updated length_m and width_m properties in the Plane class to explicitly return float values.
  • Added numpy.typing as npt for type hinting in Plane class constructor.

Testing Enhancements:

  • Added new tests in tests/test_sources.py to validate the Plane class constructor with various invalid inputs, ensuring that the constructor raises appropriate errors.

- tests check that the plane orientation matches documentation
claudio525
claudio525 previously approved these changes Dec 4, 2024
@claudio525 claudio525 mentioned this pull request Dec 4, 2024
joelridden
joelridden previously approved these changes Dec 4, 2024
@lispandfound lispandfound dismissed stale reviews from joelridden and claudio525 via bdd86df December 5, 2024 04:02
@lispandfound
Copy link
Copy Markdown
Contributor Author

Since the last review:

  1. I've added test cases to check that the Fault class actually rejects invalid faults.
  2. Fixed the tests that were failing because of API changes introduced by Plane construction and extraction. #16.
  3. Misc ruff fixes.

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.

Are they ever 0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sometimes, when the fault is constructed dynamically in the case of the NSHMDB

@lispandfound lispandfound merged commit 451b20b into main Dec 16, 2024
@claudio525 claudio525 deleted the corner_orientation branch January 27, 2025 06:02
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