def galacticDistribute(pulsar, pop): """ select a galactic position - spiral arms on or off?""" if not pop.nospiralarms: # using spiral arms r0 = go.ykr() x, y = go.spiralize(r0) else: # distribute randomly in x-y plane x = -20. + random.random() * 40. y = -20. + random.random() * 40. # calculate z and r0 z = dists.draw_double_sided_exp(pop.zscale) pulsar.galCoords = (x, y, z) pulsar.r0 = math.sqrt(x**2 + y**2)
def galacticDistribute(pulsar, pop): """ select a galactic position - spiral arms on or off?""" if not pop.nospiralarms: # using spiral arms r0 = go.ykr() x, y = go.spiralize(r0) else: # distribute randomly in x-y plane x = -20. + random.random()*40. y = -20. + random.random()*40. # calculate z and r0 z = dists.draw_double_sided_exp(pop.zscale) pulsar.galCoords = (x, y, z) pulsar.r0 = math.sqrt(x**2 + y**2)