params = ch_frb_rfi.transform_parameters( plot_type='web_viewer', plot_nypix=1024, plot_nxpix=256, plot_downsample_nt=16, plot_nzoom=4, max_nt_buffer=4, make_plots=make_plots, bonsai_plot_nypix=1024, bonsai_output_plot_stem='triggers' if make_plots else None, maskpath='/data/chimefrb/badchannel_mask_2018-11-02.dat', detrender_niter=2, clipper_niter=6, two_pass=False, rfi_level=2, aux_clip_first=False, aux_clip_last=False, aux_detrend_first=False, spline=True, bonsai_use_analytic_normalization=False, bonsai_hdf5_output_filename=None, bonsai_nt_per_hdf5_file=None, bonsai_fill_rfi_mask=True, var_est=False, mask_filler=False, mask_filler_w_cutoff=0.5, bonsai_plot_threshold1=7, bonsai_plot_threshold2=10, bonsai_dynamic_plotter=False, bonsai_plot_all_trees=make_plots, detrend_last=False, mask_counter=True)
import rf_pipelines s = ch_frb_rfi.acquisitions.incoherent_pathfinder( search_name='frb_incoherent_2d', sample_index=3) p = ch_frb_rfi.transform_parameters( plot_type='web_viewer', make_plots=True, bonsai_output_plot_stem='triggers', maskpath='/data/pathfinder/rfi_masks/rfi_20160705.dat', detrender_niter=2, clipper_niter=6, spline=True, bonsai_use_analytic_normalization=False, bonsai_hdf5_output_filename=None, bonsai_nt_per_hdf5_file=None, bonsai_fill_rfi_mask=True, var_est=False, mask_filler=False, mask_filler_w_cutoff=0.5, bonsai_plot_threshold1=7, bonsai_plot_threshold2=10, bonsai_dynamic_plotter=False, bonsai_plot_all_trees=True, L1Grouper_thr=10, bonsai_event_outfile='events_s6') t = ch_frb_rfi.transform_chain(p) t += [ch_frb_rfi.bonsai.nfreq1K_7tree(p, fpga_counts_per_sample=512, v=3)] ch_frb_rfi.run_for_web_viewer('s6', s, t)
# If 'clobber' is False, then when a json file is created with rf_pipelines.json_write(filename, j), # we throw an exception if 'filename' already exists, and its contents differ from 'j'. This is # to prevent git-managed json files from being modified accidentally. clobber = False for make_plots in [False, True]: params = ch_frb_rfi.transform_parameters( plot_type='web_viewer', make_plots=make_plots, bonsai_output_plot_stem='triggers' if make_plots else None, maskpath=None, two_pass=False, detrender_niter=2, clipper_niter=6, spline=True, bonsai_use_analytic_normalization=False, bonsai_hdf5_output_filename=None, bonsai_nt_per_hdf5_file=None, bonsai_fill_rfi_mask=True, var_est=False, mask_filler=False, mask_filler_w_cutoff=0.5, bonsai_plot_threshold1=7, bonsai_plot_threshold2=10, bonsai_dynamic_plotter=False, bonsai_plot_all_trees=make_plots) t1k = ch_frb_rfi.transform_chain(params) p1k = rf_pipelines.pipeline(t1k) params.detrend_last = False params.mask_counter = False
# If 'clobber' is False, then when a json file is created with rf_pipelines.json_write(filename, j), # we throw an exception if 'filename' already exists, and its contents differ from 'j'. This is # to prevent git-managed json files from being modified accidentally. clobber = False params = ch_frb_rfi.transform_parameters(plot_downsample_nt = 16, two_pass = False, plot_nxpix = 256, plot_nypix = 1024, plot_nzoom = 4, make_plots = True, bonsai_output_plot_stem = 'triggers', maskpath = '/data/pathfinder/rfi_masks/rfi_20160705.dat', detrender_niter = 2, clipper_niter = 6, spline = True, bonsai_use_analytic_normalization = False, bonsai_hdf5_output_filename = None, bonsai_nt_per_hdf5_file = None, bonsai_fill_rfi_mask = True, var_est = False, mask_filler = False, mask_filler_w_cutoff = 0.5, bonsai_plot_threshold1 = 7, bonsai_plot_threshold2 = 10, bonsai_dynamic_plotter = False, bonsai_plot_all_trees = True) t1k = ch_frb_rfi.transform_chain(params) p1k = rf_pipelines.pipeline(t1k) t16k = [ rf_pipelines.wi_sub_pipeline(p1k, nfreq_out=1024, nds_out=1) ]
# This script is intended to run on frb1.physics.mcgill.ca. import ch_frb_rfi # First, make the 'transform_parameters' object. # This is an aggregator for parameters which determine the transform chain. # All parameters have defaults which can be overridden as constructor arguments. # Here, we just override a few parameters which are related to plotting (by default, # no plots will be produced). # # See the ch_frb_rfi.transform_parameters docstring for more details, and a list # of all parameters available. p = ch_frb_rfi.transform_parameters( plot_type= 'web_viewer', # write plots with appropriate resolution for web viewer bonsai_output_plot_stem='triggers' ) # write bonsai plots to filenames beginning with 'triggers_...' # Second, make a stream (object of type rf_pipelines.wi_stream). # The submodule ch_frb_rfi.acquisitions defines some "standard" acquisitions on frb1. # (See 'dir(ch_frb_rfi.acquisitions) for a complete list'.) s = ch_frb_rfi.acquisitions.small( ) # A small example acq containing a few minutes of data # Third, make a transform chain (list of rf_pipelines.wi_transform objects) # There are lots of functions returning transform_chains, which aren't documented systematically # since our RFI removal code is still under development. # # The function ch_frb_io.transform_chain() returns "the" CHIME RFI-removing chain.
detrend_16k = True params = ch_frb_rfi.transform_parameters( plot_type='web_viewer', plot_nypix=1024, plot_nxpix=256, plot_downsample_nt=16, plot_nzoom=4, make_plots=False, bonsai_plot_nypix=1024, maskpath=None, detrender_niter=3, clipper_niter=5, spline=True, bonsai_use_analytic_normalization=False, bonsai_hdf5_output_filename=None, bonsai_nt_per_hdf5_file=None, bonsai_fill_rfi_mask=False, var_est=True, var_filename='./astro-events_var.h5', variance_estimator_v1_chunk=16, variance_estimator_v2_chunk=64, mask_filler=False, mask_filler_w_cutoff=0.5, bonsai_plot_threshold1=7, bonsai_plot_threshold2=10, bonsai_dynamic_plotter=False, bonsai_plot_all_trees=False, detrend_last=not detrend_16k) t1k = ch_frb_rfi.transform_chain(params)
# This fill-in helps the bonsai dedisperser compute running trigger variance estimates. # It's an open question whether we'll use it "in production" on the telescope, but our # working assumption is that we will do so, and will write a fast C++ implementation # at some point. p = ch_frb_rfi.transform_parameters(plot_type = 'web_viewer', make_plots = False, bonsai_output_plot_stem = 'triggers', maskpath = '/data/pathfinder/rfi_masks/rfi_20160705.dat', rfi_level = rfi_level, bonsai_use_analytic_normalization = False, bonsai_hdf5_output_filename = None, bonsai_nt_per_hdf5_file = None, var_est = True, mask_filler = False, var_filename = './var_example2.h5', variance_estimator_v1_chunk = v1_chunk, variance_estimator_v2_chunk = v2_chunk, mask_filler_w_cutoff = 0.5, bonsai_plot_threshold1 = 7, bonsai_plot_threshold2 = 10, bonsai_dynamic_plotter = False, bonsai_event_outfile = './events_example2.dat', L1Grouper_thr = 10, L1Grouper_beam = 0, L1Grouper_addr = None) # Using the specified parameters make a chain of transforms for estimating the variance. t = ch_frb_rfi.transform_chain(p) # Combine stream and transforms into a pipeline.
# to prevent git-managed json files from being modified accidentally. clobber = False for make_plots in [ True ]: params = ch_frb_rfi.transform_parameters(plot_type = 'web_viewer', plot_nypix = 1024, plot_nxpix = 256, plot_downsample_nt = 16, plot_nzoom = 4, make_plots = make_plots, bonsai_output_plot_stem = 'triggers' if make_plots else None, maskpath = None, rfi_level = 1, spline = True, bonsai_use_analytic_normalization = False, bonsai_hdf5_output_filename = None, bonsai_nt_per_hdf5_file = None, bonsai_fill_rfi_mask = True, var_est = False, mask_filler = False, mask_filler_w_cutoff = 0.5, bonsai_plot_threshold1 = 7, bonsai_plot_threshold2 = 10, bonsai_dynamic_plotter = False, bonsai_plot_all_trees = make_plots) t1k = ch_frb_rfi.transform_chain(params) p1k = rf_pipelines.pipeline(t1k) params.detrend_last = False
# This script is intended to run on frb1.physics.mcgill.ca. import numpy as np import ch_frb_rfi import rf_pipelines s = ch_frb_rfi.acquisitions.crab_16k(n=300) p = ch_frb_rfi.transform_parameters( plot_type='web_viewer', make_plots=False, bonsai_output_plot_stem='triggers', rfi_level=1, bonsai_use_analytic_normalization=False, var_est=True, var_filename='./var_example3.h5', variance_estimator_v1_chunk=64, variance_estimator_v2_chunk=100, mask_filler_w_cutoff=0.25, bonsai_plot_threshold1=7, bonsai_plot_threshold2=10, bonsai_dynamic_plotter=False, bonsai_event_outfile='./events_example3.dat') t = ch_frb_rfi.transform_chain(p) # Combine stream and transforms into a pipeline. pipeline = rf_pipelines.pipeline([s] + t) ch_frb_rfi.run_in_scratch_dir('example3', pipeline)