Example #1
0
def test_psr_utils():

    from pint.utils import (
        mass_funct,
        mass_funct2,
        pulsar_mass,
        companion_mass,
        pulsar_age,
        pulsar_edot,
        pulsar_B,
        pulsar_B_lightcyl,
    )

    pb = 1.0 * u.d
    x = 2.0 * pint.ls

    # Mass function
    assert np.isclose(mass_funct(pb, x), 0.008589595519643776 * u.solMass)

    # Mass function, second form
    assert np.isclose(
        mass_funct2(1.4 * u.solMass, 0.2 * u.solMass, 60.0 * u.deg),
        0.0020297470401197783 * u.solMass,
    )

    # Characteristic age
    assert np.isclose(
        pulsar_age(0.033 * u.Hz, -2.0e-15 * u.Hz / u.s), 261426.72446573884 * u.yr
    )

    # Edot
    assert np.isclose(
        pulsar_edot(0.033 * u.Hz, -2.0e-15 * u.Hz / u.s),
        2.6055755618875905e30 * u.erg / u.s,
    )

    # B
    assert np.isclose(
        pulsar_B(0.033 * u.Hz, -2.0e-15 * u.Hz / u.s), 238722891596281.66 * u.G
    )

    # B_lc
    assert np.isclose(
        pulsar_B_lightcyl(0.033 * u.Hz, -2.0e-15 * u.Hz / u.s),
        0.07774704753236616 * u.G,
    )
Example #2
0
def test_Edot():
    # Edot
    assert np.isclose(
        pulsar_edot(0.033 * u.Hz, -2.0e-15 * u.Hz / u.s),
        2.6055755618875905e30 * u.erg / u.s,
    )