示例#1
0
def get_data():
    """Get the population data."""
    # Construct population
    pop = CosmicPopulation(n_srcs=SIZE, n_days=1, name='standard_candle')
    pop.set_dist(model='sfr', z_max=2.5, H_0=67.74, W_m=0.3089, W_v=0.6911)
    pop.set_dm_host(model='constant', value=100)
    pop.set_dm_igm(model='ioka', slope=1000, std=None)
    pop.set_dm_mw(model='ne2001')
    pop.set_emission_range(low=10e6, high=10e9)
    pop.set_lum(model='constant', value=1e36)
    pop.set_w(model='constant', value=1.)
    pop.set_si(model='constant', value=0)
    pop.generate()

    # Survey population
    pops = {}
    for b in BEAMPATTERNS:
        pprint(f'Surveying with {b} beampattern')
        n_s = 0
        bp = b
        if b.startswith('airy'):
            bp, n_s = b.split('-')
            n_s = int(n_s)

        survey = Survey(name='perfect-small')
        # Prevent beam from getting larger than the sky
        survey.set_beam(model=bp, n_sidelobes=n_s, size=10)
        surv_pop = SurveyPopulation(pop, survey)
        print(surv_pop.source_rate)
        pops[b] = surv_pop

    return pops
# You can set up a population with arguments ...
pop = CosmicPopulation(1e4, n_days=1, name='my_own_population', repeaters=True,
                       generate=False)
# ... but also adapt specific components:

# The numer density / distance parameters
pop.set_dist(model='vol_co', z_max=0.01, alpha=-1.5,
             H_0=67.74, W_m=0.3089, W_v=0.6911)

# Which dispersion measure components to include
pop.set_dm(mw=True, igm=True, host=True)

# Dispersion measure properties
pop.set_dm_host(model='gauss', mean=100, std=200)
pop.set_dm_igm(model='ioka', slope=1000, std=None)
pop.set_dm_mw(model='ne2001')

# Emission range of FRB sources
pop.set_emission_range(low=100e6, high=10e9)

# Luminsity of FRBs
# See the per_source argument? That allows you to give different properties
# to different bursts from the same source. You can do that for the luminosity,
# or any of the following parameters
pop.set_lum(model='powerlaw', low=1e38, high=1e38, power=0,
            per_source='different')

# Pulse width
pop.set_w(model='uniform', low=10, high=10)

# Spectral index