示例#1
0
def mchirp_q_to_mass1_mass2(mchirp, q):
    """ This function takes a value of mchirp and the mass ratio
    mass1/mass2 and returns the two component masses.

    The map from q to eta is

        eta = (mass1*mass2)/(mass1+mass2)**2 = (q)/(1+q)**2

    Then we can map from (mchirp,eta) to (mass1,mass2).
    """
    eta = conversions.eta_from_q(q)
    mass1 = conversions.mass1_from_mchirp_eta(mchirp, eta)
    mass2 = conversions.mass2_from_mchirp_eta(mchirp, eta)
    return mass1, mass2
示例#2
0
def mchirp_q_to_mass1_mass2(mchirp, q):
    """ This function takes a value of mchirp and the mass ratio
    mass1/mass2 and returns the two component masses.

    The map from q to eta is

        eta = (mass1*mass2)/(mass1+mass2)**2 = (q)/(1+q)**2

    Then we can map from (mchirp,eta) to (mass1,mass2).
    """
    eta = conversions.eta_from_q(q)
    mass1 = conversions.mass1_from_mchirp_eta(mchirp, eta)
    mass2 = conversions.mass2_from_mchirp_eta(mchirp, eta)
    return mass1, mass2
示例#3
0
def transform_masses(mass1, mass2, mchirp_mod, eta_mod):
    """Modifies masses given a difference in mchirp and eta.

    Parameters
    ----------
    mass1 : float
        Mass of the larger object (already modified).
    mass2 : float
        Mass of the smaller object (already modified).
    mchirp_mod : tuple of (float, str) or None
        Tuple giving the modification value for ``mchirp``, and a string
        indicating whether the given modification is a fractional difference
        (``'fdiff'``), an absolute difference (``'absdiff'``), or a replacement
        (``'replace'``). If ``None``, the chirp mass will not be modified.
    eta_mod : tuple of (float, str)
        Same as ``mchirp_mod``, but for ``eta``.

    Returns
    -------
    mass1 : float
        Modified mass1.
    mass2 : float
        Modified mass2.
    """
    mchirp = conversions.mchirp_from_mass1_mass2(mass1, mass2)
    eta = conversions.eta_from_mass1_mass2(mass1, mass2)
    if mchirp_mod is not None:
        diff, modtype = mchirp_mod
        mchirp = apply_mod(mchirp, diff, modtype)
    if eta_mod is not None:
        diff, modtype = eta_mod
        eta = apply_mod(eta, diff, modtype)
    # make sure values are physical
    if (eta < 0 or eta > 0.25) or mchirp < 0:
        raise NoWaveformError("unphysical masses")
    m1 = conversions.mass1_from_mchirp_eta(mchirp, eta)
    m2 = conversions.mass2_from_mchirp_eta(mchirp, eta)
    return m1, m2