Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从python获得对Thorlabs PM100USB的控制_Python_Visa_Pyvisa - Fatal编程技术网

从python获得对Thorlabs PM100USB的控制

从python获得对Thorlabs PM100USB的控制,python,visa,pyvisa,Python,Visa,Pyvisa,我有Thorlabs PM100USB功率计连接到计算机,我想从python获取当前读数。从以下代码中,测量类型显示“TEMP”,它给出温度传感器的当前温度。我打印了资源列表,这就是我得到的 rm.list_resources() Out[7]: ('USB0::0x1313::0x80F8::M00495436::INSTR', 'ASRL1::INSTR', 'ASRL10::INSTR') Measurement type : TEMP Current value : 24.350

我有Thorlabs PM100USB功率计连接到计算机,我想从python获取当前读数。从以下代码中,测量类型显示“TEMP”,它给出温度传感器的当前温度。我打印了资源列表,这就是我得到的

rm.list_resources()
Out[7]: ('USB0::0x1313::0x80F8::M00495436::INSTR', 'ASRL1::INSTR', 'ASRL10::INSTR')
Measurement type : TEMP
Current value    : 24.350668
Thorlabs,TSP01,M00495436,1.2.0

Resource Manager of Visa Library at C:\WINDOWS\system32\visa64.dll
USBInstrument at USB0::0x1313::0x80F8::M00495436::INSTR
我在代码中使用了它

import visa
import pyvisa
from ThorlabsPM100 import ThorlabsPM100
rm = visa.ResourceManager()
rm.list_resources()
inst = rm.open_resource('USB0::0x1313::0x80F8::M00495436::INSTR')
power_meter = ThorlabsPM100(inst=inst)
inst.timeout = None

print("Measurement type :", power_meter.getconfigure)
print("Current value    :", power_meter.read)

print(inst.query("*IDN?"))
print(rm)
print(inst)
这是我得到的输出

rm.list_resources()
Out[7]: ('USB0::0x1313::0x80F8::M00495436::INSTR', 'ASRL1::INSTR', 'ASRL10::INSTR')
Measurement type : TEMP
Current value    : 24.350668
Thorlabs,TSP01,M00495436,1.2.0

Resource Manager of Visa Library at C:\WINDOWS\system32\visa64.dll
USBInstrument at USB0::0x1313::0x80F8::M00495436::INSTR

我要的是功率读数,不是温度读数。任何潜在客户都将不胜感激

请查看他们github上的示例程序

它显示了一些设置要读取的测量类型的方法。例如:

power_meter.sense.power.dc.range.auto = "ON"
如果您再次运行这些测线,它应该会发生变化,并向您显示它现在测量的内容:

print("Measurement type :", power_meter.getconfigure)
print("Current value    :", power_meter.read)