microscope.stages.linkam module

A microscope interface to Linkam stages.

This module requires the LinkamSDK library and a license file, available from Linkam Scientific Instruments.

Currently, this module supports on the the correlative microscopy stage, but should be readily extensible to support other Linkam stages.

Note

This module does not run correctly with python optimisations in use. When invoked with python -O, there seem to be issues with accessing ctypes objects.

  • get_status() throws AttributeError “c_ulonglong has no attribute ‘flags’”;

  • get_id returns an empty string, not the device serial number.

class microscope.stages.linkam.ControllerError(value)[source]

Bases: enum.Enum

ControllerError enum from C headers

CMS196BaseSensorOpen = 28
CMS196BaseSensorOverrange = 29
CMS196ChamberSensorOpen = 21
CMS196ChamberSensorOverrange = 22
CMS196DewarEmpty = 27
CMS196DewarSensorOpen = 25
CMS196DewarSensorOverrange = 26
CMS196LN2SwitchSensorOpen = 23
CMS196LN2SwitchSensorOverrange = 24
CMS196MotorPosnError = 30
CSS450MotorDriveOverTemp = 15
CSS450MotorWindingError1 = 16
CSS450MotorWindingError2 = 17
CommsError = 13
CoolingWaterTooWarmNotFlowing = 14
LNP95Error = 12
LoadPowerIncorrectForStage = 8
LoadPowerOutputVoltageWrong = 4
NoError = 0
OptionBoardCableDisconnect = 7
OptionBoardIncorrectCable = 9
OptionBoardSensorOenOverrange = 10
Reserved1 = 18
Reserved2 = 19
Reserved3 = 20
StageCableDisconnected = 1
StageCableError = 2
StageTempSensorOpenOverrange = 3
T95FanNotWorking = 11
T95OptionBoardWongConfig = 6
T95RelayMissing = 5
class microscope.stages.linkam.ErrorCode(value)[source]

Bases: enum.Enum

ErrorCode enum from C headers

CommandBufferLimitReached = 3975151627
DeviceCreationFailure = 3975151620
DeviceRegistrationFailed = 3975151619
LibraryNotInitialised = 3975151617
Max = 3976200191
NoConnectionInfo = 3975151618
NoError = 3975151616
SerialCommsHandshakeFailure = 3975151622
SerialCommsInitialisationFailure = 3975151621
SerialCommsRxError = 3975151625
SerialCommsTxError = 3975151635
SerialCommsUnknownRxError = 3975151626
SerialCommsUnknownTxError = 3975151636
SerialPortSocketConfigurationFailure = 3975151624
SerialPortSocketCreationFailure = 3975151623
USBCommsHandshakeFailure = 3975151629
USBCommsInitialisationFailure = 3975151628
USBCommsRxError = 3975151631
USBCommsTxError = 3975151633
USBCommsUnknownRxError = 3975151632
USBCommsUnknownTxError = 3975151634
USBPortSocketCreationFailure = 3975151630
class microscope.stages.linkam.LinkamCMS(uid='', **kwargs)[source]

Bases: microscope.stages.linkam._LinkamMDSMixin, microscope.stages.linkam._LinkamBase

Linkam correlative-microscopy stage.

class RefillTracker[source]

Bases: object

as_dict()[source]

Represent this object as a dict for status queries.

dt = datetime.timedelta(0)
end_refill()[source]

End a refill: update status flag and last refill time.

refilling = False
start_refill()[source]

Start a refill: update status flag and last cycle time.

t = None
get_condensor_level()[source]

Return the condensor level

get_light()[source]

Report the state of the chamber light.

get_motors()[source]

Return the position, set point and stopped status of available motors.

get_status(*args)[source]

Return a dict containing aggregated stage status.

refill_chamber(state=True)[source]

Start a refill of the sample chamber from the internal dewar

refill_dewar(state=True)[source]

Start a refill of the internal dewar from an external reservoir

refill_stats()[source]

Return information about refill times and cycle lengths.

set_condensor(state)[source]

Turn the condensor LED on or off.

set_condensor_level(level)[source]

Set the condensor LED level

set_light(state)[source]

Set the state of the chamber light.

temperatures()[source]

Return a dict of temperature sensor readings.

class microscope.stages.linkam.Msg(value)[source]

Bases: enum.IntEnum

An enumeration.

ApplySampleCals = 14
CloseComms = 2
CssApplyValues = 29
CssCheckValues = 30
CssGotoReference = 31
CssSendDirection = 85
CssSendForceStop = 86
CssSendFrequency = 83
CssSendGap = 80
CssSendGapOverride = 79
CssSendGapVelocity = 78
CssSendRate = 82
CssSendStrain = 84
CssSendTorque = 87
CssSendVelocity = 81
CssSensorCal = 32
CssStartJogGap = 33
CssStartJogRot = 34
DisableLogging = 36
DoesOptionCardSupportSensors = 54
EnableLogging = 35
ForceCooling = 90
ForceHeating = 89
ForceHold = 91
GetConnectionInformation = 96
GetControllerConfig = 3
GetControllerError = 4
GetControllerFirmwareVersion = 37
GetControllerHardwareVersion = 38
GetControllerHeaterDetails = 77
GetControllerIdent = 95
GetControllerName = 5
GetControllerPSUDetails = 68
GetControllerSerial = 6
GetDataRate = 41
GetHumidityControllerSensorHardwareVersion = 66
GetHumidityControllerSensorName = 64
GetHumidityControllerSensorSerial = 65
GetInstrumentBusDeviceFirmwareVersion = 62
GetInstrumentBusDeviceHardwareVersion = 63
GetInstrumentBusDeviceIdent = 92
GetInstrumentBusDeviceName = 60
GetInstrumentBusDeviceSerial = 61
GetMaxValue = 11
GetMinValue = 12
GetOptionCardHardwareVersion = 53
GetOptionCardName = 51
GetOptionCardSensorHardwareVersion = 57
GetOptionCardSensorName = 55
GetOptionCardSensorSerial = 56
GetOptionCardSerial = 52
GetOptionCardSlot = 50
GetOptionCardType = 49
GetProgramState = 75
GetResolution = 13
GetStageCableLimits = 43
GetStageConfig = 8
GetStageConfiguration = 76
GetStageFirmwareVersion = 39
GetStageGroup = 58
GetStageHardwareVersion = 40
GetStageHeaterIdent = 97
GetStageIdent = 93
GetStageName = 10
GetStageSerial = 9
GetStatus = 7
GetValue = 21
HaveInstrumentBusDeviceType = 59
InitialiseTriggerSignalPulse = 72
IsControllerType = 67
LnpSetMode = 27
LnpSetSpeed = 28
Max = 268435455
OpenComms = 1
SaveSampleCals = 15
SendDscBaselinePowerValues = 46
SendDscGainValues = 44
SendDscPowerValue = 45
SendDscTuaConstants = 47
SetControllerMainsFrequency = 71
SetControllerTriggerSignalDisable = 70
SetControllerTriggerSignalEnable = 69
SetDSCModulationData = 48
SetDataRate = 42
SetTriggerSignalPluseWidth = 74
SetTriggerSignalPulse = 73
SetValue = 22
StartHeating = 16
StartHumidity = 18
StartHumidityDesiccantConditioning = 19
StartMotors = 20
StartVacuum = 17
TstCalibrateDistance = 23
TstSetCalibrationForce = 88
TstSetMode = 24
TstZeroForce = 25
TstZeroPosition = 26