Repository navigation
FEAT: log densities for the parametric mass models - #146
Merged
Merged
Conversation
Add ln_ versions of power_law_mass, power_law_primary_mass_ratio, power_law_primary_secondary_independent/identical, three_component_single, two_component_primary_secondary_independent/ identical, double_power_law_primary_mass, double_power_law_peak_primary_mass and double_power_law_primary_power_law_mass_ratio. The power laws use ln_powerlaw and ln_powerlaw_from_logs, whose normalization does not overflow for steep slopes in single precision. The broken power law adds the log of the continuity correction to the lower part and subtracts log(1 + correction) with logaddexp; the mixtures use logaddexp. Functions of the dataset use dataset["ln_mass_1"], ["ln_mass_2"] and ["ln_mass_ratio"] when present, as ln_two_component_primary_mass_ratio does, and the power law in mass ratio it uses moves to _ln_mass_ratio_power_law to be shared. In a float32 survey (10k samples x 10 draws per model), the points lost to underflow drop to none from 1.3% for two_component_primary_secondary_independent/identical, 1.8% for three_component_single and 0.6% for double_power_law_peak_primary_mass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## ln-spin-models #146 +/- ##
==================================================
+ Coverage 95.21% 95.50% +0.29%
==================================================
Files 14 14
Lines 1107 1156 +49
==================================================
+ Hits 1054 1104 +50
+ Misses 53 52 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Add ln_ versions of power_law_mass, power_law_primary_mass_ratio, power_law_primary_secondary_independent/identical, three_component_single, two_component_primary_secondary_independent/ identical, double_power_law_primary_mass,
double_power_law_peak_primary_mass and
double_power_law_primary_power_law_mass_ratio.
The power laws use ln_powerlaw and ln_powerlaw_from_logs, whose normalization does not overflow for steep slopes in single precision. The broken power law adds the log of the continuity correction to the lower part and subtracts log(1 + correction) with logaddexp; the mixtures use logaddexp. Functions of the dataset use dataset["ln_mass_1"], ["ln_mass_2"] and ["ln_mass_ratio"] when present, as ln_two_component_primary_mass_ratio does, and the power law in mass ratio it uses moves to _ln_mass_ratio_power_law to be shared.
In a float32 survey (10k samples x 10 draws per model), the points lost to underflow drop to none from 1.3% for
two_component_primary_secondary_independent/identical, 1.8% for three_component_single and 0.6% for double_power_law_peak_primary_mass.