def set_notch11_parameter(self, data, status):
        """根据tuning对话框返回值设置参数及UI界面"""
        self.notch11_status = status
        if status:
            self.amplitudeSlider_4.setEnabled(False)
            self.label_28.setEnabled(False)
            self.label_29.setEnabled(False)
            self.frequencySpin_4.setEnabled(False)
            self.btn_notch11_tuning.setDefault(True)  # 按键标记

            self.two_order_filter_data_11 = data
            if self.filter01_radioButton_notch_4.isChecked():
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(':/mic/icon/tuning.png'))
            elif self.filter01_radioButton_bypass_4.isChecked():
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(':/mic/icon/Bypass.png'))
            else:
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(":/mic/icon/HighPass.png"))

        else:
            r_notch = R_value2map_2(self.default_notch_r_value)
            r_notch_half = R_value2map_2(self.default_notch_r_value * 0.5)
            self.amplitudeSlider_4.setEnabled(True)
            self.label_28.setEnabled(True)
            self.label_29.setEnabled(True)
            self.frequencySpin_4.setEnabled(True)
            self.btn_notch11_tuning.setDefault(False)  # 取消按键标记

            self.two_order_filter_data_11 = dict(C1_value='22n',
                                                 C2_value='22n',
                                                 C_value_double='47n',
                                                 R1_value=r_notch,
                                                 R2_value=r_notch,
                                                 R_half_value=r_notch_half,
                                                 R_gain_value=0)
            self.setupC_value_11()  # 重新设置阻容参数
            self.setupR_value_11()
            if self.filter01_radioButton_notch_4.isChecked():
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(':/mic/icon/Filter.png'))
            elif self.filter01_radioButton_bypass_4.isChecked():
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(':/mic/icon/Bypass.png'))
            else:
                self.pixmapLabel_4.setPixmap(
                    QtGui.QPixmap(":/mic/icon/HighPass.png"))
Example #2
0
    def set_module_17_data(self):
        self.peak02_gain = self.peak_gain_spin_2.value()  # 记录peak01 gain
        self.OP_gain_spin_2.setValue(
            self.peak_gain_spin_2.value())  # 同步op gain & peak gain

        gain = self.peak_gain_spin_2.value()
        f = self.peak_frequency_spin_2.value()
        pos_r_high = self.peak_lowpass_slider_2.value()
        pos_r_gain = self.peak_attenuation_slider_2.value()
        if self.peak17_status is False:
            if gain == 0:
                self.module17 = None
            else:
                Rb = get_Rb_value(gain)[1]
                R1 = 10000 * Rb / (Rb - 20000)
                c_value = 1 / (1.414 * np.pi * R1 * f)  # 中心频率有1.414倍偏移
                R3 = 2 * R1
                r_high_cut = R3 / (R3**(pos_r_high / 61))

                self.op_peak_data_2['R1_value'] = R_value2map(R1)
                self.op_peak_data_2['R2_value'] = R_value2map(R1)
                self.op_peak_data_2['R_half_value'] = R_value2map(R1 / 2)
                self.op_peak_data_2['C1_value'] = c_value2map(c_value)
                self.op_peak_data_2['C2_value'] = c_value2map(c_value)
                self.op_peak_data_2['C_value_double'] = c_value2map_dubble(
                    c_value)
                self.op_peak_data_2['R_gain_value'] = get_R_value(pos_r_gain)
                self.op_peak_data_2['R_high_cut'] = R_value2map_2(r_high_cut)
                if self.OP_peak_filter_enable_2.isChecked():
                    self.module17 = 'peak_ams'

                # print(self.op_peak_data_2)
        else:
            if self.OP_peak_filter_enable_2.isChecked():
                self.module17 = 'peak_ams'
 def set_peak17_parameter(self, data, status):
     """根据tuning对话框返回值设置参数及UI界面"""
     self.peak17_status = status
     if status:
         self.btn_peak17_tuning.setDefault(True)  # 按键标记
         self.label_26.setPixmap(QtGui.QPixmap(':/mic/icon/tuning.png'))
         self.set_module_17()
         self.op_peak_data_2 = data
     else:
         r_peak = R_value2map_2(self.default_peak_r_value)
         r_peak_half = R_value2map_2(self.default_peak_r_value * 0.5)
         r_peak_double = R_value2map_2(self.default_peak_r_value * 2)
         self.btn_peak17_tuning.setDefault(False)  # 按键标记
         self.label_26.setPixmap(QtGui.QPixmap(':/mic/icon/peak.png'))
         self.op_peak_data_2 = dict(C1_value='8.2n',
                                    C2_value='8.2n',
                                    C_value_double='15n',
                                    R1_value=r_peak,
                                    R2_value=r_peak,
                                    R_half_value=r_peak_half,
                                    R_gain_value=0,
                                    R_high_cut=r_peak_double)
         self.set_module_17()
Example #4
0
    def set_module_18_data(self, module=None):

        gain = self.OP_gain_spin_2.value()
        f = self.frequencySpin_OP_lowpass_2.value()
        C1 = 4.7e-3
        k = 100 / (f * C1)
        R2 = 1.306e3
        R1 = R2 / (10**(gain / 20))
        R3 = R1 * R2 / (R1 + R2)
        num = [-764.6, 0, 1.111e5]  # 构造根据gain获得C2电容值传递函数
        den = [1, 0, 1528]
        Gd = control.tf(num, den)
        x = list(range(21))
        y = control.frd(Gd, x)
        C = float(y.eval(gain).real)

        if module == 'bessel':
            K = k * 1
            r1 = R1 * K
            r2 = R2 * K
            r3 = R3 * K
            C2 = C * 13 / 68 * 1e-9
            self.two_order_lowpass_data_2['R1_value'] = R_value2map_2(r1)
            self.two_order_lowpass_data_2['R2_value'] = R_value2map_2(r2)
            self.two_order_lowpass_data_2['R3_value'] = R_value2map_2(r3)
            self.two_order_lowpass_data_2['C2_value'] = c_value2map(C2)
        elif module == 'butterworth':
            K = k * 0.9
            r1 = R1 * K
            r2 = R2 * K
            r3 = R3 * K
            C2 = C * 18 / 68 * 1e-9
            self.two_order_lowpass_data_2['R1_value'] = R_value2map_2(r1)
            self.two_order_lowpass_data_2['R2_value'] = R_value2map_2(r2)
            self.two_order_lowpass_data_2['R3_value'] = R_value2map_2(r3)
            self.two_order_lowpass_data_2['C2_value'] = c_value2map(C2)
        elif module == 'chebyshev-1':
            K = k * 0.85
            r1 = R1 * K
            r2 = R2 * K
            r3 = R3 * K
            C2 = C * 24 / 68 * 1e-9
            self.two_order_lowpass_data_2['R1_value'] = R_value2map_2(r1)
            self.two_order_lowpass_data_2['R2_value'] = R_value2map_2(r2)
            self.two_order_lowpass_data_2['R3_value'] = R_value2map_2(r3)
            self.two_order_lowpass_data_2['C2_value'] = c_value2map(C2)
        elif module == 'chebyshev-2':
            K = k * 0.8
            r1 = R1 * K
            r2 = R2 * K
            r3 = R3 * K
            C2 = C * 50 / 68 * 1e-9
            self.two_order_lowpass_data_2['R1_value'] = R_value2map_2(r1)
            self.two_order_lowpass_data_2['R2_value'] = R_value2map_2(r2)
            self.two_order_lowpass_data_2['R3_value'] = R_value2map_2(r3)
            self.two_order_lowpass_data_2['C2_value'] = c_value2map(C2)
        elif module == 'chebyshev-3':
            K = k * 0.75
            r1 = R1 * K
            r2 = R2 * K
            r3 = R3 * K
            C2 = C * 1e-9
            self.two_order_lowpass_data_2['R1_value'] = R_value2map_2(r1)
            self.two_order_lowpass_data_2['R2_value'] = R_value2map_2(r2)
            self.two_order_lowpass_data_2['R3_value'] = R_value2map_2(r3)
            self.two_order_lowpass_data_2['C2_value'] = c_value2map(C2)
        else:
            pass
    def set_op2_default_data(self):
        r_notch = R_value2map_2(self.default_notch_r_value)
        r_notch_half = R_value2map_2(self.default_notch_r_value * 0.5)
        r_peak = R_value2map_2(self.default_peak_r_value)
        r_peak_half = R_value2map_2(self.default_peak_r_value * 0.5)
        r_peak_double = R_value2map_2(self.default_peak_r_value * 2)
        r_peak_shelf = R_value2map_2(self.default_peak_r_value * 11)
        r_op_gain = R_value2map_2(self.default_op_gain_r_value)

        self.two_order_filter_data_11 = dict(C1_value='22n',
                                             C2_value='22n',
                                             C_value_double='47n',
                                             R1_value=r_notch,
                                             R2_value=r_notch,
                                             R_half_value=r_notch_half,
                                             R_gain_value=0)
        self.two_order_filter_data_12 = dict(C1_value='22n',
                                             C2_value='22n',
                                             C_value_double='47n',
                                             R1_value=r_notch,
                                             R2_value=r_notch,
                                             R_half_value=r_notch_half,
                                             R_gain_value=0)
        self.one_order_highpass_data_2 = dict(C_value='22n', R_value=r_notch)
        self.one_order_lowpass_data_2 = dict(C_value='22n', R_value=r_notch)

        self.op_gain_data_2 = dict(Ra_value=r_op_gain, Rb_value=r_op_gain)
        self.op_lowpass_data_2 = dict(C_value='4.7n')

        self.high_shelf_data_2 = dict(C_value='470p', R_value=r_peak_shelf)
        self.low_shelf_data_2 = dict(C_value='470p', R_value=r_peak_shelf)
        self.op_peak_data_2 = dict(C1_value='8.2n',
                                   C2_value='8.2n',
                                   C_value_double='15n',
                                   R1_value=r_peak,
                                   R2_value=r_peak,
                                   R_half_value=r_peak_half,
                                   R_gain_value=0,
                                   R_high_cut=r_peak_double)
        self.two_order_lowpass_data_2 = dict(R1_value='27k',
                                             R2_value='27k',
                                             R3_value='13k',
                                             C1_value='4.7n',
                                             C2_value='12n')

        # 默认module11参数
        self.pixmapLabel_4.setPixmap(QtGui.QPixmap(':/mic/icon/Bypass.png'))
        self.amplitudeSlider_4.setHidden(True)
        self.frequencySpin_4.setHidden(True)
        self.frequencySpin_highpass_2.setHidden(True)
        self.label_Slider_value_14.setText('None')
        # 默认module12参数
        self.pixmapLabel_3.setPixmap(QtGui.QPixmap(':/mic/icon/Bypass.png'))
        self.amplitudeSlider_3.setHidden(True)
        self.frequencySpin_3.setHidden(True)
        self.frequencySpin_lowpass_2.setHidden(True)
        self.label_Slider_value_5.setText('None')
        # 默认module13参数
        self.label_24.setPixmap(QtGui.QPixmap(':/mic/icon/lowpass.png'))
        # module 08 peak filter参数
        self.label_26.setPixmap(QtGui.QPixmap(':/mic/icon/peak.png'))