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
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