コード例 #1
0
def pulsar_beaming(pulsar, bM):
    """
    Work out if the pulsar is beaming --- model-dependent
    """

    # Tauris & Manchester beaming model (default)
    if bM == 'tm98':
        fraction = beammodels.tm98_fraction(pulsar)
    ## more models to add here!
    elif bM == 'none':
        fraction = 1.0
    elif bM == 'const':
        fraction = 0.2
    elif bM == 'wj08':
        fraction = beammodels.wj08_fraction(pulsar)
    else:
        raise EvolveException('Invalid beaming model: {0}'.format(bM))

    if random.random() < fraction:
        pulsar.beaming = True
    else:
        pulsar.beaming = False
コード例 #2
0
ファイル: evolve.py プロジェクト: samb8s/PsrPopPy
def pulsar_beaming(pulsar, bM):
    """
    Work out if the pulsar is beaming --- model-dependent
    """

    # Tauris & Manchester beaming model (default)
    if bM == 'tm98':
        fraction = beammodels.tm98_fraction(pulsar)
    # more models to add here!
    elif bM == 'none':
        fraction = 1.0
    elif bM == 'const':
        fraction = 0.2
    elif bM == 'wj08':
        fraction = beammodels.wj08_fraction(pulsar)
    else:
        raise EvolveException('Invalid beaming model: {0}'.format(bM))

    if random.random() < fraction:
        pulsar.beaming = True
    else:
        pulsar.beaming = False