Example #1
0
 def __init__(self, image_path):
     """Constructor"""
     TaskFrame.__init__(self, NotebookDemo,
                        "Plots",
                        size=(800, 680),
                        start_button=False
                        )
Example #2
0
class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.init_apps()
        self.init_ui()

    def init_apps(self):
        self.task_frame = TaskFrame()
        self.project_frame = ProjectFrame()

    def init_ui(self):
        self.resize(1000, 500)
        with open("./QTDark.stylesheet") as f:
            self.setStyleSheet(f.read())
        self.layout = QtGui.QVBoxLayout()

        self.main_frame = QtGui.QTabWidget()
        self.main_frame.addTab(self.task_frame, "Tasks")
        self.main_frame.addTab(self.project_frame, "Projects")
        self.layout.addWidget(self.main_frame)

        cwidget = QtGui.QWidget()
        cwidget.setLayout(self.layout)
        self.setCentralWidget(cwidget)

    def clean_up(self):
        self.task_frame.save_tasks()
Example #3
0
    def savesettings(self, filename):

        params = [
            "tabRF.instrument_enable_status", "tabRF.instrument_txt_IP",
            "tabRF.instrument_txt_Port", "tabRF.instrument_txt_Timeout",
            "tabRF.combobox_instrtype", "tabRF.synthetizer_frequency_min",
            "tabRF.synthetizer_frequency_max",
            "tabRF.synthetizer_frequency_step",
            "tabRF.synthetizer_frequency_unit",
            "tabRF.synthetizer_level_fixed",
            "tabPowerMeter.instrument_enable_status",
            "tabPowerMeter.instrument_txt_IP",
            "tabPowerMeter.instrument_txt_Port",
            "tabPowerMeter.instrument_txt_Timeout",
            "tabPowerMeter.combobox_instrtype",
            "tabPowerMeter.power_meter_make_zero",
            "tabPowerMeter.power_meter_misure_number",
            "tabPowerMeter.power_meter_misure_delay",
            "tabSAB.instrument_enable_status", "tabSAB.instrument_txt_IP",
            "tabSAB.instrument_txt_Port", "tabSAB.instrument_txt_Timeout",
            "tabSAB.combobox_instrtype", "tabSAB.SAB_switch01_delay",
            "tabSAB.SAB_switch02_delay", "tabSAB.SAB_switch03_delay",
            "tabCalCableSetting.result_file_name",
            "tabCalCableSetting.output_level",
            "tabCalCableSetting.create_dummycable_cb"
        ]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #4
0
    def savesettings(self, filename):
        params = [
            "tabSourceMeter.instrument_txt_IP",
            "tabSourceMeter.instrument_txt_Port",
            "tabSourceMeter.instrument_txt_Timeout",
            "tabSourceMeter.combobox_instrtype",
            "tabCountinousVoltageSetup.result_file_name"
        ]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #5
0
    def savesettings(self, filename):

        params = [
            "tabTSC.instrument_enable_status", "tabTSC.instrument_txt_IP",
            "tabTSC.instrument_txt_Port", "tabTSC.instrument_txt_Timeout",
            "tabTSC.combobox_instrtype", "tabTSC.TSC_collecting_delay",
            "tabTSC.TSC_plot_adev", "tabTSC.result_file_name"
        ]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #6
0
    def OnStart(self, event):
        TaskFrame.OnStart(self, event)

        result_file_name = self.notebook.tabCountinousVoltageSetup.result_file_name.GetValue(
        )

        # Insert function

        self.savesettings(result_file_name)
Example #7
0
    def savesettings(self, filename):
        params = [
            "tabRF.instrument_enable_status", "tabRF.instrument_txt_IP",
            "tabRF.instrument_txt_Port", "tabRF.instrument_txt_Timeout",
            "tabRF.combobox_instrtype", "tabRF.synthetizer_frequency_min",
            "tabRF.synthetizer_frequency_max",
            "tabRF.synthetizer_frequency_step",
            "tabRF.synthetizer_frequency_unit", "tabRF.synthetizer_level_min",
            "tabRF.synthetizer_level_max", "tabRF.synthetizer_level_step",
            "tabPM5.instrument_combobox_com_port",
            "tabPM5.instrument_txt_timeout", "tabPM5.instrument_combobox_baud",
            "tabPM5.pm5_misure_number", "tabPM5.pm5_misure_delay",
            "tabPM5.instrument_enable_status",
            "tabPM5Setting.calibration_file_LO",
            "tabPM5Setting.calibration_file_LO_enable",
            "tabPM5Setting.result_file_name"
        ]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #8
0
    def savesettings(self, filename):
        params = [
            "tabIP1PlotGraph.graph_title", "tabIP1PlotGraph.graph_x_label",
            "tabIP1PlotGraph.graph_x_min", "tabIP1PlotGraph.graph_x_max",
            "tabIP1PlotGraph.graph_x_step", "tabIP1PlotGraph.graph_x_unit",
            "tabIP1PlotGraph.graph_y_label", "tabIP1PlotGraph.graph_y_min",
            "tabIP1PlotGraph.graph_y_max", "tabIP1PlotGraph.graph_y_step",
            "tabIP1PlotGraph.graph_y_unit", "tabIP1PlotGraph.graph_animated",
            "tabIP1PlotGraph.data_file_name",
            "tabGenericPlotGraph.graph_x_label",
            "tabGenericPlotGraph.graph_x_min",
            "tabGenericPlotGraph.graph_x_max",
            "tabGenericPlotGraph.graph_x_step",
            "tabGenericPlotGraph.graph_x_unit",
            "tabGenericPlotGraph.graph_y_label",
            "tabGenericPlotGraph.graph_y_min",
            "tabGenericPlotGraph.graph_y_max",
            "tabGenericPlotGraph.graph_y_step",
            "tabGenericPlotGraph.graph_y_unit",
            "tabGenericPlotGraph.data_file_name",
            "tabGenericPlotGraph.graph_title",
            "tabGenericPlotGraph.graph_type",
            "tabSpuriusPlotGraph.graph_x_label",
            "tabSpuriusPlotGraph.graph_x_min",
            "tabSpuriusPlotGraph.graph_x_max",
            "tabSpuriusPlotGraph.graph_x_step",
            "tabSpuriusPlotGraph.graph_x_unit",
            "tabSpuriusPlotGraph.graph_y_label",
            "tabSpuriusPlotGraph.graph_y_min",
            "tabSpuriusPlotGraph.graph_y_max",
            "tabSpuriusPlotGraph.graph_y_step",
            "tabSpuriusPlotGraph.graph_y_unit",
            "tabSpuriusPlotGraph.graph_z_label",
            "tabSpuriusPlotGraph.graph_z_min",
            "tabSpuriusPlotGraph.graph_z_max",
            "tabSpuriusPlotGraph.graph_z_step",
            "tabSpuriusPlotGraph.graph_z_unit",
            "tabSpuriusPlotGraph.data_file_name",
            "tabSpuriusPlotGraph.graph_title", "tabSpuriusPlotGraph.graph_type"
        ]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #9
0
    def savesettings(self, filename):

        params = ["tabRF.instrument_enable_status",
                  "tabRF.instrument_txt_IP",
                  "tabRF.instrument_txt_Port",
                  "tabRF.instrument_txt_Timeout",
                  "tabRF.combobox_instrtype",
                  "tabRF.synthetizer_frequency_min",
                  "tabRF.synthetizer_frequency_max",
                  "tabRF.synthetizer_frequency_step",
                  "tabRF.synthetizer_frequency_unit",
                  "tabRF.synthetizer_level_fixed",
                  "tabFSV.instrument_txt_IP",
                  "tabFSV.instrument_txt_Port",
                  "tabFSV.instrument_txt_Timeout",
                  "tabFSV.combobox_instrtype",
                  "tabFSV.instrument_enable_status",
                  "tabFSV.spectrum_analyzer_sweep_points",
                  "tabFSV.spectrum_analyzer_resolution_bandwidth",
                  "tabFSV.spectrum_analyzer_resolution_bandwidth_unit",
                  "tabFSV.spectrum_analyzer_video_bandwidth",
                  "tabFSV.spectrum_analyzer_video_bandwidth_unit",
                  "tabFSV.spectrum_analyzer_frequency_span",
                  "tabFSV.spectrum_analyzer_frequency_span_unit",
                  "tabFSV.gainAmplifier",
                  "tabFSV.spectrum_analyzer_IF_atten_enable",
                  "tabFSV.spectrum_analyzer_IF_atten",
                  "tabFSV.spectrum_analyzer_IF_relative_level_enable",
                  "tabFSV.spectrum_analyzer_IF_relative_level",
                  "tabFSV.threshold_power",
                  "tabFSV.spectrum_analyzer_frequency_marker_unit",
                  "tabFSV.FSV_delay",
                  "tabFSV.spectrum_analyzer_central_frequency",
                  "tabFSV.spectrum_analyzer_central_frequency_unit",
                  "tabCalCableSetting.result_file_name",
                  "tabCalCableSetting.output_level",
                  "tabCalCableSetting.create_dummycable_cb"]

        TaskFrame.framesavesettings(self, filename, params=params)
Example #10
0
    def OnStart(self, event):

        TaskFrame.OnStart(self, event)

        create_dummy_cable = self.notebook.tabCalCableSetting.create_dummycable_cb.GetValue(
        )

        if create_dummy_cable:
            info_message("Dummy cable creation mode. \n No instrument used.",
                         "Dummy Cable Mode")

        synthetizer_IP = self.notebook.tabRF.instrument_txt_IP.GetValue()
        if check_value_is_IP(synthetizer_IP, "Synthetizer IP") == 0:
            return None

        synthetizer_Port = self.notebook.tabRF.instrument_txt_Port.GetValue()
        if check_value_min_max(synthetizer_Port, "Synthetizer Port",
                               minimum=0) == 0:
            return None

        synthetizer_Timeout = self.notebook.tabRF.instrument_txt_Timeout.GetValue(
        )
        if check_value_min_max(synthetizer_Timeout,
                               "Synthetizer Timeout",
                               minimum=0) == 0:
            return None

        syntetizer_instrType = self.notebook.tabRF.combobox_instrtype.GetValue(
        )

        syntetizer_enable_state = self.notebook.tabRF.instrument_enable_status.GetValue(
        )

        # synthetizer_frequency_min_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_min_unit, "Minimum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_min = self.notebook.tabRF.synthetizer_frequency_min.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_min,
                               "Minimum Frequency",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_min = eval(
                self.notebook.tabRF.synthetizer_frequency_min.GetValue())
        # synthetizer_frequency_max_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_max_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_max_unit, "Maximum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_max = self.notebook.tabRF.synthetizer_frequency_max.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_max,
                               "Maximum Frequency",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_max = eval(
                self.notebook.tabRF.synthetizer_frequency_max.GetValue())
        # synthetizer_frequency_step_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_step_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_step_unit, "Frequency Step Unit") == 0:
        #    return None
        synthetizer_frequency_step = self.notebook.tabRF.synthetizer_frequency_step.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_step,
                               "Frequency Step",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_step = eval(
                self.notebook.tabRF.synthetizer_frequency_step.GetValue())
        synthetizer_frequency_unit = unit.return_unit(
            self.notebook.tabRF.synthetizer_frequency_unit.GetValue())
        if check_value_not_none(synthetizer_frequency_unit,
                                "Frequency Unit") == 0:
            return None

        try:
            synthetizer_level_fixed = eval(
                self.notebook.tabRF.synthetizer_level_fixed.GetValue())
        except:
            synthetizer_level_fixed = 0

        power_meter_IP = self.notebook.tabPowerMeter.instrument_txt_IP.GetValue(
        )
        if check_value_is_IP(power_meter_IP, "Power meter IP") == 0:
            return None

        power_meter_Port = self.notebook.tabPowerMeter.instrument_txt_Port.GetValue(
        )
        if check_value_min_max(power_meter_Port, "Power meter Port",
                               minimum=0) == 0:
            return None

        power_meter_Timeout = self.notebook.tabPowerMeter.instrument_txt_Timeout.GetValue(
        )
        if check_value_min_max(power_meter_Timeout,
                               "Power meter Timeout",
                               minimum=0) == 0:
            return None

        power_meter_instrType = self.notebook.tabPowerMeter.combobox_instrtype.GetValue(
        )

        power_meter_enable_state = self.notebook.tabPowerMeter.instrument_enable_status.GetValue(
        )

        power_meter_make_zero = self.notebook.tabPowerMeter.power_meter_make_zero.GetValue(
        )
        power_meter_make_zero_delay = self.notebook.tabPowerMeter.power_meter_misure_delay.GetValue(
        )
        if check_value_min_max(power_meter_make_zero_delay,
                               "Make Zero Delay",
                               minimum=0) == 0:
            return None
        else:
            power_meter_make_zero_delay = eval(
                self.notebook.tabPowerMeter.power_meter_misure_delay.GetValue(
                ))

        power_meter_misure_number = self.notebook.tabPowerMeter.power_meter_misure_number.GetValue(
        )

        power_meter_misure_delay = self.notebook.tabPowerMeter.power_meter_misure_delay.GetValue(
        )  # seconds
        if check_value_min_max(power_meter_misure_delay,
                               "Measure Delay",
                               minimum=0) == 0:
            return None
        else:
            power_meter_misure_delay = eval(
                self.notebook.tabPowerMeter.power_meter_misure_delay.GetValue(
                ))

        SAB_IP = self.notebook.tabSAB.instrument_txt_IP.GetValue()
        if check_value_is_IP(SAB_IP, "SwitchAttBox IP") == 0:
            return None

        SAB_Port = self.notebook.tabSAB.instrument_txt_Port.GetValue()
        if check_value_min_max(SAB_Port, "SwitchAttBox Port", minimum=0) == 0:
            return None

        SAB_Timeout = self.notebook.tabSAB.instrument_txt_Timeout.GetValue()
        if check_value_min_max(SAB_Timeout, "SwitchAttBox Timeout",
                               minimum=0) == 0:
            return None

        SAB_enable_state = self.notebook.tabSAB.instrument_enable_status.GetValue(
        )

        SAB_instrType = self.notebook.tabSAB.combobox_instrtype.GetValue()

        SAB_switch01_delay = self.notebook.tabSAB.SAB_switch01_delay.GetValue()
        if check_value_min_max(SAB_switch01_delay, "Switch 1 Delay",
                               minimum=0) == 0:
            return None
        else:
            SAB_switch01_delay = eval(
                self.notebook.tabSAB.SAB_switch01_delay.GetValue())

        SAB_switch02_delay = self.notebook.tabSAB.SAB_switch02_delay.GetValue()
        if check_value_min_max(SAB_switch02_delay, "Switch 2 Delay",
                               minimum=0) == 0:
            return None
        else:
            SAB_switch02_delay = eval(
                self.notebook.tabSAB.SAB_switch02_delay.GetValue())
        result_file_name = self.notebook.tabCalCableSetting.result_file_name.GetValue(
        )
        dummy_cable_power_level = self.notebook.tabCalCableSetting.output_level.GetValue(
        )

        if create_dummy_cable:
            if check_value_not_none(dummy_cable_power_level,
                                    "Power Level (Dummy Cable)") == 0:
                return None

        try:
            SMB_RF = create_instrument(synthetizer_IP,
                                       synthetizer_Port,
                                       eval(synthetizer_Timeout),
                                       syntetizer_instrType,
                                       TEST_MODE=self.runmodeitem.IsChecked(),
                                       enable_state=syntetizer_enable_state
                                       and not create_dummy_cable)
        except:
            dlg = wx.MessageDialog(None, "Synthetizer comunication error",
                                   'Error Synthetizer', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            NRP2 = create_instrument(power_meter_IP,
                                     power_meter_Port,
                                     eval(power_meter_Timeout),
                                     power_meter_instrType,
                                     TEST_MODE=self.runmodeitem.IsChecked(),
                                     instrument_class="NRP2",
                                     enable_state=power_meter_enable_state
                                     and not create_dummy_cable)
        except:
            dlg = wx.MessageDialog(None, "Power meter comunication error",
                                   'Error Power meter', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            SAB = create_instrument(SAB_IP,
                                    SAB_Port,
                                    eval(SAB_Timeout),
                                    SAB_instrType,
                                    TEST_MODE=self.runmodeitem.IsChecked(),
                                    instrument_class="SAB",
                                    enable_state=SAB_enable_state
                                    and not create_dummy_cable)
        except:
            dlg = wx.MessageDialog(None, "SwitchAttBox comunication error",
                                   'Error SwitchAttBox', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        self.savesettings(result_file_name)

        dialog = wx.ProgressDialog("Progress",
                                   "Time remaining",
                                   maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME
                                   | wx.PD_REMAINING_TIME)

        synthetizer_frequency = Frequency_Range(synthetizer_frequency_min,
                                                synthetizer_frequency_max,
                                                synthetizer_frequency_step,
                                                synthetizer_frequency_unit)
        synthetizer_frequency.to_base()

        calibration_file_result = measure_calibration_cable(
            SMB_RF,
            NRP2,
            SAB,
            synthetizer_frequency,
            synthetizer_level_fixed,
            power_meter_make_zero,
            power_meter_make_zero_delay,
            power_meter_misure_number,
            power_meter_misure_delay,
            SAB_switch01_delay,
            SAB_switch02_delay,
            result_file_name,
            dummy_cable_power_level,
            create_dummy_cable,
            createprogressdialog=dialog)

        dialog.Destroy()

        try:
            webbrowser.open(os.path.dirname(calibration_file_result))
        except:
            pass
Example #11
0
    def savesettings(self, filepointer):
        params = ["tabLO.instrument_enable_status",
                  "tabLO.instrument_txt_IP",
                  "tabLO.instrument_txt_Port",
                  "tabLO.instrument_txt_Timeout",
                  "tabLO.combobox_instrtype",
                  "tabLO.synthetizer_frequency_min",
                  "tabLO.synthetizer_frequency_max",
                  "tabLO.synthetizer_frequency_step",
                  "tabLO.synthetizer_frequency_unit",
                  "tabLO.synthetizer_level_min",
                  "tabLO.synthetizer_level_max",
                  "tabLO.synthetizer_level_step",
                  "tabRF.instrument_enable_status",
                  "tabRF.instrument_txt_IP",
                  "tabRF.instrument_txt_Port",
                  "tabRF.instrument_txt_Timeout",
                  "tabRF.combobox_instrtype",
                  "tabRF.synthetizer_frequency_min",
                  "tabRF.synthetizer_frequency_max",
                  "tabRF.synthetizer_frequency_step",
                  "tabRF.synthetizer_frequency_unit",
                  "tabRF.synthetizer_level_min",
                  "tabRF.synthetizer_level_max",
                  "tabRF.synthetizer_level_step",
                  "tabFSV.instrument_txt_IP",
                  "tabFSV.instrument_txt_Port",
                  "tabFSV.instrument_txt_Timeout",
                  "tabFSV.combobox_instrtype",
                  "tabFSV.instrument_enable_status",
                  "tabFSV.spectrum_analyzer_sweep_points",
                  "tabFSV.spectrum_analyzer_resolution_bandwidth",
                  "tabFSV.spectrum_analyzer_resolution_bandwidth_unit",
                  "tabFSV.spectrum_analyzer_video_bandwidth",
                  "tabFSV.spectrum_analyzer_video_bandwidth_unit",
                  "tabFSV.spectrum_analyzer_frequency_span",
                  "tabFSV.spectrum_analyzer_frequency_span_unit",
                  "tabFSV.gainAmplifier",
                  "tabFSV.spectrum_analyzer_IF_atten_enable",
                  "tabFSV.spectrum_analyzer_IF_atten",
                  "tabFSV.spectrum_analyzer_IF_relative_level_enable",
                  "tabFSV.spectrum_analyzer_IF_relative_level",
                  "tabFSV.threshold_power",
                  "tabFSV.spectrum_analyzer_frequency_marker_unit",
                  "tabFSV.FSV_delay",
                  "tabFSV.spectrum_analyzer_central_frequency",
                  "tabFSV.spectrum_analyzer_central_frequency_unit",
                  "tabVSCD.instrument_enable_status",
                  "tabVSCD.instrument_txt_IP",
                  "tabVSCD.instrument_txt_Port",
                  "tabVSCD.instrument_txt_Timeout",
                  "tabVSCD.combobox_instrtype",
                  "tabVSCD.vscd_frequency_min",
                  "tabVSCD.vscd_frequency_max",
                  "tabVSCD.vscd_frequency_step",
                  "tabVSCD.vscd_frequency_unit",
                  "tabVSCD.vscd_level_min",
                  "tabVSCD.vscd_level_max",
                  "tabVSCD.vscd_level_step",
                  "tabSpuriusSetting.m_min_RF",
                  "tabSpuriusSetting.m_max_RF",
                  "tabSpuriusSetting.m_step_RF",
                  "tabSpuriusSetting.n_min_LO",
                  "tabSpuriusSetting.n_max_LO",
                  "tabSpuriusSetting.n_step_LO",
                  "tabSpuriusSetting.IF_low",
                  "tabSpuriusSetting.IF_low_unit",
                  "tabSpuriusSetting.IF_high",
                  "tabSpuriusSetting.IF_high_unit",
                  "tabSpuriusSetting.spurius_IF_unit",
                  "tabSpuriusSetting.calibration_file_LO",
                  "tabSpuriusSetting.calibration_file_LO_enable",
                  "tabSpuriusSetting.calibration_file_RF",
                  "tabSpuriusSetting.calibration_file_RF_enable",
                  "tabSpuriusSetting.calibration_file_IF",
                  "tabSpuriusSetting.calibration_file_IF_enable",
                  "tabSpuriusSetting.result_file_name"]

        TaskFrame.framesavesettings(self, filepointer, params=params)
Example #12
0
 def __init__(self):
     """Constructor"""
     TaskFrame.__init__(self, NotebookDemo,
                        "Spurius Calculation",
                        size=(800, 800)
                        )
Example #13
0
    def OnStart(self, event):

        TaskFrame.OnStart(self, event)
        # load values

        synthetizer_LO_IP = self.notebook.tabLO.instrument_txt_IP.GetValue()
        if check_value_is_IP(synthetizer_LO_IP, "LO Synthetizer IP") == 0:
            return None

        synthetizer_LO_Port = self.notebook.tabLO.instrument_txt_Port.GetValue()
        if check_value_min_max(synthetizer_LO_Port, "LO Synthetizer Port", minimum=0) == 0:
            return None

        synthetizer_LO_Timeout = self.notebook.tabLO.instrument_txt_Timeout.GetValue()
        if check_value_min_max(synthetizer_LO_Timeout, "LO Synthetizer Timeout", minimum=0) == 0:
            return None

        synthetizer_LO_instrType = self.notebook.tabLO.combobox_instrtype.GetValue()

        synthetizer_LO_state = self.notebook.tabLO.instrument_enable_status.GetValue()

        # synthetizer_LO_frequency_min_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_LO_frequency_min_unit, "Minimum LO Frequency Unit") == 0:
        #    return None

        if synthetizer_LO_state:

            synthetizer_LO_frequency_min = self.notebook.tabLO.synthetizer_frequency_min.GetValue()
            if check_value_min_max(synthetizer_LO_frequency_min, "Minimum LO Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_LO_frequency_min = eval(self.notebook.tabLO.synthetizer_frequency_min.GetValue())

            # synthetizer_LO_frequency_max_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_max_unit.GetValue())
            # if check_value_not_none(synthetizer_LO_frequency_max_unit, "Maximum LO Frequency Unit") == 0:
            #    return None

            synthetizer_LO_frequency_max = self.notebook.tabLO.synthetizer_frequency_max.GetValue()
            if check_value_min_max(synthetizer_LO_frequency_max, "Maximum LO Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_LO_frequency_max = eval(self.notebook.tabLO.synthetizer_frequency_max.GetValue())

            # synthetizer_LO_frequency_step_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_step_unit.GetValue())
            # if check_value_not_none(synthetizer_LO_frequency_step_unit, "LO Step Frequency Unit") == 0:
            #    return None

            synthetizer_LO_frequency_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_unit.GetValue())
            if check_value_not_none(synthetizer_LO_frequency_unit, "LO Frequency Unit") == 0:
                return None

            synthetizer_LO_frequency_step = self.notebook.tabLO.synthetizer_frequency_step.GetValue()
            if check_value_min_max(synthetizer_LO_frequency_step, "LO Step Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_LO_frequency_step = eval(self.notebook.tabLO.synthetizer_frequency_step.GetValue())

            try:
                synthetizer_LO_level_min = eval(self.notebook.tabLO.synthetizer_level_min.GetValue())
            except:
                synthetizer_LO_level_min = 0

            try:
                synthetizer_LO_level_max = eval(self.notebook.tabLO.synthetizer_level_max.GetValue())
            except:
                synthetizer_LO_level_max = 0

            synthetizer_LO_level_step = self.notebook.tabLO.synthetizer_level_step.GetValue()
            if check_value_min_max(synthetizer_LO_level_step, "LO Level Step", minimum=0) == 0:
                return None
            else:
                synthetizer_LO_level_step = eval(self.notebook.tabLO.synthetizer_level_step.GetValue())

            synthetizer_LO_frequency = Frequency_Range(synthetizer_LO_frequency_min, synthetizer_LO_frequency_max,
                                                       synthetizer_LO_frequency_step, synthetizer_LO_frequency_unit)
            synthetizer_LO_frequency.to_base()
            synthetizer_LO_level = Generic_Range(synthetizer_LO_level_min, synthetizer_LO_level_max,
                                                 synthetizer_LO_level_step)
        else:
            synthetizer_LO_frequency = Frequency_Range(0, 0, 1, unit.Hz)
            synthetizer_LO_frequency.to_base()
            synthetizer_LO_level = Generic_Range(0, 0, 1)

        synthetizer_RF_IP = self.notebook.tabRF.instrument_txt_IP.GetValue()
        if check_value_is_IP(synthetizer_RF_IP, "RF Synthetizer IP") == 0:
            return None

        synthetizer_RF_Port = self.notebook.tabRF.instrument_txt_Port.GetValue()
        if check_value_min_max(synthetizer_RF_Port, "RF Synthetizer Port", minimum=0) == 0:
            return None

        synthetizer_RF_Timeout = self.notebook.tabRF.instrument_txt_Timeout.GetValue()
        if check_value_min_max(synthetizer_RF_Timeout, "RF Synthetizer Timeout", minimum=0) == 0:
            return None

        synthetizer_RF_instrType = self.notebook.tabRF.combobox_instrtype.GetValue()

        synthetizer_RF_state = self.notebook.tabRF.instrument_enable_status.GetValue()
        # synthetizer_RF_frequency_min_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_RF_frequency_min_unit, "Minimum RF Frequency Unit") == 0:
        #    return None
        if synthetizer_RF_state:
            synthetizer_RF_frequency_min = self.notebook.tabRF.synthetizer_frequency_min.GetValue()
            if check_value_min_max(synthetizer_RF_frequency_min, "Minimum RF Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_RF_frequency_min = eval(self.notebook.tabRF.synthetizer_frequency_min.GetValue())

            # synthetizer_RF_frequency_max_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_max_unit.GetValue())
            # if check_value_not_none(synthetizer_RF_frequency_max_unit, "Maximum RF Frequency Unit") == 0:
            #    return None

            synthetizer_RF_frequency_max = self.notebook.tabRF.synthetizer_frequency_max.GetValue()
            if check_value_min_max(synthetizer_RF_frequency_max, "Maximum RF Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_RF_frequency_max = eval(self.notebook.tabRF.synthetizer_frequency_max.GetValue())

            # synthetizer_RF_frequency_step_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_step_unit.GetValue())
            # if check_value_not_none(synthetizer_RF_frequency_step_unit, "RF Step Frequency Unit") == 0:
            #    return None

            synthetizer_RF_frequency_step = self.notebook.tabRF.synthetizer_frequency_step.GetValue()
            if check_value_min_max(synthetizer_RF_frequency_step, "RF Step Frequency", minimum=0) == 0:
                return None
            else:
                synthetizer_RF_frequency_step = eval(self.notebook.tabRF.synthetizer_frequency_step.GetValue())

            synthetizer_RF_frequency_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_unit.GetValue())
            if check_value_not_none(synthetizer_RF_frequency_unit, "RF Frequency Unit") == 0:
                return None

            try:
                synthetizer_RF_level_min = eval(self.notebook.tabRF.synthetizer_level_min.GetValue())
            except:
                synthetizer_RF_level_min = 0

            try:
                synthetizer_RF_level_max = eval(self.notebook.tabRF.synthetizer_level_max.GetValue())
            except:
                synthetizer_RF_level_max = 0

            synthetizer_RF_level_step = self.notebook.tabRF.synthetizer_level_step.GetValue()
            if check_value_min_max(synthetizer_RF_level_step, "RF Level Step", minimum=0) == 0:
                return None
            else:
                synthetizer_RF_level_step = eval(self.notebook.tabRF.synthetizer_level_step.GetValue())

            synthetizer_RF_frequency = Frequency_Range(synthetizer_RF_frequency_min, synthetizer_RF_frequency_max,
                                                       synthetizer_RF_frequency_step, synthetizer_RF_frequency_unit)
            synthetizer_RF_frequency.to_base()
            synthetizer_RF_level = Generic_Range(synthetizer_RF_level_min, synthetizer_RF_level_max,
                                                 synthetizer_RF_level_step)
        else:
            synthetizer_RF_frequency = Frequency_Range(0, 0, 1, unit.Hz)
            synthetizer_RF_frequency.to_base()
            synthetizer_RF_level = Generic_Range(0, 0, 1)

        vscd_IP = self.notebook.tabVSCD.instrument_txt_IP.GetValue()
        if check_value_is_IP(vscd_IP, "VSCD IP") == 0:
            return None

        vscd_Port = self.notebook.tabVSCD.instrument_txt_Port.GetValue()
        if check_value_min_max(vscd_Port, "VSCD Port", minimum=0) == 0:
            return None

        vscd_Timeout = self.notebook.tabVSCD.instrument_txt_Timeout.GetValue()
        if check_value_min_max(vscd_Timeout, "VSCD Timeout", minimum=0) == 0:
            return None

        vscd_instrType = self.notebook.tabVSCD.combobox_instrtype.GetValue()

        vscd_state = self.notebook.tabVSCD.instrument_enable_status.GetValue()

        # synthetizer_LO_frequency_min_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_LO_frequency_min_unit, "Minimum LO Frequency Unit") == 0:
        #    return None

        if vscd_state:

            vscd_frequency_min = self.notebook.tabVSCD.vscd_frequency_min.GetValue()
            if check_value_min_max(vscd_frequency_min, "VSCD Frequency", minimum=0) == 0:
                return None
            else:
                vscd_frequency_min = eval(self.notebook.tabVSCD.vscd_frequency_min.GetValue())

            # synthetizer_LO_frequency_max_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_max_unit.GetValue())
            # if check_value_not_none(synthetizer_LO_frequency_max_unit, "Maximum LO Frequency Unit") == 0:
            #    return None

            vscd_frequency_max = self.notebook.tabVSCD.vscd_frequency_max.GetValue()
            if check_value_min_max(vscd_frequency_max, "VSCD Frequency", minimum=0) == 0:
                return None
            else:
                vscd_frequency_max = eval(self.notebook.tabVSCD.vscd_frequency_max.GetValue())

            # synthetizer_LO_frequency_step_unit = unit.return_unit(self.notebook.tabLO.synthetizer_frequency_step_unit.GetValue())
            # if check_value_not_none(synthetizer_LO_frequency_step_unit, "LO Step Frequency Unit") == 0:
            #    return None

            vscd_frequency_unit = unit.return_unit(self.notebook.tabVSCD.vscd_frequency_unit.GetValue())
            if check_value_not_none(vscd_frequency_unit, "VSCD Frequency Unit") == 0:
                return None

            vscd_frequency_step = self.notebook.tabVSCD.vscd_frequency_step.GetValue()
            if check_value_min_max(vscd_frequency_step, "VSCD Step Frequency", minimum=0) == 0:
                return None
            else:
                vscd_frequency_step = eval(self.notebook.tabVSCD.vscd_frequency_step.GetValue())

            try:
                vscd_level_min = eval(self.notebook.tabVSCD.vscd_level_min.GetValue())
            except:
                vscd_level_min = 0

            try:
                vscd_level_max = eval(self.notebook.tabVSCD.vscd_level_max.GetValue())
            except:
                vscd_level_max = 0

            vscd_level_step = self.notebook.tabVSCD.vscd_level_step.GetValue()
            if check_value_min_max(vscd_level_step, "VSCD Level Step", minimum=0) == 0:
                return None
            else:
                vscd_level_step = eval(self.notebook.tabVSCD.vscd_level_step.GetValue())

            vscd_frequency = Frequency_Range(vscd_frequency_min, vscd_frequency_max,
                                                       vscd_frequency_step, vscd_frequency_unit)
            vscd_frequency.to_base()
            vscd_level = Generic_Range(vscd_level_min, vscd_level_max,
                                                 vscd_level_step)
        else:
            vscd_frequency = Frequency_Range(0, 0, 1, unit.Hz)
            vscd_frequency.to_base()
            vscd_level = Generic_Range(0, 0, 1)


        spectrum_analyzer_IP = self.notebook.tabFSV.instrument_txt_IP.GetValue()
        if check_value_is_IP(spectrum_analyzer_IP, "LO Synthetizer IP") == 0:
            return None

        spectrum_analyzer_Port = self.notebook.tabFSV.instrument_txt_Port.GetValue()
        if check_value_min_max(spectrum_analyzer_Port, "LO Synthetizer Port", minimum=0) == 0:
            return None

        spectrum_analyzer_Timeout = self.notebook.tabFSV.instrument_txt_Timeout.GetValue()
        if check_value_min_max(spectrum_analyzer_Timeout, "LO Synthetizer Timeout", minimum=0) == 0:
            return None

        spectrum_analyzer_instrType = self.notebook.tabFSV.combobox_instrtype.GetValue()

        spectrum_analyzer_state = self.notebook.tabFSV.instrument_enable_status.GetValue()

        if spectrum_analyzer_state:
            spectrum_analyzer_sweep_points = self.notebook.tabFSV.spectrum_analyzer_sweep_points.GetValue()
            if check_value_min_max(spectrum_analyzer_sweep_points, "Sweep points", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_sweep_points = eval(self.notebook.tabFSV.spectrum_analyzer_sweep_points.GetValue())

            spectrum_analyzer_resolution_bandwidth = self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth.GetValue()
            if check_value_min_max(spectrum_analyzer_resolution_bandwidth, "Resolution Bandwidth", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_resolution_bandwidth = eval(
                    self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth.GetValue())

            spectrum_analyzer_resolution_bandwidth_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_resolution_bandwidth_unit, "Resolution Bandwidth Unit") == 0:
                return None

            spectrum_analyzer_video_bandwidth = self.notebook.tabFSV.spectrum_analyzer_video_bandwidth.GetValue()
            if check_value_min_max(spectrum_analyzer_video_bandwidth, "Video Bandwidth", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_video_bandwidth = eval(
                    self.notebook.tabFSV.spectrum_analyzer_video_bandwidth.GetValue())

            spectrum_analyzer_video_bandwidth_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_video_bandwidth_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_video_bandwidth_unit, "Video Bandwidth Unit") == 0:
                return None

            spectrum_analyzer_frequency_span = self.notebook.tabFSV.spectrum_analyzer_frequency_span.GetValue()
            if check_value_min_max(spectrum_analyzer_frequency_span, "Frequency Span", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_frequency_span = eval(
                    self.notebook.tabFSV.spectrum_analyzer_frequency_span.GetValue())

            spectrum_analyzer_frequency_span_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_frequency_span_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_frequency_span_unit, "Frequency Span Unit") == 0:
                return None

            ##spectrum_analyzer_harmonic_number = spectrum_analyzer_harmonic_number
            # spectrum_analyzer_attenuation = self.notebook.tabFSV.spectrum_analyzer_attenuation.GetValue()
            # if check_value_not_none(spectrum_analyzer_attenuation, "Attenuation") == 0:
            #    return None

            gainAmplifier = self.notebook.tabFSV.gainAmplifier.GetValue()  # dB
            if check_value_not_none(gainAmplifier, "Gain Amplifier") == 0:
                return None

            spectrum_analyzer_IF_atten_enable = self.notebook.tabFSV.spectrum_analyzer_IF_atten_enable.GetValue()
            spectrum_analyzer_IF_atten = self.notebook.tabFSV.spectrum_analyzer_IF_atten.GetValue()
            if check_value_not_none(spectrum_analyzer_IF_atten, "Attenuation") == 0:
                return None

            spectrum_analyzer_IF_relative_level = self.notebook.tabFSV.spectrum_analyzer_IF_relative_level.GetValue()
            if check_value_not_none(spectrum_analyzer_IF_relative_level, "Relative Power Level") == 0:
                return None

            spectrum_analyzer_IF_relative_level_enable = self.notebook.tabFSV.spectrum_analyzer_IF_relative_level_enable.GetValue()

            threshold_power = self.notebook.tabFSV.threshold_power.GetValue()  # dB
            if check_value_not_none(threshold_power, "Threshold Power Level") == 0:
                return None
            else:
                threshold_power = eval(self.notebook.tabFSV.threshold_power.GetValue())

            spectrum_analyzer_frequency_marker_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_frequency_marker_unit.GetValue())
            # to check
            if check_value_not_none(spectrum_analyzer_frequency_marker_unit, "Marker Frequency Unit") == 0:
                return None

            FSV_delay = self.notebook.tabFSV.FSV_delay.GetValue()
            if check_value_min_max(FSV_delay, "FSV measure delay", minimum=0) == 0:
                return None
            else:
                FSV_delay = eval(self.notebook.tabFSV.FSV_delay.GetValue())

        m_min_RF = self.notebook.tabSpuriusSetting.m_min_RF.GetValue()
        m_max_RF = self.notebook.tabSpuriusSetting.m_max_RF.GetValue()
        m_step_RF = self.notebook.tabSpuriusSetting.m_step_RF.GetValue()
        n_min_LO = self.notebook.tabSpuriusSetting.n_min_LO.GetValue()
        n_max_LO = self.notebook.tabSpuriusSetting.n_max_LO.GetValue()
        n_step_LO = self.notebook.tabSpuriusSetting.n_step_LO.GetValue()

        IF_low = self.notebook.tabSpuriusSetting.IF_low.GetValue()
        if check_value_min_max(IF_low, "Low Frequency", minimum=0) == 0:
            return None
        else:
            IF_low = eval(self.notebook.tabSpuriusSetting.IF_low.GetValue())

        IF_low_unit = unit.return_unit(self.notebook.tabSpuriusSetting.IF_low_unit.GetValue())
        if check_value_not_none(IF_low_unit, "Low Frequency Unit") == 0:
            return None

        IF_high = self.notebook.tabSpuriusSetting.IF_high.GetValue()
        if check_value_min_max(IF_high, "High Frequency", minimum=0) == 0:
            return None
        else:
            IF_high = eval(self.notebook.tabSpuriusSetting.IF_high.GetValue())

        IF_high_unit = unit.return_unit(self.notebook.tabSpuriusSetting.IF_high_unit.GetValue())
        if check_value_not_none(IF_high_unit, "High Frequency Unit") == 0:
            return None

        spurius_IF_unit = unit.return_unit(self.notebook.tabSpuriusSetting.spurius_IF_unit.GetValue())
        if check_value_not_none(spurius_IF_unit, "Spurius IF Unit") == 0:
            return None

        calibration_file_LO = self.notebook.tabSpuriusSetting.calibration_file_LO.GetValue()
        calibration_file_LO_enable = self.notebook.tabSpuriusSetting.calibration_file_LO_enable.GetValue()
        if calibration_file_LO_enable:
            if check_value_is_valid_file(calibration_file_LO, "LO Calibration file") == 0:
                return None

        calibration_file_RF = self.notebook.tabSpuriusSetting.calibration_file_RF.GetValue()
        calibration_file_RF_enable = self.notebook.tabSpuriusSetting.calibration_file_RF_enable.GetValue()
        if calibration_file_RF_enable:
            if check_value_is_valid_file(calibration_file_RF, "RF Calibration file") == 0:
                return None

        calibration_file_IF = self.notebook.tabSpuriusSetting.calibration_file_IF.GetValue()
        calibration_file_IF_enable = self.notebook.tabSpuriusSetting.calibration_file_IF_enable.GetValue()
        if calibration_file_IF_enable:
            if check_value_is_valid_file(calibration_file_IF, "IF Calibration file") == 0:
                return None

        result_file_name = self.notebook.tabSpuriusSetting.result_file_name.GetValue()

        try:
            SMB_LO = create_instrument(synthetizer_LO_IP, synthetizer_LO_Port, eval(synthetizer_LO_Timeout),
                                       synthetizer_LO_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                       enable_state=synthetizer_LO_state)
        except:
            dlg = wx.MessageDialog(None, "LO synthetizer comunication error", 'Error LO synthetizer',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            SMB_RF = create_instrument(synthetizer_RF_IP, synthetizer_RF_Port, eval(synthetizer_RF_Timeout),
                                       synthetizer_RF_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                       enable_state=synthetizer_RF_state)
        except:
            dlg = wx.MessageDialog(None, "RF synthetizer comunication error", 'Error RF synthetizer',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            VSCD = create_instrument(vscd_IP, vscd_Port, eval(vscd_Timeout),
                                       vscd_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                       enable_state=vscd_state)
        except:
            dlg = wx.MessageDialog(None, "Downconverter comunication error", 'Error Downconverter',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            FSV = create_instrument(spectrum_analyzer_IP, spectrum_analyzer_Port, eval(spectrum_analyzer_Timeout),
                                    spectrum_analyzer_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                    instrument_class="FSV", enable_state=spectrum_analyzer_state)
        except:
            dlg = wx.MessageDialog(None, "Spectrum analiser comunication error", 'Error Spectrum analiser',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        if synthetizer_LO_state:
            n_LO = Generic_Range(n_min_LO, n_max_LO, n_step_LO)
        else:
            n_LO = Generic_Range(0, 0, 1)
        if synthetizer_RF_state:
            m_RF = Generic_Range(m_min_RF, m_max_RF, m_step_RF)
        else:
            m_RF = Generic_Range(0, 0, 1)

        dialog = wx.ProgressDialog("Progress", "Time remaining", maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME)

        self.savesettings(result_file_name)

        spurius_filename = measure_LNA_spurius(
            SMB_LO=SMB_LO,
            SMB_RF=SMB_RF,
            FSV=FSV,
            VSCD=VSCD,
            synthetizer_LO_state=synthetizer_LO_state,
            synthetizer_LO_frequency=synthetizer_LO_frequency,
            synthetizer_LO_level=synthetizer_LO_level,  # dBm
            synthetizer_RF_state=synthetizer_RF_state,
            synthetizer_RF_frequency=synthetizer_RF_frequency,
            synthetizer_RF_level=synthetizer_RF_level,  # dBm
            downconverter_state=vscd_state,
            downconverter_frequency=vscd_frequency,
            downconverter_level=vscd_level,  # dBm
            spectrum_analyzer_state=spectrum_analyzer_state,
            spectrum_analyzer_sweep_points=spectrum_analyzer_sweep_points,
            spectrum_analyzer_resolution_bandwidth=spectrum_analyzer_resolution_bandwidth,
            spectrum_analyzer_resolution_bandwidth_unit=spectrum_analyzer_resolution_bandwidth_unit,
            spectrum_analyzer_video_bandwidth=spectrum_analyzer_video_bandwidth,
            spectrum_analyzer_video_bandwidth_unit=spectrum_analyzer_video_bandwidth_unit,
            spectrum_analyzer_frequency_span=spectrum_analyzer_frequency_span,
            spectrum_analyzer_frequency_span_unit=spectrum_analyzer_frequency_span_unit,
            # spectrum_analyzer_attenuation = spectrum_analyzer_attenuation,
            gainAmplifier=gainAmplifier,  # dB
            spectrum_analyzer_IF_atten_enable=spectrum_analyzer_IF_atten_enable,
            spectrum_analyzer_IF_atten=spectrum_analyzer_IF_atten,
            spectrum_analyzer_IF_relative_level=spectrum_analyzer_IF_relative_level,
            spectrum_analyzer_IF_relative_level_enable=spectrum_analyzer_IF_relative_level_enable,
            threshold_power=threshold_power,  # dB
            spectrum_analyzer_frequency_marker_unit=spectrum_analyzer_frequency_marker_unit,
            FSV_delay=FSV_delay,
            m_RF=m_RF,
            n_LO=n_LO,
            IF_low=IF_low,
            IF_low_unit=IF_low_unit,
            IF_high=IF_high,
            IF_high_unit=IF_high_unit,
            spurius_IF_unit=spurius_IF_unit,
            calibration_file_LO=calibration_file_LO,
            calibration_file_LO_enable=calibration_file_LO_enable,
            calibration_file_RF=calibration_file_RF,
            calibration_file_RF_enable=calibration_file_RF_enable,
            calibration_file_IF=calibration_file_IF,
            calibration_file_IF_enable=calibration_file_IF_enable,
            result_file_name=result_file_name,
            createprogressdialog=False)

        dialog.Destroy()

        try:
            webbrowser.open(os.path.dirname(spurius_filename))
        except:
            pass
Example #14
0
    def OnStart(self, event):

        TaskFrame.OnStart(self, event)

        synthetizer_LO_state = self.notebook.tabRF.synthetizer_state.GetValue()

        synthetizer_IP = self.notebook.tabRF.instrument_txt_IP.GetValue()
        if check_value_is_IP(synthetizer_IP, "Synthetizer IP") == 0:
            return None

        synthetizer_Port = self.notebook.tabRF.instrument_txt_Port.GetValue()
        if check_value_min_max(synthetizer_Port, "Synthetizer Port",
                               minimum=0) == 0:
            return None

        synthetizer_Timeout = self.notebook.tabRF.instrument_txt_Timeout.GetValue(
        )
        if check_value_min_max(synthetizer_Timeout,
                               "Synthetizer Timeout",
                               minimum=0) == 0:
            return None

        syntetizer_instrType = self.notebook.tabRF.combobox_instrtype.GetValue(
        )

        # synthetizer_frequency_min_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_min_unit, "Minimum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_min = self.notebook.tabRF.synthetizer_frequency_min.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_min,
                               "Minimum Frequency",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_min = eval(
                self.notebook.tabRF.synthetizer_frequency_min.GetValue())
        # synthetizer_frequency_max_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_max_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_max_unit, "Maximum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_max = self.notebook.tabRF.synthetizer_frequency_max.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_max,
                               "Maximum Frequency",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_max = eval(
                self.notebook.tabRF.synthetizer_frequency_max.GetValue())
        # synthetizer_frequency_step_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_step_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_step_unit, "Frequency Step Unit") == 0:
        #    return None
        synthetizer_frequency_step = self.notebook.tabRF.synthetizer_frequency_step.GetValue(
        )
        if check_value_min_max(synthetizer_frequency_step,
                               "Frequency Step",
                               minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_step = eval(
                self.notebook.tabRF.synthetizer_frequency_step.GetValue())
        synthetizer_frequency_unit = unit.return_unit(
            self.notebook.tabRF.synthetizer_frequency_unit.GetValue())
        if check_value_not_none(synthetizer_frequency_unit,
                                "Frequency Unit") == 0:
            return None

        try:
            synthetizer_level_min = eval(
                self.notebook.tabRF.synthetizer_level_min.GetValue())
        except:
            synthetizer_level_min = 0

        try:
            synthetizer_level_max = eval(
                self.notebook.tabRF.synthetizer_level_max.GetValue())
        except:
            synthetizer_level_max = 0

        try:
            synthetizer_level_step = eval(
                self.notebook.tabRF.synthetizer_level_step.GetValue())
        except:
            synthetizer_level_step = 0

        pm5_state = self.notebook.tabPM5.pm5_state.GetValue()

        pm5_com_port = self.notebook.tabPM5.instrument_combobox_com_port.GetValue(
        )

        pm5_Timeout = self.notebook.tabPM5.instrument_txt_timeout.GetValue()
        if check_value_min_max(pm5_Timeout, "PM5 Timeout", minimum=0) == 0:
            return None

        pm5_BaudRate = self.notebook.tabPM5.instrument_combobox_baud.GetValue()
        if check_value_min_max(pm5_BaudRate, "COM Baud Rate", minimum=0) == 0:
            return None

        pm5_misure_number = self.notebook.tabPM5.pm5_misure_number.GetValue()

        pm5_misure_delay = self.notebook.tabPM5.pm5_misure_delay.GetValue(
        )  # seconds
        if check_value_min_max(pm5_misure_delay, "Measure Delay",
                               minimum=0) == 0:
            return None
        else:
            pm5_misure_delay = eval(
                self.notebook.tabPM5.pm5_misure_delay.GetValue())

        calibration_file_LO = self.notebook.tabPM5Setting.calibration_file_LO.GetValue(
        )
        calibration_file_LO_enable = self.notebook.tabPM5Setting.calibration_file_LO_enable.GetValue(
        )
        if calibration_file_LO_enable:
            if check_value_is_valid_file(calibration_file_LO,
                                         "LO Calibration file") == 0:
                return None

        result_file_name = self.notebook.tabPM5Setting.result_file_name.GetValue(
        )

        try:
            if synthetizer_LO_state:
                SMB_LO = create_instrument(
                    synthetizer_IP,
                    synthetizer_Port,
                    eval(synthetizer_Timeout),
                    syntetizer_instrType,
                    TEST_MODE=self.runmodeitem.IsChecked())
            else:
                SMB_LO = create_instrument(synthetizer_IP,
                                           synthetizer_Port,
                                           eval(synthetizer_Timeout),
                                           syntetizer_instrType,
                                           TEST_MODE=True)
        except:
            dlg = wx.MessageDialog(None, "LO synthetizer comunication error",
                                   'Error LO synthetizer',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            if pm5_state:
                PM5 = create_USB_instrument(
                    pm5_com_port,
                    pm5_Timeout,
                    pm5_BaudRate,
                    TEST_MODE=self.runmodeitem.IsChecked(),
                    instrument_class="PM5")
            else:
                PM5 = create_USB_instrument(pm5_com_port,
                                            pm5_Timeout,
                                            pm5_BaudRate,
                                            TEST_MODE=True,
                                            instrument_class="PM5")
        except:
            dlg = wx.MessageDialog(None, "PM5 comunication error",
                                   'Error mm-submm power meter',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

            # dlg.ShowModal()
            # return 0

        synthetizer_frequency = Frequency_Range(synthetizer_frequency_min,
                                                synthetizer_frequency_max,
                                                synthetizer_frequency_step,
                                                synthetizer_frequency_unit)
        synthetizer_frequency.to_base()
        synthetizer_level = Generic_Range(synthetizer_level_min,
                                          synthetizer_level_max,
                                          synthetizer_level_step)

        self.savesettings(result_file_name)

        dialog = wx.ProgressDialog("Progress",
                                   "Time remaining",
                                   maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME
                                   | wx.PD_REMAINING_TIME)
        # dialog =None
        measure_100GHz_cal(SMB_LO,
                           PM5,
                           synthetizer_frequency,
                           synthetizer_level,
                           calibration_file_LO,
                           pm5_misure_number,
                           pm5_misure_delay,
                           result_file_name,
                           createprogressdialog=dialog)

        dialog.Destroy()
Example #15
0
    def OnStart(self, event):

        TaskFrame.OnStart(self, event)

        create_dummy_cable = self.notebook.tabCalCableSetting.create_dummycable_cb.GetValue()

        if create_dummy_cable:
            info_message("Dummy cable creation mode. \n No instrument used.", "Dummy Cable Mode")

        synthetizer_IP = self.notebook.tabRF.instrument_txt_IP.GetValue()
        if check_value_is_IP(synthetizer_IP, "Synthetizer IP") == 0:
            return None

        synthetizer_Port = self.notebook.tabRF.instrument_txt_Port.GetValue()
        if check_value_min_max(synthetizer_Port, "Synthetizer Port", minimum=0) == 0:
            return None

        synthetizer_Timeout = self.notebook.tabRF.instrument_txt_Timeout.GetValue()
        if check_value_min_max(synthetizer_Timeout, "Synthetizer Timeout", minimum=0) == 0:
            return None

        syntetizer_instrType = self.notebook.tabRF.combobox_instrtype.GetValue()

        syntetizer_enable_state = self.notebook.tabRF.instrument_enable_status.GetValue()

        # synthetizer_frequency_min_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_min_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_min_unit, "Minimum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_min = self.notebook.tabRF.synthetizer_frequency_min.GetValue()
        if check_value_min_max(synthetizer_frequency_min, "Minimum Frequency", minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_min = eval(self.notebook.tabRF.synthetizer_frequency_min.GetValue())
        # synthetizer_frequency_max_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_max_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_max_unit, "Maximum Frequency Unit") == 0:
        #    return None
        synthetizer_frequency_max = self.notebook.tabRF.synthetizer_frequency_max.GetValue()
        if check_value_min_max(synthetizer_frequency_max, "Maximum Frequency", minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_max = eval(self.notebook.tabRF.synthetizer_frequency_max.GetValue())
        # synthetizer_frequency_step_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_step_unit.GetValue())
        # if check_value_not_none(synthetizer_frequency_step_unit, "Frequency Step Unit") == 0:
        #    return None
        synthetizer_frequency_step = self.notebook.tabRF.synthetizer_frequency_step.GetValue()
        if check_value_min_max(synthetizer_frequency_step, "Frequency Step", minimum=0) == 0:
            return None
        else:
            synthetizer_frequency_step = eval(self.notebook.tabRF.synthetizer_frequency_step.GetValue())
        synthetizer_frequency_unit = unit.return_unit(self.notebook.tabRF.synthetizer_frequency_unit.GetValue())
        if check_value_not_none(synthetizer_frequency_unit, "Frequency Unit") == 0:
            return None

        try:
            synthetizer_level_fixed = eval(self.notebook.tabRF.synthetizer_level_fixed.GetValue())
        except:
            synthetizer_level_fixed = 0

        spectrum_analyzer_IP = self.notebook.tabFSV.instrument_txt_IP.GetValue()
        if check_value_is_IP(spectrum_analyzer_IP, "LO Synthetizer IP") == 0:
            return None

        spectrum_analyzer_Port = self.notebook.tabFSV.instrument_txt_Port.GetValue()
        if check_value_min_max(spectrum_analyzer_Port, "LO Synthetizer Port", minimum=0) == 0:
            return None

        spectrum_analyzer_Timeout = self.notebook.tabFSV.instrument_txt_Timeout.GetValue()
        if check_value_min_max(spectrum_analyzer_Timeout, "LO Synthetizer Timeout", minimum=0) == 0:
            return None

        spectrum_analyzer_instrType = self.notebook.tabFSV.combobox_instrtype.GetValue()

        spectrum_analyzer_state = self.notebook.tabFSV.instrument_enable_status.GetValue()

        if spectrum_analyzer_state:
            spectrum_analyzer_sweep_points = self.notebook.tabFSV.spectrum_analyzer_sweep_points.GetValue()
            if check_value_min_max(spectrum_analyzer_sweep_points, "Sweep points", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_sweep_points = eval(self.notebook.tabFSV.spectrum_analyzer_sweep_points.GetValue())

            spectrum_analyzer_resolution_bandwidth = self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth.GetValue()
            if check_value_min_max(spectrum_analyzer_resolution_bandwidth, "Resolution Bandwidth", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_resolution_bandwidth = eval(
                    self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth.GetValue())

            spectrum_analyzer_resolution_bandwidth_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_resolution_bandwidth_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_resolution_bandwidth_unit, "Resolution Bandwidth Unit") == 0:
                return None

            spectrum_analyzer_video_bandwidth = self.notebook.tabFSV.spectrum_analyzer_video_bandwidth.GetValue()
            if check_value_min_max(spectrum_analyzer_video_bandwidth, "Video Bandwidth", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_video_bandwidth = eval(
                    self.notebook.tabFSV.spectrum_analyzer_video_bandwidth.GetValue())

            spectrum_analyzer_video_bandwidth_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_video_bandwidth_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_video_bandwidth_unit, "Video Bandwidth Unit") == 0:
                return None

            spectrum_analyzer_frequency_span = self.notebook.tabFSV.spectrum_analyzer_frequency_span.GetValue()
            if check_value_min_max(spectrum_analyzer_frequency_span, "Frequency Span", minimum=0) == 0:
                return None
            else:
                spectrum_analyzer_frequency_span = eval(
                    self.notebook.tabFSV.spectrum_analyzer_frequency_span.GetValue())

            spectrum_analyzer_frequency_span_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_frequency_span_unit.GetValue())
            if check_value_not_none(spectrum_analyzer_frequency_span_unit, "Frequency Span Unit") == 0:
                return None

            ##spectrum_analyzer_harmonic_number = spectrum_analyzer_harmonic_number
            # spectrum_analyzer_attenuation = self.notebook.tabFSV.spectrum_analyzer_attenuation.GetValue()
            # if check_value_not_none(spectrum_analyzer_attenuation, "Attenuation") == 0:
            #    return None

            gainAmplifier = self.notebook.tabFSV.gainAmplifier.GetValue()  # dB
            if check_value_not_none(gainAmplifier, "Gain Amplifier") == 0:
                return None

            spectrum_analyzer_IF_atten_enable = self.notebook.tabFSV.spectrum_analyzer_IF_atten_enable.GetValue()
            spectrum_analyzer_IF_atten = self.notebook.tabFSV.spectrum_analyzer_IF_atten.GetValue()
            if check_value_not_none(spectrum_analyzer_IF_atten, "Attenuation") == 0:
                return None

            spectrum_analyzer_IF_relative_level = self.notebook.tabFSV.spectrum_analyzer_IF_relative_level.GetValue()
            if check_value_not_none(spectrum_analyzer_IF_relative_level, "Relative Power Level") == 0:
                return None

            spectrum_analyzer_IF_relative_level_enable = self.notebook.tabFSV.spectrum_analyzer_IF_relative_level_enable.GetValue()

            threshold_power = self.notebook.tabFSV.threshold_power.GetValue()  # dB
            if check_value_not_none(threshold_power, "Threshold Power Level") == 0:
                return None

            spectrum_analyzer_frequency_marker_unit = unit.return_unit(
                self.notebook.tabFSV.spectrum_analyzer_frequency_marker_unit.GetValue())
            # to check
            if check_value_not_none(spectrum_analyzer_frequency_marker_unit, "Marker Frequency Unit") == 0:
                return None

            FSV_delay = self.notebook.tabFSV.FSV_delay.GetValue()
            if check_value_min_max(FSV_delay, "FSV measure delay", minimum=0) == 0:
                return None
            else:
                FSV_delay = eval(self.notebook.tabFSV.FSV_delay.GetValue())

        result_file_name = self.notebook.tabCalCableSetting.result_file_name.GetValue()
        dummy_cable_power_level = self.notebook.tabCalCableSetting.output_level.GetValue()

        if create_dummy_cable:
            if check_value_not_none(dummy_cable_power_level, "Power Level (Dummy Cable)") == 0:
                return None

        try:
            SMB_RF = create_instrument(synthetizer_IP, synthetizer_Port, eval(synthetizer_Timeout),
                                       syntetizer_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                       enable_state=syntetizer_enable_state and not create_dummy_cable)
        except:
            dlg = wx.MessageDialog(None, "Synthetizer comunication error", 'Error Synthetizer', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        try:
            FSV = create_instrument(spectrum_analyzer_IP, spectrum_analyzer_Port, eval(spectrum_analyzer_Timeout),
                                    spectrum_analyzer_instrType, TEST_MODE=self.runmodeitem.IsChecked(),
                                    instrument_class="FSV", enable_state=spectrum_analyzer_state)
        except:
            dlg = wx.MessageDialog(None, "Spectrum analiser comunication error", 'Error Spectrum analiser',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        self.savesettings(result_file_name)

        dialog = wx.ProgressDialog("Progress", "Time remaining", maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME)

        synthetizer_frequency = Frequency_Range(synthetizer_frequency_min, synthetizer_frequency_max,
                                                synthetizer_frequency_step, synthetizer_frequency_unit)
        synthetizer_frequency.to_base()

        calibration_file_result = measure_calibration_cable(SMB_RF,
                                                            FSV,
                                                            synthetizer_frequency,
                                                            synthetizer_level_fixed,
                                                            spectrum_analyzer_state,
                                                            spectrum_analyzer_sweep_points,
                                                            spectrum_analyzer_resolution_bandwidth,
                                                            spectrum_analyzer_resolution_bandwidth_unit,
                                                            spectrum_analyzer_video_bandwidth,
                                                            spectrum_analyzer_video_bandwidth_unit,
                                                            spectrum_analyzer_frequency_span,
                                                            spectrum_analyzer_frequency_span_unit,
                                                            # spectrum_analyzer_attenuation,
                                                            gainAmplifier,
                                                            spectrum_analyzer_IF_atten_enable,
                                                            spectrum_analyzer_IF_atten,
                                                            spectrum_analyzer_IF_relative_level,
                                                            spectrum_analyzer_IF_relative_level_enable,
                                                            threshold_power,
                                                            spectrum_analyzer_frequency_marker_unit,
                                                            FSV_delay,
                                                            result_file_name,
                                                            dummy_cable_power_level,
                                                            create_dummy_cable,
                                                            createprogressdialog=dialog)

        dialog.Destroy()

        try:
            webbrowser.open(os.path.dirname(calibration_file_result))
        except:
            pass
Example #16
0
 def __init__(self):
     """Constructor"""
     TaskFrame.__init__(self,
                        NotebookDemo,
                        "Continous Measure",
                        size=(800, 650))
Example #17
0
 def init_apps(self):
     self.task_frame = TaskFrame()
     self.project_frame = ProjectFrame()
Example #18
0
    def __init__(self):
        """Constructor"""
        TaskFrame.__init__(self,
                           NotebookDemo,
                           "Plots",
                           size=(800, 680),
                           start_button=False)

        self.setupMenu = wx.Menu()
        self.superior_title = wx.Menu()
        self.title = wx.Menu()
        self.legend_title = wx.Menu()
        self.legend_lines = wx.Menu()
        self.axis_legend = wx.Menu()
        self.axis_ticks = wx.Menu()
        self.annotation = wx.Menu()

        self.superior_title_font = wx.Menu()
        self.superior_title_font_size = wx.Menu()
        self.superior_title_font_size_mi = []
        for i in fontsizerange:
            self.superior_title_font_size_mi.append(
                self.superior_title_font_size.AppendRadioItem(
                    8800 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.superior_title_font_size_mi[-1])
        self.superior_title_font.Append(8700, "Size",
                                        self.superior_title_font_size)
        self.superior_title.Append(8600, "Font", self.superior_title_font)
        self.setupMenu.Append(8500, 'Superior Title', self.superior_title)

        self.title_font = wx.Menu()
        self.title_font_size = wx.Menu()
        self.title_font_size_mi = []
        for i in fontsizerange:
            self.title_font_size_mi.append(
                self.title_font_size.AppendRadioItem(8400 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.title_font_size_mi[-1])
        self.title_font.Append(8300, "Size", self.title_font_size)
        self.title.Append(8200, "Font", self.title_font)
        self.setupMenu.Append(8100, 'Title', self.title)

        self.legend_title_font = wx.Menu()
        self.legend_title_font_size = wx.Menu()
        self.legend_title_font_size_mi = []
        for i in fontsizerange:
            self.legend_title_font_size_mi.append(
                self.legend_title_font_size.AppendRadioItem(
                    8000 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.legend_title_font_size_mi[-1])
        self.legend_title_font.Append(7900, "Size",
                                      self.legend_title_font_size)
        self.legend_title.Append(7800, "Font", self.legend_title_font)
        self.setupMenu.Append(7700, 'Legend Title', self.legend_title)

        self.legend_lines_font = wx.Menu()
        self.legend_lines_font_size = wx.Menu()
        self.legend_lines_font_size_mi = []
        for i in fontsizerange:
            self.legend_lines_font_size_mi.append(
                self.legend_lines_font_size.AppendRadioItem(
                    7600 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.legend_lines_font_size_mi[-1])
        self.legend_lines_font.Append(7500, "Size",
                                      self.legend_lines_font_size)
        self.legend_lines.Append(7400, "Font", self.legend_lines_font)
        self.setupMenu.Append(7300, 'Legend Lines', self.legend_lines)

        self.axis_legend_font = wx.Menu()
        self.axis_legend_font_size = wx.Menu()
        self.axis_legend_font_size_mi = []
        for i in fontsizerange:
            self.axis_legend_font_size_mi.append(
                self.axis_legend_font_size.AppendRadioItem(
                    7200 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.axis_legend_font_size_mi[-1])
        self.axis_legend_font.Append(7100, "Size", self.axis_legend_font_size)
        self.axis_legend.Append(7000, "Font", self.axis_legend_font)
        self.setupMenu.Append(6900, 'Axis Legend', self.axis_legend)

        self.axis_ticks_font = wx.Menu()
        self.axis_ticks_font_size = wx.Menu()
        self.axis_ticks_font_size_mi = []
        for i in fontsizerange:
            self.axis_ticks_font_size_mi.append(
                self.axis_ticks_font_size.AppendRadioItem(
                    6800 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.axis_ticks_font_size_mi[-1])
        self.axis_ticks_font.Append(6700, "Size", self.axis_ticks_font_size)
        self.axis_ticks.Append(6600, "Font", self.axis_ticks_font)
        self.setupMenu.Append(6500, 'Axis Ticks', self.axis_ticks)

        self.annotation_font = wx.Menu()
        self.annotation_font_size = wx.Menu()
        self.annotation_font_size_mi = []
        for i in range(5, 20):
            self.annotation_font_size_mi.append(
                self.annotation_font_size.AppendRadioItem(
                    6400 + i, str(i), str(i)))
            # self.Bind(wx.EVT_MENU, self.OnCheckSetting, self.annotation_font_size_mi[-1])
        self.annotation_font.Append(6300, "Size", self.annotation_font_size)
        self.annotation.Append(6200, "Font", self.annotation_font)
        self.setupMenu.Append(6100, 'Points Text', self.annotation)

        self.menubar.Append(self.setupMenu, '&Settings')
        self.SetMenuBar(self.menubar)

        self.set_selected_settings()
Example #19
0
 def __init__(self):
     """Constructor"""
     TaskFrame.__init__(self,
                        NotebookDemo,
                        "Calibrate Cable",
                        size=(800, 650))
Example #20
0
 def __init__(self):
     """Constructor"""
     TaskFrame.__init__(self,
                        NotebookDemo,
                        "Calculate Allan Deviation",
                        size=(800, 650))
Example #21
0
    def OnStart(self, event):
        TaskFrame.OnStart(self, event)

        PM_IP = self.notebook.tabPowerMeter.instrument_txt_IP.GetValue()
        if check_value_is_IP(PM_IP, "PM IP") == 0:
            return None

        PM_Port = self.notebook.tabPowerMeter.instrument_txt_Port.GetValue()
        if check_value_min_max(PM_Port, "PM Port", minimum=0) == 0:
            return None

        PM_Timeout = self.notebook.tabPowerMeter.instrument_txt_Timeout.GetValue(
        )
        if check_value_min_max(PM_Timeout, "PM Timeout", minimum=0) == 0:
            return None

        PM_instrType = self.notebook.tabPowerMeter.combobox_instrtype.GetValue(
        )

        power_meter_misure_number = self.notebook.tabPowerMeter.power_meter_misure_number.GetValue(
        )
        if power_meter_misure_number > 0:
            pm_misure_number = power_meter_misure_number
        else:
            dlg = wx.MessageDialog(None, "PM number of measures is invalid",
                                   'Error PM', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        power_meter_misure_delay = self.notebook.tabPowerMeter.power_meter_misure_delay.GetValue(
        )
        if check_value_min_max(power_meter_misure_delay,
                               "Measures delay",
                               minimum=0) == 0:
            return None
        else:
            pm_misure_delay = eval(self.notebook.tabPowerMeter.
                                   power_meter_misure_delay.GetValue())

        result_file_name = self.notebook.tabCountinousPMSetup.result_file_name.GetValue(
        )

        try:
            PM = create_instrument(PM_IP,
                                   PM_Port,
                                   eval(PM_Timeout),
                                   PM_instrType,
                                   TEST_MODE=self.runmodeitem.IsChecked())
        except:
            dlg = wx.MessageDialog(None, "PM comunication error", 'Error PM',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        self.savesettings(result_file_name)

        dialog = wx.ProgressDialog("Progress",
                                   "Time remaining",
                                   maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME
                                   | wx.PD_REMAINING_TIME)
        # dialog =None
        continous_measure_PM(PM,
                             pm_misure_number,
                             pm_misure_delay,
                             result_file_name,
                             createprogressdialog=dialog)

        dialog.Destroy()
Example #22
0
    def OnStart(self, event):

        TaskFrame.OnStart(self, event)

        # Check all values
        TSC_IP = self.notebook.tabTSC.instrument_txt_IP.GetValue()
        if check_value_is_IP(TSC_IP, "TSC IP") == 0:
            return None

        TSC_Port = self.notebook.tabTSC.instrument_txt_Port.GetValue()
        if check_value_min_max(TSC_Port, "TSC Port", minimum=0) == 0:
            return None

        TSC_Timeout = self.notebook.tabTSC.instrument_txt_Timeout.GetValue()
        if check_value_min_max(TSC_Timeout, "TSC Timeout", minimum=0) == 0:
            return None

        TSC_instrType = self.notebook.tabTSC.combobox_instrtype.GetValue()

        TSC_collecting_delay = self.notebook.tabTSC.TSC_collecting_delay.GetValue(
        )
        if check_value_min_max(TSC_collecting_delay,
                               "Collecting time",
                               minimum=0) == 0:
            return None
        else:
            TSC_collecting_delay = eval(
                self.notebook.tabTSC.TSC_collecting_delay.GetValue())

        TSC_plot_adev = self.notebook.tabTSC.TSC_plot_adev.GetValue()

        result_file_name = self.notebook.tabTSC.result_file_name.GetValue()

        try:
            TSC = create_instrument(TSC_IP,
                                    TSC_Port,
                                    eval(TSC_Timeout),
                                    TSC_instrType,
                                    TEST_MODE=self.runmodeitem.IsChecked(),
                                    instrument_class="TSC")
        except:
            dlg = wx.MessageDialog(None, "TSC comunication error", 'Error TSC',
                                   wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            return 0

        self.savesettings(result_file_name)

        dialog = wx.ProgressDialog("Progress",
                                   "Time remaining",
                                   maximum=100,
                                   style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME
                                   | wx.PD_REMAINING_TIME)

        TSC_measure(TSC,
                    TSC_collecting_delay,
                    result_file_name,
                    TSC_plot_adev,
                    createprogressdialog=dialog)

        dialog.Destroy()
Example #23
0
 def __init__(self):
     """Constructor"""
     TaskFrame.__init__(self, NotebookDemo, "PM5", size=(800, 650))