BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
microscope.controllers.coolled._CoolLEDConnection Class Reference

Public Member Functions

None __init__ (self, microscope._utils.SharedSerial serial)
 
bytes get_css (self)
 
None set_css (self, bytes css)
 
typing.List[str] get_channels (self)
 

Protected Attributes

 _serial = serial
 

Detailed Description

Connection to the CoolLED controller, wraps base commands.

Definition at line 36 of file coolled.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.controllers.coolled._CoolLEDConnection.__init__ ( self,
microscope._utils.SharedSerial serial )

Definition at line 39 of file coolled.py.

39 def __init__(self, serial: microscope._utils.SharedSerial) -> None:
40 self._serial = serial
41
42 # When we connect for the first time, we will get back a
43 # greeting message like 'CoolLED precisExcite, Hello, pleased
44 # to meet you'. Discard it by reading until timeout.
45 self._serial.readlines()
46
47 # Check that this behaves like a CoolLED device.
48 try:
49 self.get_css()
50 except Exception:
52 "Not a CoolLED device, unable to get CSS"
53 )
54

Member Function Documentation

◆ get_channels()

typing.List[str] microscope.controllers.coolled._CoolLEDConnection.get_channels ( self)
Return list of channel names (names are one character string).

Definition at line 79 of file coolled.py.

79 def get_channels(self) -> typing.List[str]:
80 """Return list of channel names (names are one character string)."""
81 # answer has the form: [xsnNNN] per channel. The letter 'x'
82 # defines the channel (A to H), 's' refers to S (Selected) or
83 # X (Not selected), 'n' refers to N (On) or F (Off) and 'NNN'
84 # is the intensity in integer percent.
85 return list(self.get_css()[::6].decode())
86
87

◆ get_css()

bytes microscope.controllers.coolled._CoolLEDConnection.get_css ( self)
Get the global channel status map.

Definition at line 55 of file coolled.py.

55 def get_css(self) -> bytes:
56 """Get the global channel status map."""
57 with self._serial.lock:
58 self._serial.write(b"CSS?\n")
59 answer = self._serial.readline()
60 if not answer.startswith(b"CSS"):
62 "answer to 'CSS?' should start with 'CSS'"
63 " but got '%s' instead" % answer.decode
64 )
65 return answer[3:-2] # remove initial b'CSS' and final b'\r\n'
66

◆ set_css()

None microscope.controllers.coolled._CoolLEDConnection.set_css ( self,
bytes css )
Set status for any number of channels.

Definition at line 67 of file coolled.py.

67 def set_css(self, css: bytes) -> None:
68 """Set status for any number of channels."""
69 assert len(css) % 6 == 0, "css must be multiple of 6 (6 per channel)"
70 with self._serial.lock:
71 self._serial.write(b"CSS" + css + b"\n")
72 answer = self._serial.readline()
73 if not answer.startswith(b"CSS"):
75 "answer to 'CSS?' should start with 'CSS'"
76 " but got '%s' instead" % answer.decode
77 )
78

Member Data Documentation

◆ _serial

microscope.controllers.coolled._CoolLEDConnection._serial = serial
protected

Definition at line 40 of file coolled.py.


The documentation for this class was generated from the following file: