Esempio n. 1
0
def iter_run(i):
    r = CosmicPopulation(N_SRCS, n_days=N_DAYS, repeaters=True)
    r.set_dist(model='vol_co', z_max=1.0)
    r.set_dm_host(model='gauss', mean=100, std=200)
    r.set_dm_igm(model='ioka', slope=1000, std=None)
    r.set_dm(mw=True, igm=True, host=True)
    r.set_emission_range(low=100e6, high=10e9)
    r.set_lum(model='powerlaw',
              per_source='different',
              low=1e40,
              high=1e45,
              power=0)
    r.set_si(model='gauss', mean=-1.4, std=1)
    r.set_w(model='lognormal', per_source='different', mean=0.1, std=1)
    rate = lognormal(RATE, 2, N_SRCS)
    if LARGE_POP:
        rate = lognormal(RATE, 2, int(MAX_SIZE))  # Not completely kosher
    r.set_time(model='poisson', rate=rate)

    # Set up survey
    s = Survey('chime-frb', n_days=N_DAYS)
    s.set_beam(model='chime-frb')
    s.gen_pointings()  # To ensure each sub pop has the same pointings

    # Only generate FRBs in CHIME's survey region
    r.set_direction(model='uniform',
                    min_ra=s.ra_min,
                    max_ra=s.ra_max,
                    min_dec=s.dec_min,
                    max_dec=s.dec_max)

    if LARGE_POP:
        surv_pop = LargePopulation(r, s, max_size=MAX_SIZE).pops[0]
    else:
        r.generate()
        surv_pop = SurveyPopulation(r, s)
    surv_pop.name = f'cosmic_chime_longer_{i}'
    surv_pop.save()

    print(surv_pop.source_rate)
    print(surv_pop.burst_rate)
    pprint(f'i: {i}')
    pprint(f'# one-offs: {surv_pop.n_one_offs()}')
    pprint(f'# repeaters: {surv_pop.n_repeaters()}')
Esempio n. 2
0
def plot_coordinates(ra, dec):
    """Plot coordinate in 3D plot."""
    dec = np.deg2rad(dec)
    ra = np.deg2rad(ra)

    x = np.cos(ra) * np.cos(dec)
    y = np.sin(ra) * np.cos(dec)
    z = np.sin(dec)

    fig = plt.figure()
    ax = fig.add_subplot(111, projection=Axes3D.name)
    p = ax.scatter(x, y, z, c=np.arange(0, x.size))
    plt.colorbar(p)
    ax.axes.set_xlim3d(left=-1, right=1)
    ax.axes.set_ylim3d(bottom=-1, top=1)
    ax.axes.set_zlim3d(bottom=-1, top=1)
    plt.show()


if __name__ == '__main__':
    transit = Survey('chime-frb')
    transit.set_pointings(mount_type='transit', n_pointings=N_POINTS)
    transit.gen_pointings()
    plot_coordinates(*transit.pointings)

    tracking = Survey('perfect-small')
    tracking.set_pointings(mount_type='tracking', n_pointings=N_POINTS)
    tracking.gen_pointings()
    plot_coordinates(*tracking.pointings)
Esempio n. 3
0
# Set up survey
survey = Survey('chime-frb', n_days=0.99)
survey.set_beam('chime-frb')

# Get beam properties
beam_array = survey.beam_array
pattern = survey.beam_pattern
pixel_scale = np.float64(survey.pixel_scale)
latitude = survey.latitude
mount_type = survey.mount_type

# Limit extent of intensity for plotting reasons
beam_array[beam_array < INTENSITY_LIMIT] = INTENSITY_LIMIT

# Set pointings
survey.gen_pointings()
pointings = survey.pointings

# Targets
ra = 0
decs = [-25, 25, 75]

# Set up beam pattern array to plot
ny, nx = beam_array.shape
xx = np.arange(-nx / 2, nx / 2) * pixel_scale
yy = np.arange(-ny / 2, ny / 2) * pixel_scale

# Find corresponding Ra, Dec coordinates
extent = np.array([xx[0], xx[-1], yy[0], yy[-1]])

# Set up image properties