# Path: pymoku/instruments.py

# 
# Path: pymoku/_iirfilterbox.py
# REG_ENABLE = 96
# REG_MONSELECT = 111
# REG_INPUTOFFSET_CH0 = 112
# REG_INPUTOFFSET_CH1 = 113
# REG_OUTPUTOFFSET_CH0 = 114
# REG_OUTPUTOFFSET_CH1 = 115
# REG_CH0_CH0GAIN = 116
# REG_CH0_CH1GAIN = 117
# REG_CH1_CH0GAIN = 118
# REG_CH1_CH1GAIN = 119
# REG_INPUTSCALE_CH0 = 120
# REG_INPUTSCALE_CH1 = 121
# REG_OUTPUTSCALE_CH0 = 122
# REG_OUTPUTSCALE_CH1 = 123
# REG_SAMPLINGFREQ = 124
# REG_FILT_RESET = 62
# _IIR_MON_NONE = 0
# _IIR_MON_ADC1 = 1
# _IIR_MON_IN1 = 2
# _IIR_MON_OUT1 = 3
# _IIR_MON_ADC2 = 4
# _IIR_MON_IN2 = 5
# _IIR_MON_OUT2 = 6
# _IIR_MON_NONE = 0
# _IIR_MON_ADC1 = 1
# _IIR_MON_IN1 = 2
# _IIR_MON_OUT1 = 3
# _IIR_MON_ADC2 = 4
# _IIR_MON_IN2 = 5
# _IIR_MON_OUT2 = 6
# _IIR_SOURCE_A = 0
# _IIR_SOURCE_B = 1
# _IIR_SOURCE_IN1 = 2
# _IIR_SOURCE_IN2 = 3
# _IIR_SOURCE_EXT = 4
# _IIR_OSC_SOURCES = {
#     'a': _IIR_SOURCE_A,
#     'b': _IIR_SOURCE_B,
#     'in1': _IIR_SOURCE_IN1,
#     'in2': _IIR_SOURCE_IN2,
#     'ext': _IIR_SOURCE_EXT
# }
# _IIR_COEFFWIDTH = 48
# _IIR_INPUT_SMPS = ADC_SMP_RATE / 4
# _IIR_CHN_BUFLEN = 2**13
# _ADC_DEFAULT_CALIBRATION = 3750.0  # Bits/V (No attenuation)
# class IIRFilterBox(_CoreOscilloscope):
#     def __init__(self):
#     def set_defaults(self):
#     def set_control_matrix(self, ch, scale_in1, scale_in2):
#     def _update_control_matrix_regs(self):
#     def _sync_control_matrix_regs(self):
#     def set_filter(self, ch, sample_rate, filter_coefficients):
#     def disable_output(self, ch):
#     def set_gains_offsets(self, ch, input_gain=1.0, output_gain=1.0,
#                           input_offset=0, output_offset=0):
#     def _update_gains_offsets_regs(self):
#     def _sync_gains_offsets_regs(self):
#     def set_monitor(self, monitor_ch, source):
#     def set_trigger(self, source, edge, level, minwidth=None, maxwidth=None,
#                     hysteresis=10e-3, hf_reject=False, mode='auto'):
#     def _signal_source_volts_per_bit(self, source, scales, trigger=False):
#     def _monitor_source_volts_per_bit(self, source, scales):
#     def _update_dependent_regs(self, scales):
#     def _on_reg_sync(self):


import pytest
from pymoku.instruments import IIRFilterBox
from pymoku import _iirfilterbox
    from unittest.mock import patch, ANY
    from mock import patch, ANY


try:
except ImportError:

filt_coeff = [[1.0],
              [1.0, 0.64, -1.02, 0.646, -1.637, 0.898],
              [1.0, 0.51, -0.75, 0.518, -1.403, 0.679],
              [1.0, 0.31, -0.31, 0.314, -1.082, 0.410],
              [1.0, 0.13, 0.122, 0.130, -0.795, 0.178]]


@pytest.fixture
def dut(moku):
    with patch(
            'pymoku._frame_instrument.'
            'FrameBasedInstrument._set_running'):
        i = IIRFilterBox()

# Path: pymoku/instruments.py

# 
# Path: pymoku/_iirfilterbox.py
# REG_ENABLE = 96
# REG_MONSELECT = 111
# REG_INPUTOFFSET_CH0 = 112
# REG_INPUTOFFSET_CH1 = 113
# REG_OUTPUTOFFSET_CH0 = 114
# REG_OUTPUTOFFSET_CH1 = 115
# REG_CH0_CH0GAIN = 116
# REG_CH0_CH1GAIN = 117
# REG_CH1_CH0GAIN = 118
# REG_CH1_CH1GAIN = 119
# REG_INPUTSCALE_CH0 = 120
# REG_INPUTSCALE_CH1 = 121
# REG_OUTPUTSCALE_CH0 = 122
# REG_OUTPUTSCALE_CH1 = 123
# REG_SAMPLINGFREQ = 124
# REG_FILT_RESET = 62
# _IIR_MON_NONE = 0
# _IIR_MON_ADC1 = 1
# _IIR_MON_IN1 = 2
# _IIR_MON_OUT1 = 3
# _IIR_MON_ADC2 = 4
# _IIR_MON_IN2 = 5
# _IIR_MON_OUT2 = 6
# _IIR_MON_NONE = 0
# _IIR_MON_ADC1 = 1
# _IIR_MON_IN1 = 2
# _IIR_MON_OUT1 = 3
# _IIR_MON_ADC2 = 4
# _IIR_MON_IN2 = 5
# _IIR_MON_OUT2 = 6
# _IIR_SOURCE_A = 0
# _IIR_SOURCE_B = 1
# _IIR_SOURCE_IN1 = 2
# _IIR_SOURCE_IN2 = 3
# _IIR_SOURCE_EXT = 4
# _IIR_OSC_SOURCES = {
#     'a': _IIR_SOURCE_A,
#     'b': _IIR_SOURCE_B,
#     'in1': _IIR_SOURCE_IN1,
#     'in2': _IIR_SOURCE_IN2,
#     'ext': _IIR_SOURCE_EXT
# }
# _IIR_COEFFWIDTH = 48
# _IIR_INPUT_SMPS = ADC_SMP_RATE / 4
# _IIR_CHN_BUFLEN = 2**13
# _ADC_DEFAULT_CALIBRATION = 3750.0  # Bits/V (No attenuation)
# class IIRFilterBox(_CoreOscilloscope):
#     def __init__(self):
#     def set_defaults(self):
#     def set_control_matrix(self, ch, scale_in1, scale_in2):
#     def _update_control_matrix_regs(self):
#     def _sync_control_matrix_regs(self):
#     def set_filter(self, ch, sample_rate, filter_coefficients):
#     def disable_output(self, ch):
#     def set_gains_offsets(self, ch, input_gain=1.0, output_gain=1.0,
#                           input_offset=0, output_offset=0):
#     def _update_gains_offsets_regs(self):
#     def _sync_gains_offsets_regs(self):
#     def set_monitor(self, monitor_ch, source):
#     def set_trigger(self, source, edge, level, minwidth=None, maxwidth=None,
#                     hysteresis=10e-3, hf_reject=False, mode='auto'):
#     def _signal_source_volts_per_bit(self, source, scales, trigger=False):
#     def _monitor_source_volts_per_bit(self, source, scales):
#     def _update_dependent_regs(self, scales):
#     def _on_reg_sync(self):


# Path: tests/test_iirfilterbox.py
import pytest
from pymoku.instruments import IIRFilterBox
from pymoku import _iirfilterbox
    from unittest.mock import patch, ANY
    from mock import patch, ANY



try:
except ImportError:

filt_coeff = [[1.0],
              [1.0, 0.64, -1.02, 0.646, -1.637, 0.898],
              [1.0, 0.51, -0.75, 0.518, -1.403, 0.679],
              [1.0, 0.31, -0.31, 0.314, -1.082, 0.410],
              [1.0, 0.13, 0.122, 0.130, -0.795, 0.178]]


@pytest.fixture
def dut(moku):
    with patch(
            'pymoku._frame_instrument.'
            'FrameBasedInstrument._set_running'):
        i = IIRFilterBox()

        moku.deploy_instrument(i)