示例#1
0
def get_data():
    """Get the population data."""
    # Construct population
    pop = CosmicPopulation(SIZE,
                           days=1,
                           name='standard_candle',
                           H_0=67.74,
                           W_m=0.3089,
                           W_v=0.6911,
                           dm_host_model='gaussian',
                           dm_host_mu=100,
                           dm_host_sigma=0,
                           dm_igm_index=1000,
                           dm_igm_sigma=None,
                           dm_mw_model='ne2001',
                           emission_range=[10e6, 10e9],
                           lum_range=[1e36, 1e36],
                           lum_index=0.,
                           n_model='sfr',
                           alpha=-1.5,
                           w_model='uniform',
                           w_range=[1., 1.],
                           w_mu=0.1,
                           w_sigma=0.,
                           si_mu=0.,
                           si_sigma=0.,
                           z_max=2.5)

    # Survey population
    pops = {}
    for b in BEAMPATTERNS:

        n_s = 0
        bp = b
        if b.startswith('airy'):
            bp, n_s = b.split('-')
            n_s = int(n_s)

        survey = Survey(name='perfect-small')
        survey.gain_pattern = bp
        survey.n_sidelobes = n_s
        surv_pop = SurveyPopulation(pop, survey)
        pops[b] = surv_pop

    return pops
                       n_model='sfr',
                       w_model='uniform',
                       w_range=[1., 1.],
                       w_mu=1.,
                       w_sigma=0.,
                       si_mu=0.,
                       si_sigma=0.,
                       z_max=2.5)

pop_obs = {}

survey = Survey('perfect-small', n_sidelobes=0)

for pattern in BEAMPATTERNS:

    survey.gain_pattern = pattern

    # Observe populations
    pop_obs[pattern] = SurveyPopulation(pop, survey)
    pop_obs[pattern].name = f'obs-{pattern}'
    pop_obs[pattern].rates()
    pop_obs[pattern].save()

plot_aa_style()
f, (ax1) = plt.subplots(1, 1)

for p in BEAMPATTERNS:

    pop = pop_obs[p]
    limit = 1e-9
示例#3
0
def main():

    r = RepeaterPopulation(N,
                           days=1,
                           dm_host_model='gaussian',
                           dm_host_mu=100,
                           dm_host_sigma=0,
                           dm_igm_index=1000,
                           dm_igm_sigma=0,
                           dm_mw_model='zero',
                           emission_range=[10e6, 10e9],
                           lum_range=[1e38, 1e38],
                           lum_index=0,
                           n_model='vol_co',
                           alpha=-1.5,
                           w_model='uniform',
                           w_range=[1., 1.],
                           w_mu=0.1,
                           w_sigma=0.5,
                           si_mu=-1.4,
                           si_sigma=0.,
                           z_max=2.5,
                           lum_rep_model='independent',
                           lum_rep_sigma=1e3,
                           si_rep_model='same',
                           si_rep_sigma=0.1,
                           times_rep_model='even',
                           w_rep_model='independent',
                           w_rep_sigma=0.05,
                           generate=True)

    s = Survey('perfect')
    s.gain_pattern = 'perfect'

    # Setup pointings
    n_p = 1  # # of pointings
    decs = np.linspace(s.dec_min, s.dec_max, n_p + 2)[1:n_p + 1]
    ras = np.linspace(s.ra_min, s.ra_max, n_p + 2)[1:n_p + 1]
    s.pointings = list(zip(ras, decs))
    pop = limit_ra_dec(r, s.pointings)
    pop.name = 'Cosmic Population'

    s.snr_limit = 1
    surv_pop_low_snr = SurveyPopulation(r, s)
    surv_pop_low_snr.name = 'Low SNR'

    s.snr_limit = 10
    surv_pop_high_snr = SurveyPopulation(r, s)
    surv_pop_high_snr.name = 'High SNR'

    pops = [pop]
    # Split population into seamingly one-off and repeater populations
    for pop in (surv_pop_low_snr, surv_pop_high_snr):
        mask = ((~np.isnan(pop.frbs.time)).sum(1) > 1)
        pop_ngt1, pop_nle1 = split_pop(pop, mask)
        pop_ngt1.name += ' (> 1 burst)'
        pop_nle1.name += ' (1 burst)'
        pops.append(pop_nle1)
        pops.append(pop_ngt1)

    plot(*pops, frbcat=False, mute=False, show=True)