當前位置: 首頁>>代碼示例>>Python>>正文


Python Device.addParameter方法代碼示例

本文整理匯總了Python中Device.Device.addParameter方法的典型用法代碼示例。如果您正苦於以下問題:Python Device.addParameter方法的具體用法?Python Device.addParameter怎麽用?Python Device.addParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Device.Device的用法示例。


在下文中一共展示了Device.addParameter方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from Device import Device [as 別名]
# 或者: from Device.Device import addParameter [as 別名]
    def __init__(self, parent = None):
        # Establish a connection to 
        try:
            me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
        except:
            print("Multiple instances cannot be running")
            time.sleep(2)
            sys.exit(1)
        try:
            cxn = labrad.connect()
        except:
            print("Please start the labrad manager")
            time.sleep(3)
            sys.exit(0)
        try:
            tele = cxn.telecomm_server
        except:
            print("Please start the telecomm server")
            time.sleep(3)
            sys.exit(1)
        
        laser = Device("Laser Endpoint Monitor")
        laser.connection(cxn)

        laser.setServerName("goldstein_s_laser_endpoint_monitor")
        laser.addParameter("Voltage","get_reading", None)
        laser.selectDeviceCommand("select_device", 0)

        laser.addPlot()
        laser.setPlotRefreshRate(0.02)
        laser.setRefreshRate(0.02)
        laser.setYLabel("Strength")
        laser.begin()
        self.devices.append(laser)

        
        # Start the datalogger. This line can be commented
        # out if no datalogging is required.
        self.chest = dataChestWrapper(self.devices)
        
        # Create the gui
        self.gui = MGui.MGui()
        self.gui.setRefreshRate(0.02)
        self.gui.startGui(self.devices, 'Laser Endpoint System Gui', 'Laser Endpoint Data', tele)
開發者ID:McDermott-Group,項目名稱:servers,代碼行數:46,代碼來源:LaserEndpointGui.py

示例2: __init__

# 需要導入模塊: from Device import Device [as 別名]
# 或者: from Device.Device import addParameter [as 別名]
    def __init__(self, parent = None):
        # Establish a connection to labrad
        try:
            cxn = labrad.connect()
        except:
            print("Please start the labrad manager")
            sys.exit(0)
        try:
            tele = cxn.telecomm_server
        except:
            print("Please start the telecomm server")
            sys.exit(1)
        ##################################################################
        # How to Use nViewer:    
        ################################################################
        #   nViewer can be used with any labrad server, and given a new device class (it must have a "prompt" function), anything else.
        #   It is meant to be a tool which allows much, much easier creation of straightforward gui's.
        #   To create you own, make a new class in which you establish a connection to labrad, create new
        #   device instances, and start the gui.
        #
        #
        # Here are the steps to create your own gui.
        # 1. Establish LabRad connection
        #       cxn = labrad.connect()
        #
        # 2. Create Device
        #        ex = Device("NAME OF LABRAD SERVER", 
        #                        "TITLE TO BE SHOWN ON GUI", 
        #                        [LIST OF FIELDS TO BE DISPLAYED ON GUI],
        #                        [LIST OF THOSE FIELDS' CORRESPONDING SERVER SETTINGS], 
        #                        [ARGUMENTS TO BE PASSED TO THOSE SETTINGS]
        #                        CONNECTION REFERENCE,
        #                        ["LIST","OF","BUTTONS"], 
        #                        ["SETTINGS", "ACTIVATED", "BY BUTTONS"], 
        #                        ["ALERT TO BE DISPLAYED WITH EACH BUTTON PRESS", "NONE IF NO MESSAGE"]
        #                        ["ARGUMENTS PASSED TO THE SETTINGS TRIGGERED BY THE BUTTONS"]
        #                       "yAxis Label"(OPTIONAL),
        #                       "SELECT DEVICE COMMAND (OPTIONAL FOR SERVERS THAT DO NOT REQUIRE DEVICE SELECTION)", 
        #                        "DEVICE NUMBER",)
        # 3. Start the dataChest datalogger, this line can be commented out
        #   if no datalogging is required.
        #           self.chest = dataChestWrapper(self.devices)
        #   
        # 4. Start nGui and name the window
        #       self.gui = NGui.NGui()
        #       self.gui.startGui(self.devices, Window title)
        #
        # 5. Initialize nViewer OUTSIDE OF THE CLASS
        #       viewer = nViewer()  
        #       viewer.__init__()
        ###################################################################
    
        LeidenDRTemperature = Device("Random")
        LeidenDRTemperature.connection(cxn)

        LeidenDRTemperature.setServerName("my_server")
        LeidenDRTemperature.addParameter("Pressure","pressure", None)
        LeidenDRTemperature.addParameter("Temperature", "temperature", None)
        #LeidenDRTemperature.selectDeviceCommand("select_device", 0)
        LeidenDRTemperature.addPlot()
        LeidenDRTemperature.setPlotRefreshRate(3)
        LeidenDRTemperature.setRefreshRate(3)
        LeidenDRTemperature.setYLabel("Hi", "Custom Units")
        LeidenDRTemperature.begin()
        self.devices.append(LeidenDRTemperature)

        
        # Start the datalogger. This line can be commented
        # out if no datalogging is required.
        self.chest = dataChestWrapper(self.devices)
        
        # Create the gui
        self.gui = MGui.MGui()
        self.gui.setRefreshRate(3)
        self.gui.startGui(self.devices, 'Leiden Gui', 'Leiden Data', tele)
開發者ID:McDermott-Group,項目名稱:servers,代碼行數:77,代碼來源:testGui.py

示例3: __init__

# 需要導入模塊: from Device import Device [as 別名]
# 或者: from Device.Device import addParameter [as 別名]
    def __init__(self, parent=None):
        # Establish a connection to labrad
        try:
            cxn = labrad.connect()
        except:
            print("Please start the labrad manager")
            time.sleep(2)

            sys.exit(0)
        try:
            tele = cxn.telecomm_server
        except:
            print("Please start the telecomm server")
            time.sleep(2)
            sys.exit(1)

        Return = Device("Return")
        Return.setServerName("mks_pdr2000_server")
        Return.addParameter("Pressure 1", "get_pressure", None, 0)
        Return.addParameter("Pressure 2", "get_pressure", None, 1)
        Return.addPlot()
        Return.setPlotRefreshRate(3)
        Return.setRefreshRate(3)
        Return.setYLabel("Pressure")
        Return.selectDeviceCommand("select_device", 0)
        Return.connection(cxn)
        Return.begin()
        self.devices.append(Return)

        Still = Device("Still")
        Still.setServerName("mks_pdr2000_server")
        Still.addParameter("Pressure 1", "get_pressure", None, 0)
        Still.addParameter("Pressure 2", "get_pressure", None, 1)
        Still.addPlot()
        Still.setPlotRefreshRate(3)
        Still.setRefreshRate(3)
        Still.setYLabel("Pressure")
        Still.selectDeviceCommand("select_device", 2)
        Still.connection(cxn)
        Still.begin()
        self.devices.append(Still)

        Keg = Device("Keg")
        Keg.setServerName("mks_pdr2000_server")
        Keg.addParameter("Pressure 1", "get_pressure", None, 0)
        Keg.addParameter("Pressure 2", "get_pressure", None, 1)
        Keg.addPlot()
        Keg.setPlotRefreshRate(3)
        Keg.setRefreshRate(3)
        Keg.setYLabel("Pressure")
        Keg.selectDeviceCommand("select_device", 1)
        Keg.connection(cxn)
        Keg.begin()
        self.devices.append(Keg)

        lake370 = Device("Lakeshore 370")
        lake370.setServerName("lakeshore_ruox")
        for i in range(0, 5):
            lake370.addParameter("Temperature " + str(i + 1), "temperatures", None, i)
        lake370.setYLabel("Temperature")
        lake370.selectDeviceCommand("select_device", 0)
        lake370.addPlot()
        lake370.setPlotRefreshRate(3)
        lake370.setRefreshRate(3)
        lake370.connection(cxn)
        lake370.begin()
        self.devices.append(lake370)

        lake218 = Device("Lakeshore 218")
        lake218.setServerName("lakeshore_218")
        lake218.addParameter("Sensor 1", "get_temperature", 1)
        lake218.addParameter("Sensor 2", "get_temperature", 2)
        lake218.addParameter("Sensor 3", "get_temperature", 3)
        lake218.addParameter("Sensor 4", "get_temperature", 4)
        lake218.addParameter("Sensor 5", "get_temperature", 5)
        lake218.addParameter("Sensor 6", "get_temperature", 6)
        lake218.addParameter("Sensor 7", "get_temperature", 7)
        lake218.addParameter("Sensor 8", "get_temperature", 8)
        lake218.addPlot()
        lake218.setPlotRefreshRate(3)
        lake218.setRefreshRate(3)
        lake218.setYLabel("Temperature")
        lake218.selectDeviceCommand("select_device", 0)
        lake218.connection(cxn)
        lake218.begin()
        self.devices.append(lake218)

        # Start the datalogger. This line can be commented
        # out if no datalogging is required.
        self.chest = dataChestWrapper(self.devices)

        # Create the gui
        self.gui = MGui.MGui()
        self.gui.startGui(self.devices, "Leiden Gui", "Leiden Data", tele)
開發者ID:McDermott-Group,項目名稱:servers,代碼行數:96,代碼來源:DRMonGUI.py

示例4: __init__

# 需要導入模塊: from Device import Device [as 別名]
# 或者: from Device.Device import addParameter [as 別名]
    def __init__(self, parent = None):
        # Establish a connection to LabRAD.
        try:
            me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
        except:
            print("Multiple instances cannot be running")
            time.sleep(2)
            sys.exit(1)
        try:
            cxn = labrad.connect()
        except:
            print("Please start the LabRAD manager")
            time.sleep(2)
            sys.exit(0)
        try:
            tele = cxn.telecomm_server
        except:
            print("Please start the telecomm server")
            time.sleep(2)
            sys.exit(1)
    
        
        PT1000s = Device("PT1000s")
        PT1000s.connection(cxn)
        PT1000s.setServerName("goldstein_s_pt1000_temperature_monitor")
        PT1000s.addParameter("3K", "get_temperatures", None, 0)
        PT1000s.addParameter("50K", "get_temperatures", None, 1)
        PT1000s.selectDeviceCommand("select_device", 0)
        PT1000s.setYLabel("Temperature")
        PT1000s.addPlot()
        PT1000s.begin()
        self.devices.append(PT1000s)
        
        
        LeidenDRTemperature = Device("Leiden DR")
        LeidenDRTemperature.connection(cxn)

        LeidenDRTemperature.setServerName("leiden_dr_temperature")
        LeidenDRTemperature.addParameter("Mix (PT-1000)",
                "mix_temperature_pt1000", None)
        LeidenDRTemperature.addParameter("Mix (TT)",
                "mix_temperature", None)
        LeidenDRTemperature.addParameter("Still",
                "still_temperature", None)
        LeidenDRTemperature.addParameter("Exchange",
                "exchange_temperature", None)
        LeidenDRTemperature.selectDeviceCommand("select_device", 0)
        LeidenDRTemperature.addPlot()
        LeidenDRTemperature.begin()
        LeidenDRTemperature.setYLabel("Temperature")
        self.devices.append(LeidenDRTemperature)

        Compressor = Device("Compressor")
        Compressor.setServerName("cp2800_compressor")
        Compressor.addButton("Turn Off",
                "You are about to turn the compressor off.",
                "status", None)
        Compressor.addButton("Turn On",
                "You are about to turn the compressor on.",
                "status", None)
        Compressor.addParameter("Input Water Temperature",
                "temperaturesforgui", None, 0)
        Compressor.addParameter("Output Water Temperature",
                "temperaturesforgui", None, 1)
        Compressor.addParameter("Helium Temperature",
                "temperaturesforgui", None, 2)
        Compressor.addParameter("Oil Temperature",
                "temperaturesforgui", None, 3)
        Compressor.addPlot()
        Compressor.setYLabel("Temperature")
        Compressor.selectDeviceCommand("select_device", 0)
        Compressor.connection(cxn)
        Compressor.begin()
        self.devices.append(Compressor)
        
        Vacuum = Device("Vacuum")
        Vacuum.setServerName("pfeiffer_vacuum_maxigauge")
        Vacuum.connection(cxn)
        Vacuum.addPlot()
        # Vacuum.addParameter("Sensor 1", "get_pressures", None, 0)
        # Vacuum.addParameter("Sensor 2", "get_pressures", None, 1)
        # Vacuum.addParameter("Sensor 3", "get_pressures", None, 2)
        Vacuum.addParameter("OVC Pressure", "get_pressures", None, 3)
        Vacuum.addParameter("IVC Pressure", "get_pressures", None, 4)
        Vacuum.addParameter("Still Pressure", "get_pressures", None, 5)
        Vacuum.setYLabel("Pressure")
        Vacuum.selectDeviceCommand("select_device", 0)
        Vacuum.begin()
        self.devices.append(Vacuum)
        
        Temperature = Device("Temperature")
        Temperature.connection(cxn)
        Temperature.setServerName("omega_temperature_monitor")
        Temperature.addParameter("Exteranal Water Temperature",
                "get_temperature")
        Temperature.selectDeviceCommand("select_device", 0)
        Temperature.addPlot()
        Temperature.setYLabel("Temperature")
        Temperature.begin()
        self.devices.append(Temperature)
#.........這裏部分代碼省略.........
開發者ID:McDermott-Group,項目名稱:servers,代碼行數:103,代碼來源:LeidenGui.py


注:本文中的Device.Device.addParameter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。