当前位置: 首页>>代码示例>>Python>>正文


Python Device.connection方法代码示例

本文整理汇总了Python中Device.Device.connection方法的典型用法代码示例。如果您正苦于以下问题:Python Device.connection方法的具体用法?Python Device.connection怎么用?Python Device.connection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Device.Device的用法示例。


在下文中一共展示了Device.connection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Device import Device [as 别名]
# 或者: from Device.Device import connection [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 connection [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 connection [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 connection [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.connection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。