24"""This module wraps Andor's SDK for (EM)CCD cameras.
26Example deviceserver entry::
30 device(atmcd.AndorAtmcd,
"127.0.0.1", 8000, uid=
"VSC-01234")
33Tested against Ixon Ultra
with atmcd64d.dll ver 2.97.30007.0.
60from enum
import Enum, IntEnum
61from threading
import Lock
64from numpy.ctypeslib
import ndpointer
70_logger = logging.getLogger(__name__)
76 from ctypes.wintypes
import BYTE, DWORD, HANDLE, WORD
80 WORD = ctypes.c_ushort
81 DWORD = ctypes.c_ulong
82 HANDLE = ctypes.c_void_p
84_stdcall_libraries = {}
85arch, plat = platform.architecture()
90if os.name
in (
"nt",
"ce"):
91 _dll = ctypes.WinDLL(_dllName)
93 _dll = ctypes.CDLL(_dllName +
".so")
101"""Version Information Definitions"""
110AT_NoOfVersionInfoIds = 2
112AT_VERSION_INFO_LEN = 80
114AT_CONTROLLER_CARD_MODEL_LEN = 80
116"""DDG Lite Definitions"""
126AT_DDGLite_ControlBit_GlobalEnable = 0x01
127AT_DDGLite_ControlBit_ChannelEnable = 0x01
128AT_DDGLite_ControlBit_FreeRun = 0x02
129AT_DDGLite_ControlBit_DisableOnFrame = 0x04
130AT_DDGLite_ControlBit_RestartOnFire = 0x08
131AT_DDGLite_ControlBit_Invert = 0x10
132AT_DDGLite_ControlBit_EnableOnFire = 0x20
134"""USB iStar Definitions"""
136AT_DDG_POLARITY_POSITIVE = 0
137AT_DDG_POLARITY_NEGATIVE = 1
138AT_DDG_TERMINATION_50OHMS = 0
139AT_DDG_TERMINATION_HIGHZ = 1
141AT_STEPMODE_CONSTANT = 0
142AT_STEPMODE_EXPONENTIAL = 1
143AT_STEPMODE_LOGARITHMIC = 2
144AT_STEPMODE_LINEAR = 3
147AT_GATEMODE_FIRE_AND_GATE = 0
148AT_GATEMODE_FIRE_ONLY = 1
149AT_GATEMODE_GATE_ONLY = 2
151AT_GATEMODE_CW_OFF = 4
161 (
"ulAcqModes", c_ulong),
162 (
"ulReadModes", c_ulong),
163 (
"ulTriggerModes", c_ulong),
164 (
"ulCameraType", c_ulong),
165 (
"ulPixelMode", c_ulong),
166 (
"ulSetFunctions", c_ulong),
167 (
"ulGetFunctions", c_ulong),
168 (
"ulFeatures", c_ulong),
169 (
"ulPCICard", c_ulong),
170 (
"ulEMGainCapability", c_ulong),
171 (
"ulFTReadModes", c_ulong),
177 self.
ulSize = ctypes.sizeof(self)
180AndorCapabilities = ANDORCAPS
187 (
"iAlgorithm", c_int),
190 (
"iBackground", c_int),
194ColorDemosaicInfo = COLORDEMOSAICINFO
201 (
"wDayOfWeek", WORD),
206 (
"wMilliseconds", WORD),
215 (
"iAlgorithm", c_int),
216 (
"iROI_left", c_int),
217 (
"iROI_right", c_int),
219 (
"iROI_bottom", c_int),
220 (
"iOperation", c_int),
224WhiteBalanceInfo = WHITEBALANCEINFO
229DRV_ERROR_CODES = 20001
231DRV_VXDNOTINSTALLED = 20003
232DRV_ERROR_SCAN = 20004
233DRV_ERROR_CHECK_SUM = 20005
234DRV_ERROR_FILELOAD = 20006
235DRV_UNKNOWN_FUNCTION = 20007
236DRV_ERROR_VXD_INIT = 20008
237DRV_ERROR_ADDRESS = 20009
238DRV_ERROR_PAGELOCK = 20010
239DRV_ERROR_PAGEUNLOCK = 20011
240DRV_ERROR_BOARDTEST = 20012
242DRV_ERROR_UP_FIFO = 20014
243DRV_ERROR_PATTERN = 20015
244DRV_ACQUISITION_ERRORS = 20017
245DRV_ACQ_BUFFER = 20018
246DRV_ACQ_DOWNFIFO_FULL = 20019
247DRV_PROC_UNKONWN_INSTRUCTION = 20020
248DRV_ILLEGAL_OP_CODE = 20021
249DRV_KINETIC_TIME_NOT_MET = 20022
250DRV_ACCUM_TIME_NOT_MET = 20023
251DRV_NO_NEW_DATA = 20024
252DRV_PCI_DMA_FAIL = 20025
253DRV_SPOOLERROR = 20026
254DRV_SPOOLSETUPERROR = 20027
255DRV_FILESIZELIMITERROR = 20028
256DRV_ERROR_FILESAVE = 20029
257DRV_TEMPERATURE_CODES = 20033
258DRV_TEMPERATURE_OFF = 20034
259DRV_TEMPERATURE_NOT_STABILIZED = 20035
260DRV_TEMPERATURE_STABILIZED = 20036
261DRV_TEMPERATURE_NOT_REACHED = 20037
262DRV_TEMPERATURE_OUT_RANGE = 20038
263DRV_TEMPERATURE_NOT_SUPPORTED = 20039
264DRV_TEMPERATURE_DRIFT = 20040
265DRV_TEMP_CODES = 20033
267DRV_TEMP_NOT_STABILIZED = 20035
268DRV_TEMP_STABILIZED = 20036
269DRV_TEMP_NOT_REACHED = 20037
270DRV_TEMP_OUT_RANGE = 20038
271DRV_TEMP_NOT_SUPPORTED = 20039
272DRV_TEMP_DRIFT = 20040
273DRV_GENERAL_ERRORS = 20049
274DRV_INVALID_AUX = 20050
275DRV_COF_NOTLOADED = 20051
279DRV_EEPROMVERSIONERROR = 20055
281DRV_DRIVER_ERRORS = 20065
291DRV_NOT_INITIALIZED = 20075
294DRV_INVALID_MODE = 20078
295DRV_INVALID_FILTER = 20079
297DRV_I2CDEVNOTFOUND = 20081
298DRV_I2CTIMEOUT = 20082
302DRV_P10INVALID = 20086
303DRV_P11INVALID = 20087
306DRV_VRMVERSIONERROR = 20091
307DRV_GATESTEPERROR = 20092
308DRV_USB_INTERRUPT_ENDPOINT_ERROR = 20093
309DRV_RANDOM_TRACK_ERROR = 20094
310DRV_INVALID_TRIGGER_MODE = 20095
311DRV_LOAD_FIRMWARE_ERROR = 20096
312DRV_DIVIDE_BY_ZERO_ERROR = 20097
313DRV_INVALID_RINGEXPOSURES = 20098
314DRV_BINNING_ERROR = 20099
315DRV_INVALID_AMPLIFIER = 20100
316DRV_INVALID_COUNTCONVERT_MODE = 20101
317DRV_ERROR_NOCAMERA = 20990
318DRV_NOT_SUPPORTED = 20991
319DRV_NOT_AVAILABLE = 20992
321DRV_ERROR_UNMAP = 20116
323DRV_ERROR_UNMDL = 20118
324DRV_ERROR_BUFFSIZE = 20119
325DRV_ERROR_NOHANDLE = 20121
326DRV_GATING_NOT_AVAILABLE = 20130
327DRV_FPGA_VOLTAGE_ERROR = 20131
328DRV_OW_CMD_FAIL = 20150
329DRV_OWMEMORY_BAD_ADDR = 20151
330DRV_OWCMD_NOT_AVAILABLE = 20152
331DRV_OW_NO_SLAVES = 20153
332DRV_OW_NOT_INITIALIZED = 20154
333DRV_OW_ERROR_SLAVE_NUM = 20155
334DRV_MSTIMINGS_ERROR = 20156
335DRV_OA_NULL_ERROR = 20173
336DRV_OA_PARSE_DTD_ERROR = 20174
337DRV_OA_DTD_VALIDATE_ERROR = 20175
338DRV_OA_FILE_ACCESS_ERROR = 20176
339DRV_OA_FILE_DOES_NOT_EXIST = 20177
340DRV_OA_XML_INVALID_OR_NOT_FOUND_ERROR = 20178
341DRV_OA_PRESET_FILE_NOT_LOADED = 20179
342DRV_OA_USER_FILE_NOT_LOADED = 20180
343DRV_OA_PRESET_AND_USER_FILE_NOT_LOADED = 20181
344DRV_OA_INVALID_FILE = 20182
345DRV_OA_FILE_HAS_BEEN_MODIFIED = 20183
346DRV_OA_BUFFER_FULL = 20184
347DRV_OA_INVALID_STRING_LENGTH = 20185
348DRV_OA_INVALID_CHARS_IN_NAME = 20186
349DRV_OA_INVALID_NAMING = 20187
350DRV_OA_GET_CAMERA_ERROR = 20188
351DRV_OA_MODE_ALREADY_EXISTS = 20189
352DRV_OA_STRINGS_NOT_EQUAL = 20190
353DRV_OA_NO_USER_DATA = 20191
354DRV_OA_VALUE_NOT_SUPPORTED = 20192
355DRV_OA_MODE_DOES_NOT_EXIST = 20193
356DRV_OA_CAMERA_NOT_SUPPORTED = 20194
357DRV_OA_FAILED_TO_GET_MODE = 20195
358DRV_PROCESSING_FAILED = 20211
363AC_ACQMODE_ACCUMULATE = 4
364AC_ACQMODE_KINETIC = 8
365AC_ACQMODE_FRAMETRANSFER = 16
366AC_ACQMODE_FASTKINETICS = 32
367AC_ACQMODE_OVERLAP = 64
368AC_READMODE_FULLIMAGE = 1
369AC_READMODE_SUBIMAGE = 2
370AC_READMODE_SINGLETRACK = 4
372AC_READMODE_MULTITRACK = 16
373AC_READMODE_RANDOMTRACK = 32
374AC_READMODE_MULTITRACKSCAN = 64
375AC_TRIGGERMODE_INTERNAL = 1
376AC_TRIGGERMODE_EXTERNAL = 2
377AC_TRIGGERMODE_EXTERNAL_FVB_EM = 4
378AC_TRIGGERMODE_CONTINUOUS = 8
379AC_TRIGGERMODE_EXTERNALSTART = 16
380AC_TRIGGERMODE_EXTERNALEXPOSURE = 32
381AC_TRIGGERMODE_INVERTED = 64
382AC_TRIGGERMODE_EXTERNAL_CHARGESHIFTING = 128
383AC_TRIGGERMODE_BULB = 32
385AC_CAMERATYPE_IXON = 1
386AC_CAMERATYPE_ICCD = 2
387AC_CAMERATYPE_EMCCD = 3
389AC_CAMERATYPE_ISTAR = 5
390AC_CAMERATYPE_VIDEO = 6
391AC_CAMERATYPE_IDUS = 7
392AC_CAMERATYPE_NEWTON = 8
393AC_CAMERATYPE_SURCAM = 9
394AC_CAMERATYPE_USBICCD = 10
395AC_CAMERATYPE_LUCA = 11
396AC_CAMERATYPE_RESERVED = 12
397AC_CAMERATYPE_IKON = 13
398AC_CAMERATYPE_INGAAS = 14
399AC_CAMERATYPE_IVAC = 15
400AC_CAMERATYPE_UNPROGRAMMED = 16
401AC_CAMERATYPE_CLARA = 17
402AC_CAMERATYPE_USBISTAR = 18
403AC_CAMERATYPE_SIMCAM = 19
404AC_CAMERATYPE_NEO = 20
405AC_CAMERATYPE_IXONULTRA = 21
406AC_CAMERATYPE_VOLMOS = 22
408AC_PIXELMODE_14BIT = 2
409AC_PIXELMODE_16BIT = 4
410AC_PIXELMODE_32BIT = 8
411AC_PIXELMODE_MONO = 0x000000
412AC_PIXELMODE_RGB = 0x010000
413AC_PIXELMODE_CMY = 0x020000
415AC_SETFUNCTION_VREADOUT = 0x01
416AC_SETFUNCTION_HREADOUT = 0x02
417AC_SETFUNCTION_TEMPERATURE = 0x04
418AC_SETFUNCTION_MCPGAIN = 0x08
419AC_SETFUNCTION_EMCCDGAIN = 0x10
420AC_SETFUNCTION_BASELINECLAMP = 0x20
421AC_SETFUNCTION_VSAMPLITUDE = 0x40
422AC_SETFUNCTION_HIGHCAPACITY = 0x80
423AC_SETFUNCTION_BASELINEOFFSET = 0x0100
424AC_SETFUNCTION_PREAMPGAIN = 0x0200
425AC_SETFUNCTION_CROPMODE = 0x0400
426AC_SETFUNCTION_DMAPARAMETERS = 0x0800
427AC_SETFUNCTION_HORIZONTALBIN = 0x1000
428AC_SETFUNCTION_MULTITRACKHRANGE = 0x2000
429AC_SETFUNCTION_RANDOMTRACKNOGAPS = 0x4000
430AC_SETFUNCTION_EMADVANCED = 0x8000
431AC_SETFUNCTION_GATEMODE = 0x010000
432AC_SETFUNCTION_DDGTIMES = 0x020000
433AC_SETFUNCTION_IOC = 0x040000
434AC_SETFUNCTION_INTELLIGATE = 0x080000
435AC_SETFUNCTION_INSERTION_DELAY = 0x100000
436AC_SETFUNCTION_GATESTEP = 0x200000
437AC_SETFUNCTION_TRIGGERTERMINATION = 0x400000
438AC_SETFUNCTION_EXTENDEDNIR = 0x800000
439AC_SETFUNCTION_SPOOLTHREADCOUNT = 0x1000000
441AC_SETFUNCTION_GAIN = 8
442AC_SETFUNCTION_ICCDGAIN = 8
444AC_GETFUNCTION_TEMPERATURE = 0x01
445AC_GETFUNCTION_TARGETTEMPERATURE = 0x02
446AC_GETFUNCTION_TEMPERATURERANGE = 0x04
447AC_GETFUNCTION_DETECTORSIZE = 0x08
448AC_GETFUNCTION_MCPGAIN = 0x10
449AC_GETFUNCTION_EMCCDGAIN = 0x20
450AC_GETFUNCTION_HVFLAG = 0x40
451AC_GETFUNCTION_GATEMODE = 0x80
452AC_GETFUNCTION_DDGTIMES = 0x0100
453AC_GETFUNCTION_IOC = 0x0200
454AC_GETFUNCTION_INTELLIGATE = 0x0400
455AC_GETFUNCTION_INSERTION_DELAY = 0x0800
456AC_GETFUNCTION_GATESTEP = 0x1000
457AC_GETFUNCTION_PHOSPHORSTATUS = 0x2000
458AC_GETFUNCTION_MCPGAINTABLE = 0x4000
459AC_GETFUNCTION_BASELINECLAMP = 0x8000
461AC_GETFUNCTION_GAIN = 0x10
462AC_GETFUNCTION_ICCDGAIN = 0x10
464AC_FEATURES_POLLING = 1
465AC_FEATURES_EVENTS = 2
466AC_FEATURES_SPOOLING = 4
467AC_FEATURES_SHUTTER = 8
468AC_FEATURES_SHUTTEREX = 16
469AC_FEATURES_EXTERNAL_I2C = 32
470AC_FEATURES_SATURATIONEVENT = 64
471AC_FEATURES_FANCONTROL = 128
472AC_FEATURES_MIDFANCONTROL = 256
473AC_FEATURES_TEMPERATUREDURINGACQUISITION = 512
474AC_FEATURES_KEEPCLEANCONTROL = 1024
475AC_FEATURES_DDGLITE = 0x0800
476AC_FEATURES_FTEXTERNALEXPOSURE = 0x1000
477AC_FEATURES_KINETICEXTERNALEXPOSURE = 0x2000
478AC_FEATURES_DACCONTROL = 0x4000
479AC_FEATURES_METADATA = 0x8000
480AC_FEATURES_IOCONTROL = 0x10000
481AC_FEATURES_PHOTONCOUNTING = 0x20000
482AC_FEATURES_COUNTCONVERT = 0x40000
483AC_FEATURES_DUALMODE = 0x80000
484AC_FEATURES_OPTACQUIRE = 0x100000
485AC_FEATURES_REALTIMESPURIOUSNOISEFILTER = 0x200000
486AC_FEATURES_POSTPROCESSSPURIOUSNOISEFILTER = 0x400000
487AC_FEATURES_DUALPREAMPGAIN = 0x800000
488AC_FEATURES_DEFECT_CORRECTION = 0x1000000
489AC_FEATURES_STARTOFEXPOSURE_EVENT = 0x2000000
490AC_FEATURES_ENDOFEXPOSURE_EVENT = 0x4000000
491AC_FEATURES_CAMERALINK = 0x80000007108864
495AC_EMGAIN_LINEAR12 = 4
500for attrib_name
in dir(sys.modules[__name__]):
501 if attrib_name.startswith(
"DRV_"):
502 status_codes.update({eval(attrib_name): attrib_name})
505def lookup_status(code):
506 key = code[0]
if type(code)
is list
else code
507 if key
in status_codes:
508 return status_codes[key]
510 return "Unknown status code %s." % key
525 """Used to indicated output from a DLL call"""
527 def __init__(self, val):
529 self.
val = POINTER(val)
531 def getVar(self, bufLen=0):
533 return v, ctypes.byref(v)
537 """A special type of OUTPUT that creates an output buffer."""
542 def getVar(self, bufLen):
543 v = ctypes.create_string_buffer(bufLen)
551 """Used to mark call parameters that define a string buffer size."""
561 """Used for DLL call parameters that return an array."""
563 def __init__(self, val):
566 self.
valval = ndpointer(val, flags=
"C_CONTIGUOUS")
568 def getVar(self, size):
575 """Used to mark DLL call parameters that define array sizes."""
585 """Strips the outer metaclass to give the underlying data object."""
586 if isinstance(val, _meta):
592def extract_value(val):
593 """Calls .value on simple ctypes."""
609 elif isinstance(val, ctypes.Array)
and val._type_
is c_char:
610 return val.value.decode()
616 """An exception arising from a DLL call."""
618 def __init__(self, status):
619 self.
message =
"%s %s" % (status, lookup_status(status))
625 """A wrapper class for DLL functions to make them available in python."""
627 def __init__(self, name, args=[], argnames=[], rstatus=False, lib=_dll):
629 self.
f = getattr(lib, name)
631 self.
f.restype = c_uint
633 self.
f.argtypes = [stripMeta(a)
for a
in args]
641 self.
in_args = [a
for a
in args
if not isinstance(a, OUTPUT)]
643 self.
out_args = [a
for a
in args
if isinstance(a, OUTPUT)]
649 for i
in range(len(self.
in_args)):
650 if isinstance(self.
in_args[i], _OUTSTRLEN):
652 if isinstance(self.
in_args[i], _OUTARRSIZE):
655 ds = name +
"\n\nArguments:\n===========\n"
656 for i
in range(len(args)):
658 if i < len(argnames):
660 ds +=
"\t%s\t%s\n" % (args[i], an)
664 """Parse arguments, allocate any required storage, and execute the call."""
679 for farg
in self.
fargs:
680 if isinstance(farg, OUTPUT):
681 if isinstance(farg, OUTARR):
685 r, c_arg = farg.getVar(size)
688 elif isinstance(farg, _OUTSTRLEN):
690 elif isinstance(args[i], Enum):
691 c_args.append(args[i].value)
694 c_args.append(args[i])
698 status = DRV_ERROR_ACK
700 while status == DRV_ERROR_ACK
and ack_err_count < 3:
702 status = self.
f(*c_args)
703 ret = [extract_value(r)
for r
in ret]
711 if status == DRV_SUCCESS:
714 DRV_INVALID_AMPLIFIER,
716 DRV_INVALID_COUNTCONVERT_MODE,
723 DRV_TEMP_NOT_REACHED,
725 DRV_TEMP_NOT_STABILIZED,
731 if not status == DRV_SUCCESS:
736def dllFunc(name, args=[], argnames=[], rstatus=False, lib=_dll):
737 """Wrap library calls and add them to this module's namespace."""
739 f =
dllFunction(name, args, argnames, rstatus, lib)
740 except Exception
as e:
742 "Error wrapping dll function '%s'" % name
752dllFunc(
"AbortAcquisition", [], [])
753dllFunc(
"CancelWait", [], [])
754dllFunc(
"CoolerOFF", [], [])
755dllFunc(
"CoolerON", [], [])
763 POINTER(ColorDemosaicInfo),
765 [
"grey",
"red",
"green",
"blue",
"info"],
767dllFunc(
"EnableKeepCleans", [c_int], [
"iMode"])
768dllFunc(
"FreeInternalMemory", [], [])
773dllFunc(
"GetAcquiredData", [
OUTARR(at_32), OUTARRSIZE], [
"arr",
"size"])
774dllFunc(
"GetAcquiredData16", [
OUTARR(WORD), OUTARRSIZE], [
"arr",
"size"])
777 "GetAcquisitionProgress",
782 "GetAcquisitionTimings",
784 [
"exposure",
"accumulate",
"kinetic"],
787 "GetAdjustedRingExposureTimes",
788 [c_int, POINTER(c_float)],
789 [
"iNumTimes",
"fptimes"],
793 "GetAmpDesc", [c_int, OUTSTRING, OUTSTRLEN], [
"index",
"name",
"length"]
795dllFunc(
"GetAmpMaxSpeed", [c_int,
OUTPUT(c_float)], [
"index",
"speed"])
796dllFunc(
"GetAvailableCameras", [
OUTPUT(c_long)], [
"totalCameras"])
798dllFunc(
"GetBaselineClamp", [
OUTPUT(c_int)], [
"state"])
799dllFunc(
"GetBitDepth", [c_int,
OUTPUT(c_int)], [
"channel",
"depth"])
800dllFunc(
"GetCameraEventStatus", [
OUTPUT(DWORD)], [
"camStatus"])
804 [
"cameraIndex",
"cameraHandle"],
807 "GetCameraInformation", [c_int,
OUTPUT(c_long)], [
"index",
"information"]
809dllFunc(
"GetCameraSerialNumber", [
OUTPUT(c_int)], [
"number"])
810dllFunc(
"GetCapabilities", [
OUTPUT(AndorCapabilities)], [
"caps"])
811dllFunc(
"GetControllerCardModel", [OUTSTRING], [
"controllerCardModel"])
813 "GetCountConvertWavelengthRange",
815 [
"minVal",
"maxVal"],
817dllFunc(
"GetCurrentCamera", [
OUTPUT(c_long)], [
"cameraHandle"])
844dllFunc(
"GetDetector", [
OUTPUT(c_int),
OUTPUT(c_int)], [
"xpixels",
"ypixels"])
846dllFunc(
"GetEMAdvanced", [
OUTPUT(c_int)], [
"state"])
847dllFunc(
"GetEMCCDGain", [
OUTPUT(c_int)], [
" gain"])
848dllFunc(
"GetEMGainRange", [
OUTPUT(c_int),
OUTPUT(c_int)], [
"low",
"high"])
849dllFunc(
"GetExternalTriggerTermination", [
OUTPUT(at_u32)], [
"puiTermination"])
851 "GetFastestRecommendedVSSpeed",
856dllFunc(
"GetFilterMode", [
OUTPUT(c_int)], [
"mode"])
857dllFunc(
"GetFKExposureTime", [
OUTPUT(c_float)], [
"time"])
859dllFunc(
"GetFKVShiftSpeedF", [c_int,
OUTPUT(c_float)], [
"index",
"speed"])
860dllFunc(
"GetFrontEndStatus", [
OUTPUT(c_int)], [
"piFlag"])
861dllFunc(
"GetGateMode", [
OUTPUT(c_int)], [
"piGatemode"])
863 "GetHardwareVersion",
864 [
OUTPUT(c_uint)
for i
in range(6)],
870 "CameraFirmwareVersion",
871 "CameraFirmwareBuild",
874dllFunc(
"GetHeadModel", [OUTSTRING], [
"name"])
878 [c_int, c_int, c_int,
OUTPUT(c_float)],
879 [
"channel",
"typ",
"index",
"speed"],
881dllFunc(
"GetHVflag", [
OUTPUT(c_int)], [
"bFlag"])
883dllFunc(
"GetImageFlip", [
OUTPUT(c_int),
OUTPUT(c_int)], [
"iHFlip",
"iVFlip"])
884dllFunc(
"GetImageRotate", [
OUTPUT(c_int)], [
"Rotate"])
895 [
"first",
"last",
"arr",
"size",
"validfirst",
"validlast"],
900 [
"first",
"last",
"arr",
"size",
"validfirst",
"validlast"],
902dllFunc(
"GetImagesPerDMA", [
OUTPUT(c_ulong)], [
"images"])
904dllFunc(
"GetKeepCleanTime", [
OUTPUT(c_float)], [
"KeepCleanTime"])
907 [c_int, c_int,
OUTPUT(c_int)],
908 [
"ReadMode",
"HorzVert",
"MaxBinning"],
910dllFunc(
"GetMaximumExposure", [
OUTPUT(c_float)], [
"MaxExp"])
911dllFunc(
"GetMCPGain", [
OUTPUT(c_int)], [
"piGain"])
912dllFunc(
"GetMCPGainRange", [
OUTPUT(c_int),
OUTPUT(c_int)], [
"iLow",
"iHigh"])
914dllFunc(
"GetMCPVoltage", [
OUTPUT(c_int)], [
"iVoltage"])
915dllFunc(
"GetMinimumImageLength", [
OUTPUT(c_int)], [
"MinImageLength"])
918 "GetMostRecentColorImage16",
920 [
"size",
"algorithm",
"red",
"green",
"blue"],
922dllFunc(
"GetMostRecentImage", [
OUTARR(at_32), OUTARRSIZE], [
"arr",
"size"])
923dllFunc(
"GetMostRecentImage16", [
OUTARR(WORD), OUTARRSIZE], [
"arr",
"size"])
928 [
"TimeOfStart",
"TimeFromStart",
"index"],
935dllFunc(
"GetNumberADChannels", [
OUTPUT(c_int)], [
"channels"])
936dllFunc(
"GetNumberAmp", [
OUTPUT(c_int)], [
"amp"])
938 "GetNumberAvailableImages",
942dllFunc(
"GetNumberDDGExternalOutputs", [
OUTPUT(at_u32)], [
"puiCount"])
944dllFunc(
"GetNumberFKVShiftSpeeds", [
OUTPUT(c_int)], [
"number"])
948 [c_int, c_int,
OUTPUT(c_int)],
949 [
"channel",
"typ",
"speeds"],
952 "GetNumberNewImages", [
OUTPUT(c_long),
OUTPUT(c_long)], [
"first",
"last"]
955 "GetNumberPhotonCountingDivisions", [
OUTPUT(at_u32)], [
"noOfDivisions"]
957dllFunc(
"GetNumberPreAmpGains", [
OUTPUT(c_int)], [
"noGains"])
958dllFunc(
"GetNumberRingExposureTimes", [
OUTPUT(c_int)], [
"ipnumTimes"])
959dllFunc(
"GetNumberIO", [
OUTPUT(c_int)], [
"iNumber"])
961dllFunc(
"GetNumberVSAmplitudes", [
OUTPUT(c_int)], [
"number"])
962dllFunc(
"GetNumberVSSpeeds", [
OUTPUT(c_int)], [
"speeds"])
963dllFunc(
"GetOldestImage", [
OUTARR(at_32), OUTARRSIZE], [
"arr",
"size"])
964dllFunc(
"GetOldestImage16", [
OUTARR(WORD), OUTARRSIZE], [
"arr",
"size"])
965dllFunc(
"GetPhosphorStatus", [
OUTPUT(c_int)], [
"piFlag"])
967dllFunc(
"GetPixelSize", [
OUTPUT(c_float),
OUTPUT(c_float)], [
"xSize",
"ySize"])
968dllFunc(
"GetPreAmpGain", [c_int,
OUTPUT(c_float)], [
"index",
"gain"])
971 [c_int, OUTSTRING, OUTSTRLEN],
972 [
"index",
"name",
"length"],
975 "GetDualExposureTimes",
977 [
"exposure1",
"exposure2"],
981 [STRING, c_float, c_uint,
OUTPUT(c_float)],
982 [
"sensor",
"wavelength",
"mode",
"QE"],
984dllFunc(
"GetReadOutTime", [
OUTPUT(c_float)], [
"ReadOutTime"])
987 "GetRingExposureRange", [
OUTPUT(c_float),
OUTPUT(c_float)], [
"Min",
"Max"]
992 [c_int, c_int, c_int, c_int,
OUTPUT(c_float)],
993 [
"channel",
"horzShift",
"amplifier",
"pa",
"sensitivity"],
996 "GetShutterMinTimes",
998 [
"minclosingtime",
"minopeningtime"],
1000dllFunc(
"GetSizeOfCircularBuffer", [
OUTPUT(c_long)], [
"index"])
1003 "GetSoftwareVersion",
1004 [
OUTPUT(c_uint)
for i
in range(6)],
1005 [
"eprom",
"coffile",
"vxdrev",
"vxdver",
"dllrev",
"dllver"],
1009dllFunc(
"GetStatus", [
OUTPUT(c_int)], [
"status"])
1010dllFunc(
"GetTECStatus", [
OUTPUT(c_int)], [
"piFlag"])
1011dllFunc(
"GetTemperature", [
OUTPUT(c_int)], [
"temperature"],
True)
1012dllFunc(
"GetTemperatureF", [
OUTPUT(c_float)], [
"temperature"],
True)
1014 "GetTemperatureRange",
1016 [
"mintemp",
"maxtemp"],
1021dllFunc(
"GetTotalNumberImagesAcquired", [
OUTPUT(c_long)], [
"index"])
1022dllFunc(
"GetIODirection", [c_int,
OUTPUT(c_int)], [
"index",
"iDirection"])
1023dllFunc(
"GetIOLevel", [c_int,
OUTPUT(c_int)], [
"index",
"iLevel"])
1026 [AT_VersionInfoId, OUTSTRING, OUTSTRLEN],
1027 [
"arr",
"szVersionInfo",
"ui32BufferLen"],
1031dllFunc(
"GetVSAmplitudeString", [c_int, OUTSTRING], [
"index",
"text"])
1032dllFunc(
"GetVSAmplitudeFromString", [STRING,
OUTPUT(c_int)], [
"text",
"index"])
1033dllFunc(
"GetVSAmplitudeValue", [c_int,
OUTPUT(c_int)], [
"index",
"value"])
1034dllFunc(
"GetVSSpeed", [c_int,
OUTPUT(c_float)], [
"index",
"speed"])
1044dllFunc(
"Initialize", [STRING], [
"dir"])
1046dllFunc(
"IsAmplifierAvailable", [c_int], [
"iamp"],
True)
1047dllFunc(
"IsCoolerOn", [
OUTPUT(c_int)], [
"iCoolerStatus"])
1048dllFunc(
"IsCountConvertModeAvailable", [c_int], [
"mode"],
True)
1049dllFunc(
"IsInternalMechanicalShutter", [
OUTPUT(c_int)], [
"InternalShutter"])
1051 "IsPreAmpGainAvailable",
1052 [c_int, c_int, c_int, c_int,
OUTPUT(c_int)],
1053 [
"channel",
"amplifier",
"index",
"pa",
"status"],
1055dllFunc(
"IsTriggerModeAvailable", [c_int], [
"iTriggerMode"],
True)
1058dllFunc(
"PrepareAcquisition", [], [])
1071dllFunc(
"SendSoftwareTrigger", [], [])
1072dllFunc(
"SetAccumulationCycleTime", [c_float], [
"time"])
1074dllFunc(
"SetAcquisitionMode", [c_int], [
"mode"])
1076dllFunc(
"SetADChannel", [c_int], [
"channel"])
1077dllFunc(
"SetAdvancedTriggerModeState", [c_int], [
"iState"])
1079dllFunc(
"SetBaselineClamp", [c_int], [
"state"])
1080dllFunc(
"SetBaselineOffset", [c_int], [
"offset"])
1081dllFunc(
"SetCameraLinkMode", [c_int], [
"mode"])
1082dllFunc(
"SetCameraStatusEnable", [DWORD], [
"Enable"])
1083dllFunc(
"SetChargeShifting", [c_uint, c_uint], [
"NumberRows",
"NumberRepeats"])
1084dllFunc(
"SetComplexImage", [c_uint, POINTER(c_int)], [
"numAreas",
"areas"])
1085dllFunc(
"SetCoolerMode", [c_int], [
"mode"])
1086dllFunc(
"SetCountConvertMode", [c_int], [
"Mode"])
1087dllFunc(
"SetCountConvertWavelength", [c_float], [
"wavelength"])
1089 "SetCropMode", [c_int, c_int, c_int], [
"active",
"cropHeight",
"reserved"]
1091dllFunc(
"SetCurrentCamera", [c_long], [
"cameraHandle"])
1092dllFunc(
"SetCustomTrackHBin", [c_int], [
"bin"])
1095 "SetDACOutput", [c_int, c_int, c_int], [
"iOption",
"iResolution",
"iValue"]
1097dllFunc(
"SetDACOutputScale", [c_int], [
"iScale"])
1128dllFunc(
"SetEMAdvanced", [c_int], [
"state"])
1129dllFunc(
"SetEMCCDGain", [c_int], [
"gain"])
1131dllFunc(
"SetEMGainMode", [c_int], [
"mode"])
1132dllFunc(
"SetExposureTime", [c_float], [
"time"])
1133dllFunc(
"SetExternalTriggerTermination", [at_u32], [
"uiTermination"])
1134dllFunc(
"SetFanMode", [c_int], [
"mode"])
1135dllFunc(
"SetFastExtTrigger", [c_int], [
"mode"])
1138 [c_int, c_int, c_float, c_int, c_int, c_int],
1139 [
"exposedRows",
"seriesLength",
"time",
"mode",
"hbin",
"vbin"],
1142 "SetFastKineticsEx",
1143 [c_int, c_int, c_float, c_int, c_int, c_int, c_int],
1144 [
"exposedRows",
"seriesLength",
"time",
"mode",
"hbin",
"vbin",
"offset"],
1146dllFunc(
"SetFilterMode", [c_int], [
"mode"])
1148dllFunc(
"SetFKVShiftSpeed", [c_int], [
"index"])
1150dllFunc(
"SetFrameTransferMode", [c_int], [
"mode"])
1153dllFunc(
"SetFVBHBin", [c_int], [
"bin"])
1156 "SetGate", [c_float, c_float, c_float], [
"delay",
"width",
"stepRenamed"]
1158dllFunc(
"SetGateMode", [c_int], [
"gatemode"])
1159dllFunc(
"SetHighCapacity", [c_int], [
"state"])
1161dllFunc(
"SetHSSpeed", [c_int, c_int], [
"typ",
"index"])
1164 [c_int, c_int, c_int, c_int, c_int, c_int],
1165 [
"bnin",
"vbin",
"hstar",
"hend",
"vstart",
"vend"],
1167dllFunc(
"SetImageFlip", [c_int, c_int], [
"iHFlip",
"iVFlip"])
1168dllFunc(
"SetImageRotate", [c_int], [
"iRotate"])
1170 "SetIsolatedCropMode",
1171 [c_int, c_int, c_int, c_int, c_int],
1172 [
"active",
"cropheight",
"cropwidth",
"vbin",
"hbin"],
1174dllFunc(
"SetKineticCycleTime", [c_float], [
"time"])
1175dllFunc(
"SetMCPGain", [c_int], [
"gain"])
1176dllFunc(
"SetMCPGating", [c_int], [
"gating"])
1178dllFunc(
"SetMetaData", [c_int], [
"state"])
1185dllFunc(
"SetNumberAccumulations", [c_int], [
"number"])
1186dllFunc(
"SetNumberKinetics", [c_int], [
"number"])
1187dllFunc(
"SetNumberPrescans", [c_int], [
"iNumber"])
1188dllFunc(
"SetOutputAmplifier", [c_int], [
"typ"])
1189dllFunc(
"SetOverlapMode", [c_int], [
"mode"])
1190dllFunc(
"SetPCIMode", [c_int, c_int], [
"mode",
"value"])
1191dllFunc(
"SetPhotonCounting", [c_int], [
"state"])
1192dllFunc(
"SetPhotonCountingThreshold", [c_long, c_long], [
"min",
"max"])
1195 "SetPhotonCountingDivisions",
1197 [
"noOfDivisions",
"divisions"],
1200dllFunc(
"SetPreAmpGain", [c_int], [
"index"])
1201dllFunc(
"SetDualExposureTimes", [c_float, c_float], [
"expTime1",
"expTime2"])
1202dllFunc(
"SetDualExposureMode", [c_int], [
"mode"])
1203dllFunc(
"SetRandomTracks", [c_int, c_int], [
"numTracks",
"areas"])
1204dllFunc(
"SetReadMode", [c_int], [
"mode"])
1206dllFunc(
"SetRingExposureTimes", [c_int, c_float], [
"numTimes",
"times"])
1210 [c_int, c_int, c_int, c_int],
1211 [
"typ",
"mode",
"closingtime",
"openingtime"],
1215 [c_int, c_int, c_int, c_int, c_int],
1216 [
"typ",
"mode",
"closingtime",
"openingtime",
"extmode"],
1219dllFunc(
"SetSifComment", [STRING], [
"comment"])
1220dllFunc(
"SetSingleTrack", [c_int, c_int], [
"centre",
"height"])
1221dllFunc(
"SetSingleTrackHBin", [c_int], [
"bin"])
1224 [c_int, c_int, STRING, c_int],
1225 [
"active",
"method",
"path",
"framebuffersize"],
1227dllFunc(
"SetSpoolThreadCount", [c_int], [
"count"])
1230dllFunc(
"SetTemperature", [c_int], [
"temperature"])
1232dllFunc(
"SetTriggerMode", [c_int], [
"mode"])
1233dllFunc(
"SetTriggerInvert", [c_int], [
"mode"])
1235 "GetTriggerLevelRange",
1237 [
"minimum",
"maximum"],
1239dllFunc(
"SetTriggerLevel", [c_float], [
"f_level"])
1240dllFunc(
"SetIODirection", [c_int, c_int], [
"index",
"iDirection"])
1241dllFunc(
"SetIOLevel", [c_int, c_int], [
"index",
"iLevel"])
1247dllFunc(
"SetVSAmplitude", [c_int], [
"index"])
1248dllFunc(
"SetVSSpeed", [c_int], [
"index"])
1249dllFunc(
"ShutDown", [], [])
1250dllFunc(
"StartAcquisition", [], [])
1252dllFunc(
"WaitForAcquisition", [], [])
1253dllFunc(
"WaitForAcquisitionByHandle", [c_long], [
"cameraHandle"])
1255 "WaitForAcquisitionByHandleTimeOut",
1257 [
"cameraHandle",
"iTimeOutMs"],
1259dllFunc(
"WaitForAcquisitionTimeOut", [c_int], [
"iTimeOutMs"])
1295 """Camera trigger modes"""
1306 """Acquisition modes."""
1316 """Chip readout modes. Currently, only IMAGE is supported."""
1318 FULLVERTICALBINNING = 0
1326 """A combination of channel, amplifier and speed settings."""
1328 def __init__(self, channel, amplifier, hs_index, speed):
1330 self.
amp = amplifier
1336 speedstr =
"{:.0f} kHz".format(self.
speed * 1000)
1338 speedstr =
"{:.0f} MHz".format(self.
speed)
1339 return "{} {} CH{:.0f}".format(self.
amp.name, speedstr, self.
channel)
1346ATMCD_MODE_TO_TRIGGER = {
1347 TriggerMode.EXTERNAL: (
1348 microscope.TriggerType.RISING_EDGE,
1349 microscope.TriggerMode.ONCE,
1352 microscope.TriggerType.RISING_EDGE,
1353 microscope.TriggerMode.BULB,
1355 TriggerMode.SOFTWARE: (
1356 microscope.TriggerType.SOFTWARE,
1357 microscope.TriggerMode.ONCE,
1361TRIGGER_TO_ATMCD_MODE = {v: k
for k, v
in ATMCD_MODE_TO_TRIGGER.items()}
1368 """Implements CameraDevice interface for Andor ATMCD library."""
1370 def __init__(self, index=0, **kwargs):
1371 super().__init__(index=index, **kwargs)
1381 def _bind(self, fn):
1382 """Binds unbound SDK functions to this camera."""
1384 @functools.wraps(fn)
1385 def wrapper(*args, **kwargs):
1387 return fn(*args, **kwargs)
1392 """Context manager entry code.
1394 The camera class is also a context manager that ensures DLL calls act
1395 on this camera by obtaining the _dll_lock.
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.
1402 SetCurrentCamera(self.
_handle)
1406 """Context manager exit code."""
1412 def _acquiring(self):
1413 """Indicate whether or not camera is acquiring data."""
1415 return GetStatus() == DRV_ACQUIRING
1418 def _acquiring(self, value):
1425 """Abort acquisition."""
1426 _logger.debug(
"Disabling acquisition.")
1430 except AtmcdException
as e:
1431 if e.status != DRV_IDLE:
1434 def _set_cooler_state(self, state):
1435 """Turn the sensor cooler on (True) or off (False)"""
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" % (
1461 info = GetCameraInformation(self.
_index)
1462 if not info & 1 << 2:
1464 self.
_caps = GetCapabilities()
1465 model = GetHeadModel()
1468 if GetNumberAmp() > 1:
1469 if self.
_caps.ulCameraType == AC_CAMERATYPE_CLARA:
1472 ((
"CONVENTIONAL", 0), (
"EXTENDED_NIR", 1)),
1476 "Amplifiers", ((
"EMCCD", 0), (
"CONVENTIONAL", 1))
1480 for ch
in range(GetNumberADChannels()):
1482 for s
in range(GetNumberHSSpeeds(ch, amp.value)):
1483 speed = GetHSSpeed(ch, amp.value, s)
1487 _logger.info(
"... initilized %s s/n %s", model, serial)
1490 name =
"readout mode"
1501 name =
"TriggerMode"
1503 name,
"enum",
None, self.
_bind(SetTriggerMode), TriggerMode
1505 if self.
_caps.ulTriggerModes & AC_TRIGGERMODE_EXTERNAL:
1507 elif self.
_caps.ulTriggerModes & AC_TRIGGERMODE_CONTINUOUS:
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)
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)
1532 self.
add_setting(name,
"int",
None, setter, vrange)
1536 name =
"Temperature"
1545 self.
_bind(SetFanMode),
1546 {0:
"full", 1:
"low", 2:
"off"},
1549 name =
"Cooler Enabled"
1560 name,
"tuple", self.
get_roi,
lambda roi: self.
set_roi(*roi),
None
1563 name =
"BaselineClamp"
1564 if self.
_caps.ulSetFunctions & AC_SETFUNCTION_BASELINECLAMP:
1566 name,
"bool",
None, self.
_bind(SetBaselineClamp),
None
1570 name =
"BaselineOffset"
1571 if self.
_caps.ulSetFunctions & AC_SETFUNCTION_BASELINEOFFSET:
1573 name,
"int",
None, self.
_bind(SetBaselineOffset), (-1000, 1000)
1578 if self.
_caps.ulSetFunctions & AC_SETFUNCTION_EMADVANCED:
1580 name,
"bool",
None, self.
_bind(SetEMAdvanced),
None
1585 if self.
_caps.ulSetFunctions & AC_SETFUNCTION_GATEMODE:
1587 0, [5, 6][self.
_caps.ulCameraType & AC_CAMERATYPE_ISTAR]
1590 name,
"int",
None, self.
_bind(SetGateMode), vrange
1593 name =
"HighCapacity"
1594 if self.
_caps.ulSetFunctions & AC_SETFUNCTION_HIGHCAPACITY:
1596 name,
"bool",
None, self.
_bind(SetHighCapacity),
None
1599 def _fetch_data(self):
1600 """Poll for data and return it, with minimal processing.
1602 Returns the data, or None if no data
is available.
1606 width = roi.width // binning.h
1607 height = roi.height // binning.v
1610 data = GetOldestImage16(width * height).reshape(height, width)
1611 except AtmcdException
as e:
1612 if e.status == DRV_NO_NEW_DATA:
1619 """Return the device's unique identifier."""
1621 return GetCameraSerialNumber()
1623 def _do_shutdown(self) -> None:
1624 """Warm up the sensor then shut down the camera.
1626 This may take some time, so we should ensure that the _dll_lock is
1627 released when we don
't need it."""
1633 "Waiting for temperature to rise above -20C" " before shutdown ..."
1639 t = GetTemperature()[1]
1640 _logger.info(
"... T = %dC", t)
1645 _logger.info(
"Temperature is %dC: shutting down camera.", t)
1650 def _do_disable(self):
1651 """Call abort to stop acquisition."""
1654 def _do_enable(self):
1655 """Enter data acquisition state."""
1659 SetAcquisitionMode(AcquisitionMode.RUNTILLABORT)
1661 SetReadMode(ReadMode.IMAGE)
1662 x, y = GetDetector()
1664 if not IsTriggerModeAvailable(self.
get_setting(
"TriggerMode")):
1666 "Trigger mode is not valid."
1671 def _set_image(self):
1672 """Set ROI and binning prior to acquisition."""
1683 roi.left + roi.width - 1,
1685 roi.top + roi.height - 1,
1687 except AtmcdException
as e:
1688 if e.status == DRV_P1INVALID:
1689 out_e = ValueError(
"Horizontal binning invalid.")
1690 elif e.status == DRV_P2INVALID:
1691 e = ValueError(
"Vertical binning invalid.")
1692 elif e.status == DRV_P3INVALID:
1693 out_e = ValueError(
"roi.left invalid.")
1694 elif e.status == DRV_P4INVALID:
1695 out_e = ValueError(
"roi.width invalid.")
1696 elif e.status == DRV_P5INVALID:
1697 out_e = ValueError(
"roi.top invalid.")
1698 elif e.status == DRV_P6INVALID:
1699 out_e = ValueError(
"roi.height invalid.")
1703 raise out_e
from None
1705 @microscope.abc.keep_acquiring
1707 """Set exposure time."""
1709 SetExposureTime(value)
1712 """Query the actual exposure time."""
1714 exposure, accumulate, kinetic = GetAcquisitionTimings()
1718 """Determine the minimum time between exposures."""
1720 exposure, accumulate, kinetic = GetAcquisitionTimings()
1721 readout = GetReadOutTime()
1728 def _set_readout_mode(self, mode_index):
1729 """Configure channel, amplifier and VS-speed."""
1731 _logger.info(
"Setting readout mode to %s", mode)
1733 SetADChannel(mode.channel)
1734 SetOutputAmplifier(mode.amp)
1739 SetImageFlip(
not mode.amp, 0)
1740 SetHSSpeed(mode.amp, mode.hsindex)
1742 def _get_sensor_shape(self):
1743 """Return the sensor geometry."""
1745 return GetDetector()
1747 def _get_sensor_temperature(self):
1748 """Return the sensor temperature."""
1750 return GetTemperature()[1]
1753 """Send a software trigger signal.
1758 SendSoftwareTrigger()
1761 def trigger_mode(self) -> microscope.TriggerMode:
1762 return ATMCD_MODE_TO_TRIGGER[self.
get_setting(
"TriggerMode")][1]
1765 def trigger_type(self) -> microscope.TriggerType:
1766 return ATMCD_MODE_TO_TRIGGER[self.
get_setting(
"TriggerMode")][0]
1772 atmcd_mode = TRIGGER_TO_ATMCD_MODE[(ttype, tmode)]
1775 "no ATMCD mode for %s and %s" % (ttype, tmode)
1779 def _do_trigger(self) -> None:
1781 SendSoftwareTrigger()
1783 def _get_binning(self):
1784 """Return the binning setting."""
1787 @microscope.abc.keep_acquiring
1788 def _set_binning(self, binning):
1789 """Set horizontal and vertical binning. Default to single pixel."""
1794 """Return the current ROI setting."""
1797 @microscope.abc.keep_acquiring
1798 def _set_roi(self, roi):
1799 """Set the ROI, defaulting to full sensor area."""
1801 x, y = GetDetector()
1802 left = roi.left
or 1
1804 width = roi.width
or x
1805 height = roi.height
or y
1807 [left < 1, top < 1, left + width - 1 > x, top + height - 1 > y]
None set_binning(self, microscope.Binning binning)
microscope.ROI get_roi(self)
def _set_roi(self, microscope.ROI roi)
None set_roi(self, microscope.ROI roi)
def _set_binning(self, microscope.Binning binning)
microscope.Binning get_binning(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)
None set_setting(self, str name, value)
def _set_readout_mode(self, mode_index)
def set_exposure_time(self, value)
def __exit__(self, exc_type, exc_value, traceback)
def _acquiring(self, value)
def _set_binning(self, binning)
None set_trigger(self, microscope.TriggerType ttype, microscope.TriggerMode tmode)
def _set_cooler_state(self, state)
def get_exposure_time(self)
def _get_sensor_temperature(self)
def __call__(self, *args)