Skip to content

Commit

Permalink
Add python file
Browse files Browse the repository at this point in the history
  • Loading branch information
felix92 authored Jun 9, 2020
1 parent 8b6f37c commit 1b23cf0
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions PM100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from ThorlabsPM100 import ThorlabsPM100, USBTMC

from tango import AttrQuality, AttrWriteType, DispLevel, DevState, DebugIt
from tango.server import Device, attribute, command, pipe, device_property

class PM100(Device):

wavelength = attribute(label="Wavelength (nm)", dtype=float,
display_level=DispLevel.OPERATOR,
access=AttrWriteType.READ_WRITE,
doc="Correction wavelength")

power = attribute(label="Power (W)", dtype=float,
display_level=DispLevel.OPERATOR,
access=AttrWriteType.READ,
doc="Measured power")



def init_device(self):
Device.init_device(self)
self.inst = USBTMC(device="/dev/usbtmc0")
self.power_meter = ThorlabsPM100(inst=self.inst)
self.set_state(DevState.ON)

def read_wavelength(self):
return self.power_meter.sense.correction.wavelength

def write_wavelength(self, wav):
self.wavelength = wav
self.power_meter.sense.correction.wavelength = wav

def read_power(self):
return self.power_meter.read


if __name__ == "__main__":
PM100.run_server()


0 comments on commit 1b23cf0

Please sign in to comment.