def filter_8(input): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.set_input_sampling_rate(48000) overfilter = DoubleOversampling6points5order_8Filter() overfilter.set_input_sampling_rate(48000) overfilter.set_output_sampling_rate(48000 * 8) overfilter.set_input_port(0, infilter, 0) overdrivefilter = DoubleSimpleOverdriveFilter() overdrivefilter.set_input_sampling_rate(48000 * 8) overdrivefilter.set_input_port(0, overfilter, 0) lowpassfilter = DoubleButterworthLowPassFilter() lowpassfilter.set_input_sampling_rate(48000 * 8) lowpassfilter.set_cut_frequency(48000) lowpassfilter.set_order(5) lowpassfilter.set_input_port(0, overdrivefilter, 0) decimationfilter = DoubleDecimationFilter(1) decimationfilter.set_input_sampling_rate(48000 * 8) decimationfilter.set_output_sampling_rate(48000) decimationfilter.set_input_port(0, lowpassfilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.set_input_sampling_rate(48000) outfilter.set_input_port(0, decimationfilter, 0) outfilter.process(input.shape[1]) return output
def Oversampling_8_test(): import numpy as np from ATK.Core import DoubleInPointerFilter, DoubleOutPointerFilter from ATK.Tools import DoubleOversampling6points5order_8Filter from numpy.testing import assert_almost_equal ref = np.sin(np.arange(8000, dtype=np.float64)[None,:] * 1000 * 2 * np.pi / 384000) input = np.ascontiguousarray(ref[:, ::8]) output = np.ascontiguousarray(np.zeros(8000, dtype=np.float64)[None,:]) inputfilter = DoubleInPointerFilter(input, False) oversamplingfilter = DoubleOversampling6points5order_8Filter() outputfilter = DoubleOutPointerFilter(output, False) inputfilter.set_output_sampling_rate(48000) oversamplingfilter.set_input_sampling_rate(48000) oversamplingfilter.set_output_sampling_rate(384000) outputfilter.set_input_sampling_rate(384000) oversamplingfilter.set_input_port(0, inputfilter, 0) outputfilter.set_input_port(0, oversamplingfilter, 0) outputfilter.process(8000) assert_almost_equal(ref[:,976:-24], output[:,1000:], decimal=1)
def filter_8(input): import numpy as np output = np.zeros(input.shape, dtype=np.float64) infilter = DoubleInPointerFilter(input, False) infilter.input_sampling_rate = 48000 overfilter = DoubleOversampling6points5order_8Filter() overfilter.input_sampling_rate = 48000 overfilter.output_sampling_rate = 48000 * 8 overfilter.set_input_port(0, infilter, 0) overdrivefilter = DoubleLeachTriodeFilter.build_standard_filter() overdrivefilter.input_sampling_rate = 48000 * 8 overdrivefilter.set_input_port(0, overfilter, 0) lowpassfilter = DoubleButterworthLowPassFilter() lowpassfilter.input_sampling_rate = 48000 * 8 lowpassfilter.cut_frequency = 48000 lowpassfilter.order = 5 lowpassfilter.set_input_port(0, overdrivefilter, 0) decimationfilter = DoubleDecimationFilter(1) decimationfilter.input_sampling_rate = 48000 * 8 decimationfilter.output_sampling_rate = 48000 decimationfilter.set_input_port(0, lowpassfilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.input_sampling_rate = 48000 outfilter.set_input_port(0, decimationfilter, 0) outfilter.process(input.shape[1]) return output
def filter_8(input): import numpy as np output = np.zeros(input.shape, dtype=np.float64) inputfilter = DoubleInPointerFilter(input, False) inputfilter.input_sampling_rate = sample_rate overfilter = DoubleOversampling6points5order_8Filter() overfilter.input_sampling_rate = sample_rate overfilter.output_sampling_rate = sample_rate * 8 overfilter.set_input_port(0, inputfilter, 0) overdrivefilter = DoubleTS9OverdriveFilter() overdrivefilter.input_sampling_rate = sample_rate * 8 overdrivefilter.set_input_port(0, overfilter, 0) overdrivefilter.drive = 0.9 lowpassfilter = DoubleButterworthLowPassFilter() lowpassfilter.input_sampling_rate = sample_rate * 8 lowpassfilter.cut_frequency = sample_rate lowpassfilter.order = 5 lowpassfilter.set_input_port(0, overdrivefilter, 0) decimationfilter = DoubleDecimationFilter(1) decimationfilter.input_sampling_rate = sample_rate * 8 decimationfilter.output_sampling_rate = sample_rate decimationfilter.set_input_port(0, lowpassfilter, 0) outfilter = DoubleOutPointerFilter(output, False) outfilter.input_sampling_rate = sample_rate outfilter.set_input_port(0, decimationfilter, 0) outfilter.process(input.shape[1]) return output
def filter_8(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_8Filter() overfilter.set_input_sampling_rate(sample_rate) overfilter.set_output_sampling_rate(sample_rate * 8) overfilter.set_input_port(0, infilter, 0) overdrivefilter = DoubleSD1OverdriveFilter() overdrivefilter.set_input_sampling_rate(sample_rate * 8) overdrivefilter.set_input_port(0, overfilter, 0) overdrivefilter.set_drive(0.9) lowpassfilter = DoubleButterworthLowPassFilter() lowpassfilter.set_input_sampling_rate(sample_rate * 8) lowpassfilter.set_cut_frequency(20000) lowpassfilter.set_order(10) lowpassfilter.set_input_port(0, overdrivefilter, 0) decimationfilter = DoubleDecimationFilter(1) decimationfilter.set_input_sampling_rate(sample_rate * 8) decimationfilter.set_output_sampling_rate(sample_rate) decimationfilter.set_input_port(0, lowpassfilter, 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