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.cameras.atmcd.AndorAtmcd Class Reference
Inheritance diagram for microscope.cameras.atmcd.AndorAtmcd:
microscope.abc.FloatingDeviceMixin microscope.abc.Camera microscope.abc.TriggerTargetMixin microscope.abc.DataDevice microscope.abc.Device

Public Member Functions

def __init__ (self, index=0, **kwargs)
 
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_value, traceback)
 
def abort (self)
 
def initialize (self)
 
def get_id (self)
 
def set_exposure_time (self, value)
 
def get_exposure_time (self)
 
def get_cycle_time (self)
 
def soft_trigger (self)
 
microscope.TriggerMode trigger_mode (self)
 
microscope.TriggerType trigger_type (self)
 
None set_trigger (self, microscope.TriggerType ttype, microscope.TriggerMode tmode)
 
None __init__ (self, int index, **kwargs)
 
str get_id (self)
 
- Public Member Functions inherited from microscope.abc.Camera
None __init__ (self, **kwargs)
 
def set_readout_mode (self, description)
 
def get_transform (self)
 
def set_transform (self, transform)
 
None set_exposure_time (self, float value)
 
float get_exposure_time (self)
 
float get_cycle_time (self)
 
typing.Tuple[int, int] get_sensor_shape (self)
 
microscope.Binning get_binning (self)
 
None set_binning (self, microscope.Binning binning)
 
microscope.ROI get_roi (self)
 
None set_roi (self, microscope.ROI roi)
 
- Public Member Functions inherited from microscope.abc.TriggerTargetMixin
microscope.TriggerMode trigger_mode (self)
 
microscope.TriggerType trigger_type (self)
 
None set_trigger (self, microscope.TriggerType ttype, microscope.TriggerMode tmode)
 
None trigger (self)
 
- Public Member Functions inherited from microscope.abc.DataDevice
None __init__ (self, int buffer_length=0, **kwargs)
 
def __del__ (self)
 
None abort (self)
 
None enable (self)
 
None disable (self)
 
None set_client (self, new_client)
 
None update_settings (self, settings, bool init=False)
 
None receiveClient (self, str client_uri)
 
def grab_next_data (self, bool soft_trigger=True)
 
None receiveData (self, data, timestamp)
 
- Public Member Functions inherited from microscope.abc.Device
None __init__ (self)
 
None __del__ (self)
 
bool get_is_enabled (self)
 
None disable (self)
 
None enable (self)
 
None initialize (self)
 
None shutdown (self)
 
None add_setting (self, name, dtype, get_func, set_func, values, typing.Optional[typing.Callable[[], bool]] readonly=None)
 
def get_setting (self, str name)
 
def get_all_settings (self)
 
None set_setting (self, str name, value)
 
def describe_setting (self, str name)
 
def describe_settings (self)
 
def update_settings (self, incoming, bool init=False)
 

Public Attributes

 amplifiers
 
- Public Attributes inherited from microscope.abc.DataDevice
 enabled
 
- Public Attributes inherited from microscope.abc.Device
 enabled
 

Additional Inherited Members

- Static Public Attributes inherited from microscope.abc.Camera
list ALLOWED_TRANSFORMS = [p for p in itertools.product(*3 * [[False, True]])]
 
- Static Public Attributes inherited from microscope.abc.DataDevice
 set_setting = keep_acquiring(Device.set_setting)
 

Detailed Description

Implements CameraDevice interface for Andor ATMCD library.

Definition at line 1364 of file atmcd.py.

Constructor & Destructor Documentation

◆ __init__()

def microscope.cameras.atmcd.AndorAtmcd.__init__ (   self,
  index = 0,
**  kwargs 
)

Reimplemented from microscope.abc.FloatingDeviceMixin.

Definition at line 1370 of file atmcd.py.

1370 def __init__(self, index=0, **kwargs):
1371 super().__init__(index=index, **kwargs)
1372 # Recursion depth for context manager behaviour.
1373 self._rdepth = 0
1374 # The handle used by the DLL to identify this camera.
1375 self._handle = None
1376 # The following parameters will be populated after hardware init.
1377 self._roi = None
1378 self._binning = None
1379 self.initialize()
1380

Member Function Documentation

◆ __enter__()

def microscope.cameras.atmcd.AndorAtmcd.__enter__ (   self)
Context manager entry code.

The camera class is also a context manager that ensures DLL calls act
on this camera by obtaining the _dll_lock.

We could use RLock to give re-entrant behaviour, but we track recursion
ourselves so that we know when we must call SetCurrentCamera.

Definition at line 1391 of file atmcd.py.

1391 def __enter__(self):
1392 """Context manager entry code.
1393
1394 The camera class is also a context manager that ensures DLL calls act
1395 on this camera by obtaining the _dll_lock.
1396
1397 We could use RLock to give re-entrant behaviour, but we track recursion
1398 ourselves so that we know when we must call SetCurrentCamera.
1399 """
1400 if self._rdepth == 0:
1401 _dll_lock.acquire()
1402 SetCurrentCamera(self._handle)
1403 self._rdepth += 1
1404

References microscope.cameras.atmcd.AndorAtmcd._handle, microscope.cameras.ximea.XimeaCamera._handle, and microscope.cameras.atmcd.AndorAtmcd._rdepth.

◆ __exit__()

def microscope.cameras.atmcd.AndorAtmcd.__exit__ (   self,
  exc_type,
  exc_value,
  traceback 
)
Context manager exit code.

Definition at line 1405 of file atmcd.py.

1405 def __exit__(self, exc_type, exc_value, traceback):
1406 """Context manager exit code."""
1407 self._rdepth -= 1
1408 if self._rdepth == 0:
1409 _dll_lock.release()
1410

References microscope.cameras.atmcd.AndorAtmcd._rdepth.

◆ abort()

def microscope.cameras.atmcd.AndorAtmcd.abort (   self)
Abort acquisition.

Reimplemented from microscope.abc.DataDevice.

Definition at line 1424 of file atmcd.py.

1424 def abort(self):
1425 """Abort acquisition."""
1426 _logger.debug("Disabling acquisition.")
1427 try:
1428 with self:
1429 AbortAcquisition()
1430 except AtmcdException as e:
1431 if e.status != DRV_IDLE:
1432 raise
1433

Referenced by microscope.simulators.SimulatedCamera.abort(), microscope.cameras.andorsdk3.AndorSDK3.get_id(), microscope.cameras.atmcd.AndorAtmcd.get_id(), microscope.cameras.picam.PiCamera.initialize(), microscope.cameras.ximea.XimeaCamera.initialize(), microscope.cameras.andorsdk3.AndorSDK3.set_trigger(), and microscope.abc.Device.update_settings().

◆ get_cycle_time()

def microscope.cameras.atmcd.AndorAtmcd.get_cycle_time (   self)
Determine the minimum time between exposures.

Reimplemented from microscope.abc.Camera.

Definition at line 1717 of file atmcd.py.

1717 def get_cycle_time(self):
1718 """Determine the minimum time between exposures."""
1719 with self:
1720 exposure, accumulate, kinetic = GetAcquisitionTimings()
1721 readout = GetReadOutTime()
1722 # IMD 20210422 DeepSIM timing is wrong as the keepclear cycles are
1723 # not accounted for.
1724 # return exposure + readout
1725 # This appears to allow the correct time between trigger pulses.
1726 return kinetic
1727

References microscope.abc.Camera._readout_modes, microscope.cameras.atmcd.AndorAtmcd._readout_modes, and microscope.cameras.pvcam.PVCamera._readout_modes.

◆ get_exposure_time()

def microscope.cameras.atmcd.AndorAtmcd.get_exposure_time (   self)
Query the actual exposure time.

Reimplemented from microscope.abc.Camera.

Definition at line 1711 of file atmcd.py.

1711 def get_exposure_time(self):
1712 """Query the actual exposure time."""
1713 with self:
1714 exposure, accumulate, kinetic = GetAcquisitionTimings()
1715 return exposure
1716

◆ get_id()

◆ initialize()

def microscope.cameras.atmcd.AndorAtmcd.initialize (   self)
Initialize the library and hardware and create Setting objects.

Reimplemented from microscope.abc.Device.

Definition at line 1442 of file atmcd.py.

1442 def initialize(self):
1443 """Initialize the library and hardware and create Setting objects."""
1444 _logger.info("Initializing ...")
1445 num_cams = GetAvailableCameras()
1446 if self._index >= num_cams:
1447 msg = "Requested camera %d, but only found %d cameras" % (
1448 self._index,
1449 num_cams,
1450 )
1452 self._handle = GetCameraHandle(self._index)
1453
1454 with self:
1455 # Initialize the library and connect to camera.
1456 Initialize(b"")
1457 # Initialise ROI to full sensor area and binning to single-pixel.
1458 self._set_roi(microscope.ROI(0, 0, 0, 0))
1459 self._set_binning(microscope.Binning(1, 1))
1460 # Check info bits to see if initialization successful.
1461 info = GetCameraInformation(self._index)
1462 if not info & 1 << 2:
1463 raise microscope.InitialiseError("... initialization failed.")
1464 self._caps = GetCapabilities()
1465 model = GetHeadModel()
1466 serial = self.get_id()
1467 # Populate amplifiers
1468 if GetNumberAmp() > 1:
1469 if self._caps.ulCameraType == AC_CAMERATYPE_CLARA:
1470 self.amplifiers = IntEnum(
1471 "Amplifiers",
1472 (("CONVENTIONAL", 0), ("EXTENDED_NIR", 1)),
1473 )
1474 else:
1475 self.amplifiers = IntEnum(
1476 "Amplifiers", (("EMCCD", 0), ("CONVENTIONAL", 1))
1477 )
1478 # Populate readout modes
1479 self._readout_modes = []
1480 for ch in range(GetNumberADChannels()):
1481 for amp in self.amplifiers:
1482 for s in range(GetNumberHSSpeeds(ch, amp.value)):
1483 speed = GetHSSpeed(ch, amp.value, s)
1484 self._readout_modes.append(
1485 ReadoutMode(ch, amp, s, speed)
1486 )
1487 _logger.info("... initilized %s s/n %s", model, serial)
1488 # Add settings. Some are write-only, so we set defaults here.
1489 # Mode
1490 name = "readout mode"
1491 if self._readout_modes:
1492 self.add_setting(
1493 name,
1494 "enum",
1495 None,
1496 self._set_readout_mode,
1497 lambda: [str(mode) for mode in self._readout_modes],
1498 )
1499 self.set_setting(name, 0)
1500 # TriggerMode
1501 name = "TriggerMode"
1502 self.add_setting(
1503 name, "enum", None, self._bind(SetTriggerMode), TriggerMode
1504 )
1505 if self._caps.ulTriggerModes & AC_TRIGGERMODE_EXTERNAL:
1506 self.set_setting(name, TriggerMode.EXTERNAL)
1507 elif self._caps.ulTriggerModes & AC_TRIGGERMODE_CONTINUOUS:
1508 self.set_setting(name, TriggerMode.SOFTWARE)
1509 # Gain - device will use either EMGain or MCPGain
1510 name = "gain"
1511 getter, setter, vrange = None, None, None
1512 if self._caps.ulGetFunctions & AC_GETFUNCTION_EMCCDGAIN:
1513 getter = self._bind(GetEMCCDGain)
1514 elif self._caps.ulGetFunctions & AC_GETFUNCTION_MCPGAIN:
1515 getter = self._bind(GetMCPGain)
1516 if self._caps.ulSetFunctions & AC_SETFUNCTION_EMCCDGAIN:
1517 setter = self._bind(SetEMCCDGain)
1518 vrange = self._bind(GetEMGainRange)
1519 elif self._caps.ulSetFunctions & AC_SETFUNCTION_MCPGAIN:
1520 setter = self._bind(SetMCPGain)
1521 vrange = self._bind(GetMCPGainRange)
1522 if getter or setter:
1523 self.add_setting(name, "int", getter, setter, vrange)
1524 # Temperature
1525 name = "TemperatureSetPoint"
1526 getter, setter, vrange = None, None, None
1527 if self._caps.ulSetFunctions & AC_SETFUNCTION_TEMPERATURE:
1528 setter = self._bind(SetTemperature)
1529 if self._caps.ulGetFunctions & AC_GETFUNCTION_TEMPERATURERANGE:
1530 vrange = self._bind(GetTemperatureRange)
1531 if setter:
1532 self.add_setting(name, "int", None, setter, vrange)
1533 # Set a conservative default temperature set-point.
1534 self.set_setting(name, -20)
1535 # Fan control
1536 name = "Temperature"
1537 self.add_setting(
1538 name, "int", self._get_sensor_temperature, None, (None, None)
1539 )
1540 name = "Fan mode"
1541 self.add_setting(
1542 name,
1543 "enum",
1544 None, # Can't query fan mode
1545 self._bind(SetFanMode),
1546 {0: "full", 1: "low", 2: "off"},
1547 )
1548 # Cooler control
1549 name = "Cooler Enabled"
1550 self.add_setting(name, "bool", None, self._set_cooler_state, None)
1551 self.set_setting(name, True)
1552 # Binning
1553 name = "Binning"
1554 self.add_setting(
1555 name, "tuple", self.get_binning, self.set_binning, None
1556 )
1557 # Roi
1558 name = "Roi"
1559 self.add_setting(
1560 name, "tuple", self.get_roi, lambda roi: self.set_roi(*roi), None
1561 )
1562 # BaselineClamp
1563 name = "BaselineClamp"
1564 if self._caps.ulSetFunctions & AC_SETFUNCTION_BASELINECLAMP:
1565 self.add_setting(
1566 name, "bool", None, self._bind(SetBaselineClamp), None
1567 )
1568 self.set_setting(name, False)
1569 # BaselineOffset
1570 name = "BaselineOffset"
1571 if self._caps.ulSetFunctions & AC_SETFUNCTION_BASELINEOFFSET:
1572 self.add_setting(
1573 name, "int", None, self._bind(SetBaselineOffset), (-1000, 1000)
1574 )
1575 self.set_setting(name, 0)
1576 # EMAdvanced
1577 name = "EMAdvanced"
1578 if self._caps.ulSetFunctions & AC_SETFUNCTION_EMADVANCED:
1579 self.add_setting(
1580 name, "bool", None, self._bind(SetEMAdvanced), None
1581 )
1582 self.set_setting(name, False)
1583 # GateMode
1584 name = "GateMode"
1585 if self._caps.ulSetFunctions & AC_SETFUNCTION_GATEMODE:
1586 vrange = range(
1587 0, [5, 6][self._caps.ulCameraType & AC_CAMERATYPE_ISTAR]
1588 )
1589 self.add_setting(
1590 name, "int", None, self._bind(SetGateMode), vrange
1591 )
1592 # HighCapacity
1593 name = "HighCapacity"
1594 if self._caps.ulSetFunctions & AC_SETFUNCTION_HIGHCAPACITY:
1595 self.add_setting(
1596 name, "bool", None, self._bind(SetHighCapacity), None
1597 )
1598

References microscope.cameras.atmcd.AndorAtmcd._bind(), microscope.cameras.atmcd.AndorAtmcd._binning, microscope.cameras.ximea.XimeaCamera._binning, microscope.simulators.SimulatedCamera._binning, microscope.cameras.atmcd.AndorAtmcd._caps, microscope.cameras.atmcd.AndorAtmcd._get_sensor_temperature(), microscope.cameras.atmcd.AndorAtmcd._handle, microscope.cameras.ximea.XimeaCamera._handle, microscope.abc.FloatingDeviceMixin._index, microscope.abc.Camera._readout_modes, microscope.cameras.atmcd.AndorAtmcd._readout_modes, microscope.cameras.pvcam.PVCamera._readout_modes, microscope.cameras.atmcd.AndorAtmcd._roi, microscope.cameras.ximea.XimeaCamera._roi, microscope.simulators.SimulatedCamera._roi, microscope.cameras.andorsdk3.AndorSDK3._set_binning(), microscope.cameras.atmcd.AndorAtmcd._set_binning(), microscope.cameras.pvcam.PVCamera._set_binning(), microscope.simulators.SimulatedCamera._set_binning(), microscope.cameras.picam.PiCamera._set_binning(), microscope.abc.Camera._set_binning(), microscope.cameras.ximea.XimeaCamera._set_binning(), microscope.cameras.atmcd.AndorAtmcd._set_cooler_state(), microscope.cameras.atmcd.AndorAtmcd._set_readout_mode(), microscope.cameras.picam.PiCamera._set_roi(), microscope.abc.Camera._set_roi(), microscope.cameras.ximea.XimeaCamera._set_roi(), microscope.cameras.andorsdk3.AndorSDK3._set_roi(), microscope.cameras.atmcd.AndorAtmcd._set_roi(), microscope.cameras.pvcam.PVCamera._set_roi(), microscope.simulators.SimulatedCamera._set_roi(), microscope.abc.Device.add_setting(), microscope.cameras.atmcd.AndorAtmcd.amplifiers, microscope.abc.Camera.get_binning(), microscope.abc.FloatingDeviceMixin.get_id(), microscope.cameras.andorsdk3.AndorSDK3.get_id(), microscope.cameras.atmcd.AndorAtmcd.get_id(), microscope.cameras.pvcam.PVCamera.get_id(), microscope.filterwheels.aurox.Clarity.get_id(), microscope.stages.linkam._LinkamBase.get_id(), microscope.testsuite.devices.TestFloatingDevice.get_id(), microscope.abc.Camera.get_roi(), microscope.abc.Camera.set_binning(), microscope.abc.Camera.set_roi(), microscope.abc.Device.set_setting(), and microscope.abc.DataDevice.set_setting.

Referenced by microscope.cameras.picam.PiCamera.__init__(), microscope.cameras.ximea.XimeaCamera.__init__(), and microscope.cameras.picam.PiCamera.initialize().

◆ set_exposure_time()

def microscope.cameras.atmcd.AndorAtmcd.set_exposure_time (   self,
  value 
)
Set exposure time.

Reimplemented from microscope.abc.Camera.

Definition at line 1706 of file atmcd.py.

1706 def set_exposure_time(self, value):
1707 """Set exposure time."""
1708 with self:
1709 SetExposureTime(value)
1710

◆ set_trigger()

None microscope.cameras.atmcd.AndorAtmcd.set_trigger (   self,
microscope.TriggerType  ttype,
microscope.TriggerMode   tmode 
)

◆ soft_trigger()

def microscope.cameras.atmcd.AndorAtmcd.soft_trigger (   self)
Send a software trigger signal.

Deprecated, use trigger().

Definition at line 1752 of file atmcd.py.

1752 def soft_trigger(self):
1753 """Send a software trigger signal.
1754
1755 Deprecated, use trigger().
1756 """
1757 with self:
1758 SendSoftwareTrigger()
1759

References microscope.abc.Device.get_setting(), and microscope.abc.TriggerTargetMixin.trigger().

Referenced by microscope.cameras.picam.PiCamera.get_cycle_time().

◆ trigger_mode()

microscope.TriggerMode microscope.cameras.atmcd.AndorAtmcd.trigger_mode (   self)

Reimplemented from microscope.abc.TriggerTargetMixin.

Definition at line 1761 of file atmcd.py.

1761 def trigger_mode(self) -> microscope.TriggerMode:
1762 return ATMCD_MODE_TO_TRIGGER[self.get_setting("TriggerMode")][1]
1763

Referenced by microscope.cameras.picam.PiCamera.__init__(), and microscope.cameras.ximea.XimeaCamera.__init__().

◆ trigger_type()

microscope.TriggerType microscope.cameras.atmcd.AndorAtmcd.trigger_type (   self)

Reimplemented from microscope.abc.TriggerTargetMixin.

Definition at line 1765 of file atmcd.py.

1765 def trigger_type(self) -> microscope.TriggerType:
1766 return ATMCD_MODE_TO_TRIGGER[self.get_setting("TriggerMode")][0]
1767

Referenced by microscope.cameras.ximea.XimeaCamera.__init__(), microscope.abc.DeformableMirror.apply_pattern(), and microscope.abc.TriggerTargetMixin.trigger().

Member Data Documentation

◆ amplifiers

microscope.cameras.atmcd.AndorAtmcd.amplifiers

Definition at line 1470 of file atmcd.py.

Referenced by microscope.cameras.atmcd.AndorAtmcd.initialize().


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