Synphot package and Offener binary models - #162
Open
jluastro wants to merge 38 commits into
Open
Conversation
Introduce MultiplicityPiecewisePowerLaw plus unresolved/resolved Offner 2023 classes fitted to Table 1 MF/CF (including brown dwarfs). Companion mass and separation draws now live on the multiplicity object; Lu+2013 defaults are unchanged. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
calc_multi now only delegates to the multiplicity object. random_q is mass-aware so Offner γ_trunc applies to BD primaries instead of the hardcoded Fontanive 6.1. random_companion_count owns the BD binaries-only cap. synthetic.py duck-types resolved orbits on log_semimajoraxis, random_e, and random_keplarian_parameters. Docs and IMF tests updated. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Replace the discontinuous 8-segment two-point Table 1 fit with a 3-segment broken power law continuous at 0.08 and 1.5 Msun. Add a two-panel MF vs mass figure (Lu+2013 vs Offner vs Table 1) to the docs and PR. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Offner et al. 2023 now subclasses MultiplicityLogistic instead of the piecewise power law. MF/CSF use equal-weight Table 1 logistic coefficients; the generic piecewise class remains for tests and other surveys. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Two-panel BD-zoom plus full-range plots of Table 1 gamma_trunc and characteristic a, plus a mean-q companion panel. Curves come from the multiplicity objects so they cannot drift from the code. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Two-panel plot of Table 2 separation scatter versus the Duchene-Kraus linear-in-log-M fit. Offner holds sigma=0.7 for brown dwarfs; Lu DK shows the 0.08 Msun blend dip. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Replace Table 1/2 log-mass interpolations with an error-weighted logistic for gamma, a logcosh smooth broken power law for mu(a), and a 2-parameter logistic for sigma(log10 a). Resolved draws use those as loc and scale. MF/CSF logistic and Lu+2013 are unchanged. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Expand docs/multiplicity.rst with formulas for MF/CSF, gamma, mu(a), and sigma(log a), plus the five Lu+2013 comparison figures. Point imf.rst and the changelog at the opt-in Offner model. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
The comparison plots and docs describe Offner 2023 vs the default MultiplicityUnresolved / MultiplicityResolvedDK that shipped in SPISEA v2.5. Keep Lu et al. 2013 citations on the original classes. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Filenames, RST figure paths, and plot-script helpers now match the SPISEA v2.5 comparison baseline. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Updated the documentation for the multiplicity object, clarifying its functions and usage in the IMF. Revised sections on companion evolution and recommended multiplicity classes.
Add Parameters and Returns (types and units) to every new helper, class, and method in multiplicity.py. Expand modified methods that already had a Parameters block but omitted units. No math changes. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Private helpers sit after the public classes and MultiplicityOffner2023 alias so Sphinx/source order documents the classes first. Table arrays that call _offner2023_table1_geom_mass follow that helper. No behavior change. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Evaluate the logistic and smooth broken power law on positive masses only. Keep M>0 math unchanged. Tests and docs no longer treat M<=0 as mapping to the low-mass asymptote. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
The comparison figure now evaluates the original object: the array path for the dashed power law and the scalar path for the BD staircase. Hardcoded 0.44 M**0.51 and 0/8%/16% helpers are gone. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Expose MultiplicityResolvedDK.log_a_mean, a_mean, and sigma_log_a as the characteristic mean and width already used by log_semimajoraxis, and generate each comparison PNG from a matching script that calls the multiplicity objects rather than hardcoded functional forms. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Users must construct MultiplicityUnresolvedOffner2023 or MultiplicityResolvedOffner2023 explicitly; there is no shorthand. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
docs/multiplicity.rst is now a short wiring intro plus autoclass and one-line comparison figures. Formulas, coefficients, BD policy, and Table 1 caveats live on the public multiplicity classes. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Keep docs/multiplicity.rst as a short landing page plus autoclass and the five comparison figures. List the plot_* scripts used to regenerate them. Align Piecewise/Logistic Notes with the other classes. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Drop leftover piecewise-fit helper and Table 1/2 arrays that were stored on the objects but never read. Keep sep_sig_mass / sep_sig for the σ comparison plot. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Delete OFFNER2023_* and FONTANIVE2018_BD_Q_POWER module globals. MultiplicityUnresolved takes bd_q_power=6.1; Offner classes take the Table 1/2 logistic and smooth-break values as kwargs, stored on self and used by q_power_at_mass / log_a_mean / sigma_log_a. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
List the Offner shape kwargs with hardcoded defaults on both unresolved and resolved __init__s. Drop binary_only_mass_max so companion_max is the only count cap. Add the CSF vs mass comparison figure from companion_star_fraction on the multiplicity objects. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
log_semimajoraxis and random_keplarian_parameters now take rng=None and default to a new numpy Generator. synthetic.py passes self.rng. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Five tests check that the same default_rng seed reproduces random_companion_count, draw_n_companions, draw_companion_masses, log_semimajoraxis, and random_keplarian_parameters. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
…ingUniverseLab/SPISEA into cursor/offner-2023-multiplicity-ad2c
Cluster companion-mass draws go calc_multi → draw_companion_masses → draw_q. The v2.5 class keeps the BD/stellar two-draw split; Offner draws all primaries in one shot. random_q remains as a deprecated inverse-CDF wrapper. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Deprecated random_q remains only on the v2.5 classes. Offner overrides it to TypeError and no longer lists q_power on either __init__. Logistic still receives q_power internally. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Unresolved Offner is companions-only (MF/CSF/q). log_a_mean, a_mean, sigma_log_a and the a/σ kwargs now live only on MultiplicityResolvedOffner2023. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
The mean-q check no longer skips when fewer than 5 BD companions are drawn. Seed 7 with M_cl=2e3 already yields well above that. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Keep the γ and mean-q science checks; rename the test so it describes the comparison rather than calc_multi string greps. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
Say Offner resolved is not a MultiplicityResolvedDK subclass. No logic change. Co-authored-by: Jessica Lu <jlu.astro@berkeley.edu>
…ingUniverseLab/SPISEA into cursor/offner-2023-multiplicity-ad2c
…tiplicity-ad2c Add Offner et al. 2023 multiplicity models (unresolved + resolved)
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.
Major update all synphot and stsynphot packages (instead of defunct pysynphot) and major binary refactor to include Offner models.