Example #1
0
def filter_ts9(input):
    import numpy as np
    output = np.zeros(input.shape, dtype=np.float64)

    inputfilter = DoubleInPointerFilter(input, False)
    inputfilter.set_input_sampling_rate(sample_rate)
    infilter = DoubleChamberlinFilter()
    infilter.set_input_sampling_rate(sample_rate)
    infilter.set_input_port(0, inputfilter, 0)
    infilter.select(0)
    infilter.set_attenuation(1)
    infilter.set_cut_frequency(1000)
    overfilter = DoubleOversampling6points5order_4Filter()
    overfilter.set_input_sampling_rate(sample_rate)
    overfilter.set_output_sampling_rate(sample_rate * 4)
    overfilter.set_input_port(0, infilter, 0)
    overdrivefilter = DoubleTS9OverdriveFilter()
    overdrivefilter.set_input_sampling_rate(sample_rate * 4)
    overdrivefilter.set_input_port(0, overfilter, 0)
    overdrivefilter.set_drive(0.9)
    lowpassfilter = DoubleButterworthLowPassFilter()
    lowpassfilter.set_input_sampling_rate(sample_rate * 4)
    lowpassfilter.set_cut_frequency(sample_rate)
    lowpassfilter.set_order(5)
    lowpassfilter.set_input_port(0, overdrivefilter, 0)
    decimationfilter = DoubleDecimationFilter(1)
    decimationfilter.set_input_sampling_rate(sample_rate * 4)
    decimationfilter.set_output_sampling_rate(sample_rate)
    decimationfilter.set_input_port(0, lowpassfilter, 0)
    outfilter = DoubleOutPointerFilter(output, False)
    outfilter.set_input_sampling_rate(sample_rate)
    outfilter.set_input_port(0, decimationfilter, 0)
    outfilter.process(input.shape[1])
    return output
Example #2
0
def filter_16(input):
    import numpy as np
    output = np.zeros(input.shape, dtype=np.float64)

    inputfilter = DoubleInPointerFilter(input, False)
    inputfilter.set_input_sampling_rate(sample_rate)
    infilter = DoubleChamberlinFilter()
    infilter.set_input_sampling_rate(sample_rate)
    infilter.set_input_port(0, inputfilter, 0)
    infilter.select(0)
    infilter.set_attenuation(1)
    infilter.set_cut_frequency(1000)
    overfilter = DoubleOversampling6points5order_16Filter()
    overfilter.set_input_sampling_rate(sample_rate)
    overfilter.set_output_sampling_rate(sample_rate * 16)
    overfilter.set_input_port(0, infilter, 0)
    overdrivefilter = DoubleSD1OverdriveFilter()
    overdrivefilter.set_input_sampling_rate(sample_rate * 16)
    overdrivefilter.set_input_port(0, overfilter, 0)
    overdrivefilter.set_drive(0.9)
    lowpassfilter = DoubleButterworthLowPassFilter()
    lowpassfilter.set_input_sampling_rate(sample_rate * 16)
    lowpassfilter.set_cut_frequency(20000)
    lowpassfilter.set_order(5)
    lowpassfilter.set_input_port(0, overdrivefilter, 0)
    lowpassfilter2 = DoubleButterworthLowPassFilter()
    lowpassfilter2.set_input_sampling_rate(sample_rate * 16)
    lowpassfilter2.set_cut_frequency(20000)
    lowpassfilter2.set_order(5)
    lowpassfilter2.set_input_port(0, lowpassfilter, 0)
    decimationfilter = DoubleDecimationFilter(1)
    decimationfilter.set_input_sampling_rate(sample_rate * 16)
    decimationfilter.set_output_sampling_rate(sample_rate)
    decimationfilter.set_input_port(0, lowpassfilter2, 0)
    #tonefilter = DoubleSD1ToneFilter()
    #tonefilter.set_input_sampling_rate(sample_rate)
    #tonefilter.set_input_port(0, decimationfilter, 0)
    #tonefilter.set_tone(1)
    #highpassfilter = DoubleChamberlinFilter()
    #highpassfilter.set_input_sampling_rate(sample_rate)
    #highpassfilter.set_input_port(0, tonefilter, 0)
    #highpassfilter.select(2)
    #highpassfilter.set_attenuation(1)
    #highpassfilter.set_cut_frequency(20)
    outfilter = DoubleOutPointerFilter(output, False)
    outfilter.set_input_sampling_rate(sample_rate)
    #outfilter.set_input_port(0, highpassfilter, 0)
    outfilter.set_input_port(0, decimationfilter, 0)
    outfilter.process(input.shape[1])
    return output
Example #3
0
def filter_16(input):
  import numpy as np
  output = np.zeros(input.shape, dtype=np.float64)

  infilter = DoubleInPointerFilter(input, False)
  infilter.set_input_sampling_rate(sample_rate)
  overfilter = DoubleOversampling6points5order_16Filter()
  overfilter.set_input_sampling_rate(sample_rate)
  overfilter.set_output_sampling_rate(sample_rate * 16)
  overfilter.set_input_port(0, infilter, 0)
  overdrivefilter = DoubleSD1OverdriveFilter()
  overdrivefilter.set_input_sampling_rate(sample_rate * 16)
  overdrivefilter.set_input_port(0, overfilter, 0)
  overdrivefilter.set_drive(0.9)
  lowpassfilter = DoubleButterworthLowPassFilter()
  lowpassfilter.set_input_sampling_rate(sample_rate * 16)
  lowpassfilter.set_cut_frequency(20000)
  lowpassfilter.set_order(5)
  lowpassfilter.set_input_port(0, overdrivefilter, 0)
  lowpassfilter2 = DoubleButterworthLowPassFilter()
  lowpassfilter2.set_input_sampling_rate(sample_rate * 16)
  lowpassfilter2.set_cut_frequency(20000)
  lowpassfilter2.set_order(5)
  lowpassfilter2.set_input_port(0, lowpassfilter, 0)
  decimationfilter = DoubleDecimationFilter(1)
  decimationfilter.set_input_sampling_rate(sample_rate * 16)
  decimationfilter.set_output_sampling_rate(sample_rate)
  decimationfilter.set_input_port(0, lowpassfilter2, 0)
  tonefilter = DoubleSD1ToneFilter()
  tonefilter.set_input_sampling_rate(sample_rate)
  tonefilter.set_input_port(0, decimationfilter, 0)
  tonefilter.set_tone(1)
  highpassfilter = DoubleChamberlinFilter()
  highpassfilter.set_input_sampling_rate(sample_rate)
  highpassfilter.set_input_port(0, tonefilter, 0)
  highpassfilter.select(2)
  highpassfilter.set_attenuation(1)
  highpassfilter.set_cut_frequency(20)
  outfilter = DoubleOutPointerFilter(output, False)
  outfilter.set_input_sampling_rate(sample_rate)
  outfilter.set_input_port(0, highpassfilter, 0)
  outfilter.process(input.shape[1])
  return output