BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope.controllers.zaber._ZaberDeviceConnection Class Reference

Public Member Functions

None __init__ (self, _ZaberConnection conn, int device_address)
 
_ZaberReply command (self, bytes command, int axis=0)
 
bool is_busy (self)
 
None wait_until_idle (self, float timeout=10.0)
 
int get_number_axes (self)
 
bool been_homed (self, int axis=0)
 
None home (self, int axis=0)
 
int get_rotation_length (self, int axis)
 
int get_index_distance (self, int axis)
 
int get_current_index (self, int axis)
 
None move_to_index (self, int axis, int index)
 
None move_to_absolute_position (self, int axis, int position)
 
None move_by_relative_position (self, int axis, int position)
 
int get_absolute_position (self, int axis)
 
int get_limit_max (self, int axis)
 
int get_limit_min (self, int axis)
 
None lamp_off (self, int channel)
 
None lamp_on (self, int channel)
 
float get_lamp_max_flux (self, int channel)
 
float get_lamp_flux (self, int channel)
 
None set_lamp_flux (self, int channel, float flux)
 
bool get_lamp_is_on (self, int channel)
 
float get_lamp_temperature (self, int channel)
 

Detailed Description

A Zaber connection to control a single device.

This class provides a Python interface to the Zaber commands.  It
also does the routing of commands to the correct device in the
chain.

Args:
    conn: the :class:`_ZaberConnection` instance for this device.
    device_address: the device address for the specific device.
        This is the number used at the start of all Zaber
        commands.

Definition at line 159 of file zaber.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.controllers.zaber._ZaberDeviceConnection.__init__ (   self,
_ZaberConnection  conn,
int  device_address 
)

Definition at line 173 of file zaber.py.

173 def __init__(self, conn: _ZaberConnection, device_address: int) -> None:
174 self._conn = conn
175 self._address_bytes = b"%02d" % device_address
176

Member Function Documentation

◆ been_homed()

bool microscope.controllers.zaber._ZaberDeviceConnection.been_homed (   self,
int   axis = 0 
)
True if all axes, or selected axis, has been homed.

Definition at line 231 of file zaber.py.

231 def been_homed(self, axis: int = 0) -> bool:
232 """True if all axes, or selected axis, has been homed."""
233 reply = self.command(b"get limit.home.triggered", axis)
234 return all([int(x) for x in reply.response.split()])
235

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ command()

_ZaberReply microscope.controllers.zaber._ZaberDeviceConnection.command (   self,
bytes  command,
int   axis = 0 
)
Send command and return reply.

Args:
    command: a bytes array with the command and its
        parameters.
    axis: the axis number to send the command.  If zero, the
        command is executed by all axis in the device.

Definition at line 189 of file zaber.py.

189 def command(self, command: bytes, axis: int = 0) -> _ZaberReply:
190 """Send command and return reply.
191
192 Args:
193 command: a bytes array with the command and its
194 parameters.
195 axis: the axis number to send the command. If zero, the
196 command is executed by all axis in the device.
197 """
198 # We do not need to check whether axis number is valid because
199 # the device will reject the command with BADAXIS if so.
200 with self._conn.lock:
201 self._conn.write(
202 b"/%s %1d %s\n" % (self._address_bytes, axis, command)
203 )
204 data = self._conn.readline()
205 reply = _ZaberReply(data)
206 self._validate_reply(reply)
207 return reply
208

References microscope.controllers.zaber._ZaberDeviceConnection._address_bytes, microscope.controllers.coolled._CoolLEDChannelConnection._conn, microscope.controllers.coolled._CoolLEDChannel._conn, microscope.controllers.lumencor._LightChannelConnection._conn, microscope.controllers.lumencor._SpectraIIILightChannel._conn, microscope.controllers.prior.ProScanIII._conn, microscope.controllers.prior._ProScanIIIFilterWheel._conn, microscope.controllers.toptica._iChromeLaserConnection._conn, microscope.controllers.toptica._iChromeLaser._conn, microscope.controllers.zaber._ZaberDeviceConnection._conn, microscope.controllers.zaber.ZaberDaisyChain._conn, microscope.lights.toptica.TopticaiBeam._conn, microscope.stages.ludl.ludlMC2000._conn, microscope.controllers.zaber._ZaberDeviceConnection._validate_reply(), microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

Referenced by microscope.controllers.zaber._ZaberDeviceConnection.been_homed(), microscope.controllers.zaber._ZaberDeviceConnection.command(), microscope.controllers.zaber._ZaberDeviceConnection.get_absolute_position(), microscope.controllers.prior._ProScanIIIConnection.get_command(), microscope.stages.ludl._LudlController.get_command(), microscope.controllers.zaber._ZaberDeviceConnection.get_current_index(), microscope.controllers.prior._ProScanIIIConnection.get_description(), microscope.stages.ludl._LudlController.get_description(), microscope.controllers.zaber._ZaberDeviceConnection.get_index_distance(), microscope.controllers.zaber._ZaberDeviceConnection.get_limit_max(), microscope.controllers.zaber._ZaberDeviceConnection.get_limit_min(), microscope.controllers.zaber._ZaberDeviceConnection.get_number_axes(), microscope.controllers.zaber._ZaberDeviceConnection.get_rotation_length(), microscope.controllers.zaber._ZaberDeviceConnection.home(), microscope.lights.toptica._iBeamConnection.laser_off(), microscope.lights.toptica._iBeamConnection.laser_on(), microscope.lights.toptica._iBeamConnection.set_normal_channel_power(), microscope.lights.toptica._iBeamConnection.show_power_uW(), and microscope.lights.toptica._iBeamConnection.status_laser().

◆ get_absolute_position()

int microscope.controllers.zaber._ZaberDeviceConnection.get_absolute_position (   self,
int  axis 
)
Current absolute position of an axis, in microsteps.

Definition at line 265 of file zaber.py.

265 def get_absolute_position(self, axis: int) -> int:
266 """Current absolute position of an axis, in microsteps."""
267 return int(self.command(b"get pos", axis).response)
268

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_current_index()

int microscope.controllers.zaber._ZaberDeviceConnection.get_current_index (   self,
int  axis 
)
The current index number or zero if between index positions.

Definition at line 252 of file zaber.py.

252 def get_current_index(self, axis: int) -> int:
253 """The current index number or zero if between index positions."""
254 return int(self.command(b"get motion.index.num", axis).response)
255

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_index_distance()

int microscope.controllers.zaber._ZaberDeviceConnection.get_index_distance (   self,
int  axis 
)
The distance between consecutive index positions.

Definition at line 248 of file zaber.py.

248 def get_index_distance(self, axis: int) -> int:
249 """The distance between consecutive index positions."""
250 return int(self.command(b"get motion.index.dist", axis).response)
251

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_lamp_flux()

float microscope.controllers.zaber._ZaberDeviceConnection.get_lamp_flux (   self,
int  channel 
)

Definition at line 286 of file zaber.py.

286 def get_lamp_flux(self, channel: int) -> float:
287 return float(self.command(b"get lamp.flux", channel).response)
288

◆ get_lamp_is_on()

bool microscope.controllers.zaber._ZaberDeviceConnection.get_lamp_is_on (   self,
int  channel 
)

Definition at line 292 of file zaber.py.

292 def get_lamp_is_on(self, channel: int) -> bool:
293 return self.command(b"get lamp.status", channel).response == b"2"
294

◆ get_lamp_max_flux()

float microscope.controllers.zaber._ZaberDeviceConnection.get_lamp_max_flux (   self,
int  channel 
)

Definition at line 283 of file zaber.py.

283 def get_lamp_max_flux(self, channel: int) -> float:
284 return float(self.command(b"get lamp.flux.max", channel).response)
285

◆ get_lamp_temperature()

float microscope.controllers.zaber._ZaberDeviceConnection.get_lamp_temperature (   self,
int  channel 
)

Definition at line 295 of file zaber.py.

295 def get_lamp_temperature(self, channel: int) -> float:
296 return float(self.command(b"get lamp.temperature", channel).response)
297
298

◆ get_limit_max()

int microscope.controllers.zaber._ZaberDeviceConnection.get_limit_max (   self,
int  axis 
)
The maximum position the device can move to, in microsteps.

Definition at line 269 of file zaber.py.

269 def get_limit_max(self, axis: int) -> int:
270 """The maximum position the device can move to, in microsteps."""
271 return int(self.command(b"get limit.max", axis).response)
272

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_limit_min()

int microscope.controllers.zaber._ZaberDeviceConnection.get_limit_min (   self,
int  axis 
)
The minimum position the device can move to, in microsteps.

Definition at line 273 of file zaber.py.

273 def get_limit_min(self, axis: int) -> int:
274 """The minimum position the device can move to, in microsteps."""
275 return int(self.command(b"get limit.min", axis).response)
276

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_number_axes()

int microscope.controllers.zaber._ZaberDeviceConnection.get_number_axes (   self)
Reports the number of axes in the device.

Definition at line 227 of file zaber.py.

227 def get_number_axes(self) -> int:
228 """Reports the number of axes in the device."""
229 return int(self.command(b"get system.axiscount").response)
230

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ get_rotation_length()

int microscope.controllers.zaber._ZaberDeviceConnection.get_rotation_length (   self,
int  axis 
)
Number of microsteps needed to complete one full rotation.

This is only valid on controllers and rotary devices including
filter wheels and filter cube turrets.

Definition at line 240 of file zaber.py.

240 def get_rotation_length(self, axis: int) -> int:
241 """Number of microsteps needed to complete one full rotation.
242
243 This is only valid on controllers and rotary devices including
244 filter wheels and filter cube turrets.
245 """
246 return int(self.command(b"get limit.cycle.dist", axis).response)
247

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ home()

None microscope.controllers.zaber._ZaberDeviceConnection.home (   self,
int   axis = 0 
)
Move the axis to the home position.

Definition at line 236 of file zaber.py.

236 def home(self, axis: int = 0) -> None:
237 """Move the axis to the home position."""
238 self.command(b"home", axis)
239

References microscope.controllers.prior._ProScanIIIConnection.command(), microscope.lights.toptica._iBeamConnection.command(), microscope.stages.ludl._LudlController.command(), and microscope.controllers.zaber._ZaberDeviceConnection.command().

◆ is_busy()

bool microscope.controllers.zaber._ZaberDeviceConnection.is_busy (   self)

Definition at line 209 of file zaber.py.

209 def is_busy(self) -> bool:
210 return self.command(b"").status == b"BUSY"
211

Referenced by microscope.controllers.zaber._ZaberDeviceConnection.wait_until_idle().

◆ lamp_off()

None microscope.controllers.zaber._ZaberDeviceConnection.lamp_off (   self,
int  channel 
)

Definition at line 277 of file zaber.py.

277 def lamp_off(self, channel: int) -> None:
278 self.command(b"lamp off", channel)
279

◆ lamp_on()

None microscope.controllers.zaber._ZaberDeviceConnection.lamp_on (   self,
int  channel 
)

Definition at line 280 of file zaber.py.

280 def lamp_on(self, channel: int) -> None:
281 self.command(b"lamp on", channel)
282

◆ move_by_relative_position()

None microscope.controllers.zaber._ZaberDeviceConnection.move_by_relative_position (   self,
int  axis,
int  position 
)

Definition at line 262 of file zaber.py.

262 def move_by_relative_position(self, axis: int, position: int) -> None:
263 self.command(b"move rel %d" % position, axis)
264

◆ move_to_absolute_position()

None microscope.controllers.zaber._ZaberDeviceConnection.move_to_absolute_position (   self,
int  axis,
int  position 
)

Definition at line 259 of file zaber.py.

259 def move_to_absolute_position(self, axis: int, position: int) -> None:
260 self.command(b"move abs %d" % position, axis)
261

◆ move_to_index()

None microscope.controllers.zaber._ZaberDeviceConnection.move_to_index (   self,
int  axis,
int  index 
)

Definition at line 256 of file zaber.py.

256 def move_to_index(self, axis: int, index: int) -> None:
257 self.command(b"move index %d" % index, axis)
258

◆ set_lamp_flux()

None microscope.controllers.zaber._ZaberDeviceConnection.set_lamp_flux (   self,
int  channel,
float  flux 
)

Definition at line 289 of file zaber.py.

289 def set_lamp_flux(self, channel: int, flux: float) -> None:
290 self.command(b"set lamp.flux %.3f" % flux, channel)
291

◆ wait_until_idle()

None microscope.controllers.zaber._ZaberDeviceConnection.wait_until_idle (   self,
float   timeout = 10.0 
)
Wait, or error, until device is idle.

A device is busy if *any* of its axis is busy.

Definition at line 212 of file zaber.py.

212 def wait_until_idle(self, timeout: float = 10.0) -> None:
213 """Wait, or error, until device is idle.
214
215 A device is busy if *any* of its axis is busy.
216 """
217 sleep_interval = 0.1
218 for _ in range(int(timeout / sleep_interval)):
219 if not self.is_busy():
220 break
221 time.sleep(sleep_interval)
222 else:
224 "device still busy after %f seconds" % timeout
225 )
226

References microscope.controllers.zaber._ZaberDeviceConnection.is_busy(), and microscope.stages.ludl._LudlController.is_busy().


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