Repository navigation
Test magnitude scaling boundaries, warnings and random coefficients - #162
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Tests-only change to
tests/test_magnitude_scaling.py, coveringsource_modelling/magnitude_scaling.py.What the new tests check
Leonard rake boundaries:
leonard_area_to_magnitudeuses the strike-slip constant (3.99) at exactly ±45° and ±135°, and the dip-slip constant (4.0) at ±46° and ±134°.Leonard random coefficients: with a fixed seed, 2000 samples have the mean and standard deviation from Table 4 of the paper. That is 3.99 ± 0.26 for strike-slip and 4.03 ± 0.3 for dip-slip. The existing test only checked that the samples were normally distributed.
Contreras interface sign convention: the normal sample is mocked to a fixed deviation.
contreras_interface_area_to_magnitudemust then invertcontreras_interface_magnitude_to_areaexactly, and the area must equalexp(a1 + a2·M + δ).Range warnings and boundaries:
Each of these tests also checks the value returned.
Aspect ratio values: the ratio is 1 below the hinge magnitude and
exp(a3·(M − m1))above it, for both the interface and slab relations.Missing rake:
magnitude_to_length_width,magnitude_to_areaandarea_to_magnituderaiseValueErrorforLEONARD2014when no rake is given.Coverage of
magnitude_scaling.pyBefore: 94%. Lines 250, 256, 400, 437, 522, 572, 613, 690, 735 and 773 were not covered.
After: 100%.
Surviving mutants
Killed (23):
leonard_area_to_magnitudemutants 6–11 and 13: the rake boundary comparisons and constants.locorscaledropped or changed by 1. Caught by the sample mean and standard deviation test.contreras_interface_area_to_magnitudemutants 2 and 3: the threshold changed to<=or 138.76.- sigma_achanged to+ sigma_a. Caught by the inversion test with a fixed deviation.strasser_slab_area_to_magnitudemutants 3 and 5: the area bounds changed to 131 and 5213.Equivalent (1):
contreras_interface_area_to_magnitudemutant 13 removesloc=0fromsp.stats.norm(loc=0, ...). The defaultlocis already 0, so the behaviour cannot change.No issues filed.
🤖 Generated with Claude Code