def main(): """Compare a standard Survey Population with a Large Survey Population.""" from frbpoppy.cosmic_pop import CosmicPopulation from frbpoppy.survey import Survey from frbpoppy.survey_pop import SurveyPopulation from frbpoppy.do_plot import plot pop = CosmicPopulation.simple(int(3e3), generate=False) pop.name = 'large' survey = Survey('perfect') large_pop = LargePopulation(pop, survey, max_size=1e3).pops[0] # For comparison surv_pop = SurveyPopulation(pop, survey) surv_pop.name = 'normal' plot(large_pop, surv_pop, mute=False, tns=False)
from tests.convenience import plot_aa_style, rel_path OBSERVATORIES = [('parkes-htru', 'parkes-htru'), ('wsrt-apertif', 'wsrt-apertif')] n = int(1e6) plot_aa_style() for obs in OBSERVATORIES: pattern = obs[0] survey = obs[1] s = Survey(survey) s.set_beam(model=pattern) int_pro, offset = s.calc_beam(shape=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] bins = 1e2 bin_means, bin_edges, bin_numbers = bstat(offset, int_pro, statistic='mean', bins=bins)
"""Plot intensity profile of sidelobes.""" import matplotlib.pyplot as plt import numpy as np from frbpoppy.survey import Survey SIDELOBES = [0, 1, 2, 8] SURVEY = 'apertif' MIN_Y = 1e-7 n = 50000 for sidelobe in reversed(SIDELOBES): args = {'sidelobes': sidelobe} s = Survey(SURVEY, gain_pattern='airy', n_sidelobes=sidelobe) int_pro, offset = s.intensity_profile(n_gen=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] # Clean up lower limit offset = offset[int_pro > MIN_Y] int_pro = int_pro[int_pro > MIN_Y] label = f'{sidelobe} sidelobes' if sidelobe == 1: label = label[:-1]
from frbpoppy.survey import Survey from tests.convenience import plot_aa_style, rel_path SIDELOBES = [0, 1, 2, 8] SURVEY = 'wsrt-apertif' MIN_Y = 1e-7 n = 50000 plot_aa_style() for sidelobe in reversed(SIDELOBES): args = {'sidelobes': sidelobe} s = Survey(SURVEY) s.set_beam(model='airy', n_sidelobes=sidelobe) int_pro, offset = s.calc_beam(shape=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] # Clean up lower limit offset = offset[int_pro > MIN_Y] int_pro = int_pro[int_pro > MIN_Y] label = f'{sidelobe} sidelobes' if sidelobe == 1: label = label[:-1]
plot_aa_style() for pattern in PATTERNS: n_sidelobes = 1 p = pattern z = 0 if pattern.startswith('perfect'): n_sidelobes = 0.5 if pattern.startswith('airy'): n_sidelobes = int(pattern[-1]) p = 'airy' if n_sidelobes == 0: z = 10 s = Survey(SURVEY) s.set_beam(model=p, n_sidelobes=n_sidelobes) int_pro, offset = s.calc_beam(shape=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] # Clean up lower limit offset = offset[int_pro > MIN_Y] int_pro = int_pro[int_pro > MIN_Y] print(f'Beam size at FWHM: {s.beam_size_at_fwhm}') print(f'Beam size with {n_sidelobes} sidelobes: {s.beam_size}')
import numpy as np from scipy.stats import binned_statistic as bstat from frbpoppy.survey import Survey OBSERVATORIES = [('parkes', 'htru'), ('apertif', 'apertif')] n = int(1e6) for obs in OBSERVATORIES: survey = obs[1] pattern = obs[0] s = Survey(survey, gain_pattern=pattern) int_pro, offset = s.intensity_profile(n_gen=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] # Offset in degrees offset = offset/60. bins = 1e2 bin_means, bin_edges, bin_numbers = bstat(offset, int_pro, statistic='mean',
n = 500000 plot_aa_style() for pattern in PATTERNS: n_sidelobes = 1 p = pattern z = 0 if pattern.startswith('airy'): n_sidelobes = int(pattern[-1]) p = 'airy' if n_sidelobes == 0: z = 10 s = Survey(SURVEY, gain_pattern=p, n_sidelobes=n_sidelobes) int_pro, offset = s.intensity_profile(shape=n) # Sort the values sorted_int = np.argsort(offset) int_pro = int_pro[sorted_int] offset = offset[sorted_int] # Clean up lower limit offset = offset[int_pro > MIN_Y] int_pro = int_pro[int_pro > MIN_Y] # Offset in degrees offset = offset/60. print(f'Beam size at FWHM: {s.beam_size_fwhm}')