def create_15km_scheme(): """ Frankenstein script by Devin Huyghebaert for 15 km range gates with a special ICEBEAR collab mode Built off of the default scheme used for 45 km with minor changes. :return DecimationScheme: a decimation scheme for use in experiment. """ rates = [5.0e6, 500.0e3, 100.0e3, 50.0e3] # last stage 50.0e3/3->50.0e3 dm_rates = [10, 5, 2, 5] # third stage 6->2 transition_widths = [150.0e3, 40.0e3, 15.0e3, 1.0e3] # did not change # bandwidth is double cutoffs. Did not change cutoffs = [20.0e3, 10.0e3, 10.0e3, 5.0e3] ripple_dbs = [150.0, 80.0, 35.0, 8.0] # changed last stage 9->8 scaling_factors = [10.0, 100.0, 100.0, 100.0] # did not change all_stages = [] for stage in range(0, len(rates)): filter_taps = list( scaling_factors[stage] * create_firwin_filter_by_attenuation( rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append( DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) # changed from 10e3/3->10e3 return (DecimationScheme(rates[0], rates[-1] / dm_rates[-1], stages=all_stages))
def __init__(self): cpid = 1 # Number of decimation stages is greater than options.max_number_of_filtering_stages rates = [5.0e6, 1.0e6, 500.0e3, 250.0e3, 125.0e3, 62.5e3, 31.25e3] # 7 stages, greater than max of 6 dm_rates = [5, 2, 2, 2, 2, 2, 2] transition_widths = [ 150.0e3, 80.0e3, 40.0e3, 20.0e3, 10.0e3, 5.0e3, 1.0e3 ] cutoffs = [20.0e3, 20.0e3, 10.0e3, 10.0e3, 5.0e3, 5.0e3, 5.0e3] ripple_dbs = [150.0, 80.0, 70.0, 35.0, 20.0, 15.0, 10.0] scaling_factors = [10.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0] all_stages = [] for stage in range(0, len(rates)): filter_taps = list( scaling_factors[stage] * create_firwin_filter_by_attenuation( rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append( DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) # changed from 10e3/3->10e3 decimation_scheme = (DecimationScheme(rates[0], rates[-1] / dm_rates[-1], stages=all_stages)) super(TestExperiment, self).__init__( cpid, output_rx_rate=decimation_scheme.output_sample_rate, decimation_scheme=decimation_scheme) if scf.IS_FORWARD_RADAR: beams_to_use = scf.STD_16_FORWARD_BEAM_ORDER else: beams_to_use = scf.STD_16_REVERSE_BEAM_ORDER if scf.opts.site_id in ["cly", "rkn", "inv"]: num_ranges = scf.POLARDARN_NUM_RANGES if scf.opts.site_id in ["sas", "pgr"]: num_ranges = scf.STD_NUM_RANGES slice_1 = { # slice_id = 0, there is only one slice. "pulse_sequence": scf.SEQUENCE_7P, "tau_spacing": scf.TAU_SPACING_7P, "pulse_len": scf.PULSE_LEN_45KM, "num_ranges": num_ranges, "first_range": scf.STD_FIRST_RANGE, "intt": 3500, # duration of an integration, in ms "beam_angle": scf.STD_16_BEAM_ANGLE, "beam_order": beams_to_use, "scanbound": [i * 3.5 for i in range(len(beams_to_use))], #1 min scan "txfreq": scf.COMMON_MODE_FREQ_1, #kHz "acf": True, "xcf": True, # cross-correlation processing "acfint": True, # interferometer acfs } self.add_slice(slice_1)
def create_test_scheme_8(): """ Create four stages of FIR filters and a decimation scheme. Returns a decimation scheme of type DecimationScheme. :return DecimationScheme: a decimation scheme for use in experiment. """ rates = [5.0e6, 500.0e3, 100.0e3, 50.0e3/3] dm_rates = [10, 5, 6, 5] transition_widths = [200.0e3, 49.0e3, 15.0e3, 1.0e3] cutoffs = [2.0e3, 1.0e3, 1.0e3, 1.0e3] # bandwidth is double this ripple_dbs = [150.0, 80.0, 35.0, 9.0] all_stages = [] for stage in range(0,4): filter_taps = list(create_firwin_filter_by_attenuation(rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append(DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) return (DecimationScheme(5.0e6, 10.0e3/3, stages=all_stages))
def create_test_scheme_6(): # tested Feb 12 1800 - looks ~ 10 dB SNR? """ Create four stages of FIR filters and a decimation scheme. Returns a decimation scheme of type DecimationScheme. :return DecimationScheme: a decimation scheme for use in experiment. """ rates = [5.0e6, 500.0e3/3, 50.0e3/3, 10.0e3/3] dm_rates = [30, 10, 5, 1] transition_widths = [130.0e3, 13.0e3, 2.0e3] cutoffs = [20.0e3, 2.0e3, 0.5e3] # bandwidth is double this ripple_dbs = [100.0, 30.0, 10.0] all_stages = [] for stage in range(0,3): filter_taps = list(create_firwin_filter_by_attenuation(rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append(DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) all_stages.append(DecimationStage(3, rates[3], dm_rates[3], [1.0])) return (DecimationScheme(5.0e6, 10.0e3/3, stages=all_stages))
def create_test_scheme_9(): """ Create four stages of FIR filters and a decimation scheme. Returns a decimation scheme of type DecimationScheme. This filter will have a wider receive bandwidth than the previous. Pasha recommends a 10kHz bandwidth for the final stage. I believe there will be aliasing caused by this but perhaps the concern is not critical because of the small bandwidth overlapping. I will test this anyways. :return DecimationScheme: a decimation scheme for use in experiment. """ rates = [5.0e6, 500.0e3, 100.0e3, 50.0e3/3] dm_rates = [10, 5, 6, 5] transition_widths = [150.0e3, 40.0e3, 15.0e3, 1.0e3] cutoffs = [20.0e3, 10.0e3, 10.0e3, 5.0e3] # bandwidth is double this ripple_dbs = [150.0, 80.0, 35.0, 9.0] scaling_factors = [10.0, 100.0, 100.0, 100.0] all_stages = [] for stage in range(0,4): filter_taps = list(scaling_factors[stage] * create_firwin_filter_by_attenuation(rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append(DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) return (DecimationScheme(5.0e6, 10.0e3/3, stages=all_stages))
def __init__(self): cpid = 1 rates = [5.0e6, 500.0e3, 100.0e3, 50.0e3 / 3] dm_rates = [10, 5, 6, 5] transition_widths = [150.0e3, 40.0e3, 15.0e3, 1.0e3] cutoffs = [20.0e3, 10.0e3, 10.0e3, 5.0e3] ripple_dbs = [150.0, 80.0, 35.0, 9.0] scaling_factors = [10.0, 100.0, 100.0, 100.0] all_stages = [] longest_filter_num_taps = 0 for stage in range(0, len(rates)): filter_taps = list( scaling_factors[stage] * create_firwin_filter_by_attenuation( rates[stage], transition_widths[stage], cutoffs[stage], ripple_dbs[stage])) all_stages.append( DecimationStage(stage, rates[stage], dm_rates[stage], filter_taps)) if len(filter_taps) > longest_filter_num_taps: longest_filter_num_taps = len(filter_taps) # changed from 10e3/3->10e3 decimation_scheme = (DecimationScheme(rates[0], rates[-1] / dm_rates[-1], stages=all_stages)) super(TestExperiment, self).__init__( cpid, output_rx_rate=decimation_scheme.output_sample_rate, decimation_scheme=decimation_scheme) if scf.IS_FORWARD_RADAR: beams_to_use = scf.STD_16_FORWARD_BEAM_ORDER else: beams_to_use = scf.STD_16_REVERSE_BEAM_ORDER if scf.opts.site_id in ["cly", "rkn", "inv"]: num_ranges = scf.POLARDARN_NUM_RANGES if scf.opts.site_id in ["sas", "pgr"]: num_ranges = scf.STD_NUM_RANGES slice_1 = { # slice_id = 0, there is only one slice. "pulse_sequence": scf.SEQUENCE_7P, "tau_spacing": scf.TAU_SPACING_7P, "pulse_len": scf.PULSE_LEN_45KM, "num_ranges": num_ranges, "first_range": scf.STD_FIRST_RANGE, "intt": 3500, # duration of an integration, in ms "beam_angle": scf.STD_16_BEAM_ANGLE, "beam_order": beams_to_use, "scanbound": [i * 3.5 for i in range(len(beams_to_use))], #1 min scan "txfreq": scf.COMMON_MODE_FREQ_1, #kHz "acf": True, "xcf": True, # cross-correlation processing "acfint": True, # interferometer acfs } # The check for too many slices is like so: # effective_length = 2^x => the next power of two for how many taps there are in a stage # if effective_length * num_slices > max_number_of_filter_taps_per_stage: # error self.add_slice(slice_1) self.add_slice(copy.deepcopy(slice_1)) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={1: 'INTTIME'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={1: 'INTTIME'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) slices = [] max_num_slices = int(eo().max_number_of_filter_taps_per_stage / longest_filter_num_taps) #print("Longest filter: {} taps. Max concurrent slices: {}".format(longest_filter_num_taps, # max_num_slices)) for i in range(max_num_slices): slices.append(copy.deepcopy(slice_1)) self.add_slice(slices[i], interfacing_dict={0: 'PULSE'}) # Just for fun, add a few INTTIME as well self.add_slice(copy.deepcopy(slice_1), interfacing_dict={1: 'INTTIME'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'INTTIME'}) # Add a bunch of slices that are scan interfaced, shouldn't have an effect self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'}) self.add_slice(copy.deepcopy(slice_1), interfacing_dict={0: 'SCAN'})