phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
79 stars 30 forks source link

fix requivfrac units #894

Closed kecnry closed 3 months ago

kecnry commented 3 months ago

This PR fixes the units on the optional requivfrac parameter to be unitless.

Fixes #690 (I could not reproduce the actual distributions problem anymore and I think that was fixed in 2.4.4 - but the unit issue remained and is fixed here). The following code now works:

import phoebe

b = phoebe.default_binary()

b.add_constraint('requivfrac', component='primary')
b.add_constraint('requivfrac', component='secondary')
b.flip_constraint('requivfrac@primary', solve_for='requiv@primary')
b.flip_constraint('requivfrac@secondary', solve_for='requiv@secondary')

b.add_distribution({'teffratio': phoebe.gaussian_around(10),
                    'requivfrac@primary': phoebe.gaussian_around(0.1),
                    'incl@binary': phoebe.gaussian_around(0.1),
                    'q': phoebe.gaussian_around(0.1),
                    'asini@binary': phoebe.gaussian_around(1),
                    'teff@primary': phoebe.gaussian_around(100),
                    'requivfrac@secondary': phoebe.gaussian_around(0.1),
                    't0_supconj': phoebe.gaussian_around(1)},
                  distribution='test_dist')
b.uncertainties_from_distribution_collection(distribution='test_dist', parameters=['requiv@secondary'], sigma=3, tex=True)
image