def test_passthrough(): """ Pass-through pipeline test m: .--------. | | +- b -. | | | | --+ +==+== | | '- c -' p: -- a - m = d -- """ b = _FBlock() c = _GBlock() m = pipeline.Passthrough((b, c)) a = _FBlock() d = _ThreeIn() p = pipeline.Pipeline([a, m, d]) result = p.process(data) ares = _f(data) assert result == _threein(ares, _f(ares), _g(ares))
def test_named_subpipeline(): # any block that wraps a sub-pipeline is accessible through # ``named_blocks``, but the sub-pipeline blocks are not a = _NamedBlock(name='sub_a') b = _NamedBlock(name='sub_b') c = _NamedBlock(name='c') passthrough = pipeline.Passthrough([a, b], name='passthrough') p = pipeline.Pipeline([passthrough, c]) names = list(p.named_blocks) assert 'passthrough' in names assert 'c' in names assert 'sub_a' not in names assert 'sub_b' in p.named_blocks['passthrough'].named_blocks
def test_passthrough_noexpand(): # test passthrough block without expanding output a = _FBlock() b = _GBlock() c = pipeline.Passthrough((a, b), expand_output=False) assert c.process(data) == (data, [_f(data), _g(data)])
config = exp.configure(numbands=int) # TODO: figure out how to do this recursively b, a = butter(1, .1, fs=2000, btype='lowpass') lowpassfilter = pipeline.Pipeline([pipeline.Filter(b, a=a, overlap=200)]) b, a = butter(4, (40, 60), fs=2000, btype='bandpass') lowfilter = pipeline.Pipeline([pipeline.Filter(b, a=a, overlap=200)]) b, a = butter(4, (80, 100), fs=2000, btype='bandpass') highfilter = pipeline.Pipeline([pipeline.Filter(b, a=a, overlap=200)]) b, a = butter(4, (120, 140), fs=2000, btype='bandpass') midfilter = pipeline.Pipeline([pipeline.Filter(b, a=a, overlap=200)]) main_pipeline = pipeline.Pipeline([ pipeline.Windower(1000), pipeline.Passthrough([(lowfilter, highfilter, midfilter), FFT(), pipeline.Callable(integrated_emg), exponentialsmoothing()]) ]) exp.screen.showFullScreen() while True: exp.run( # Oscilloscope(pipeline.Windower(2000)), # Exertion(main_pipeline) PartialPowers(main_pipeline)) break