nkt_tools.extreme.Extreme

class nkt_tools.extreme.Extreme(portname=None)

Bases: object

__init__(portname=None)

Searches for connected NKT lasers and defines instrument parameters.

Make sure devices are not connected via another program already. If multiple Extreme/Fianium lasers are connected to the same computer, specificy the port of the desired laser upon instantiation.

Parameters:

portname (str, optional) – Enter if portname for laser is known/multiple lasers are connected. If not supplied, system searches for laser. None by default.

Raises:

RuntimeError – Throws error if multiple NKT lasers are found on one computer. Supply portname for desired laser if multiple present.

Methods

__init__([portname])

Searches for connected NKT lasers and defines instrument parameters.

print_status()

Read system status in bytes, translate to str, print.

set_current(current)

Set current level setpoint with 0.1% precision.

set_emission(state)

Change emission state of laser to on/off

set_interlock(value)

Reset or trip interlock with >0 or 0, respectively.

set_mode(setup_key)

Sets the "setup" of the laser according to options in manual.

set_nim_delay(nim_delay)

Set NIM trigger delay time.

set_power(power)

Set power level setpoint with 0.1% precision.

set_pulse_picker_ratio(ratio)

Sets pulse picker ratio by writing register 0x34.

set_watchdog_interval(timeout)

Set the watchdog interval by calling registerWriteU8 on 0x36.

test_read_funcs()

Attributes

current_level

Get current level setpoint with 0.1% precision.

device_type

Should be 96 (0x60) for Extreme/Fianium.

emission_state

Accesses register 0x30 to return emission state of laser.

inlet_temperature

float, read-only: Accesses register 0x11 to return inlet temperature w/ 0.1 C precision.

interlock_status

Print interlock status to terminal.

module_address

Module address = 15 for Extreme/Fianium.

nim_delay

Get NIM trigger delay time.

portname

COM port for laser.

power_level

Get power level setpoint with 0.1% precision.

pulse_picker_ratio

Get pulse picker ratio by reading register 0x34.

setup_options

setup_status

Reads value of register 0x16 and returns corresponding status message.

status_messages

system status translation bits > string

system_type

str, read-only: Access register 0x6B to determine Extreme/Fianium

watchdog_interval

Get the watchdog interval by reading register 0x36.

property current_level

Get current level setpoint with 0.1% precision.

Read register 0x38 and converts from permille to percent.

Returns:

current_level – Current level setpoint in percent w/ 0.1% precision.

Return type:

float

property device_type

Should be 96 (0x60) for Extreme/Fianium. Assigned and checked during object init.

Type:

int, read-only

property emission_state

Accesses register 0x30 to return emission state of laser.

Updates the value of non-public attr when called.

Returns:

True = emission off; False = emission on

Return type:

bool

property inlet_temperature

float, read-only: Accesses register 0x11 to return inlet temperature w/ 0.1 C precision.

Updates the value of non-public attr when called.

Returns:

Inlet temperature w/ 0.1 C precision.

Return type:

float

property interlock_status

Print interlock status to terminal.

Reads register 0x32 and converts bytes into strings based on manual.

Manual: Reading the interlock register returns the current interlock status, which consists of two unsigned bytes. The first byte (LSB) tells if the interlock circuit is open or closed. The second byte (MSB) tells where the interlock circuit is open, if relevant.

MSB

LSB

Description

0

Interlock off (interlock circuit open)

0

1

Waiting for interlock reset

0

2

Interlock is OK

1

0

Front panel interlock / key switch off

2

0

Door switch open

3

0

External module interlock

4

0

Application interlock

5

0

Internal module interlock

6

0

Interlock power failure

7

0

Interlock disabled by light source

255

Interlock circuit failure

Returns:

(LSB, Desription) returns result according to table in manual.

Return type:

tuple(int, str)

property module_address

Module address = 15 for Extreme/Fianium.

Type:

int, read-only

property nim_delay

Get NIM trigger delay time.

Reads register 0x38 and converts from int value to delay in seconds.

Manual: On systems with NIM trigger output, the delay of this trigger signal can be adjusted with the NIM delay register. The input for this register should be an unsigned 16-bit value from 0 to 1023. The range is 0 – 9.2 ns. The average step size is 9 ps.

Returns:

nim_delay – Delay time given in seconds.

Return type:

float

property portname

COM port for laser. Autofound during init if not given. User can supply when creating object.

Type:

str, read-only

property power_level

Get power level setpoint with 0.1% precision.

Read register 0x37 and converts from permille to percent.

Returns:

power_level – Power level setpoint in percent w/ 0.1% precision.

Return type:

float

print_status()

Read system status in bytes, translate to str, print.

Reads system status using registerReadU16 on register 0x66. Translates binary into str for of equipment status through Extreme.status_messages.

Returns:

str – binary results of register read in string format.

Return type:

bits

property pulse_picker_ratio

Get pulse picker ratio by reading register 0x34.

Manual: For SuperK EXTREME Systems featuring the pulse picker option, the divide ratio for the pulse picker can be controlled with the pulse picker ratio register. Note: When reading the pulse picker value, an 8-bit unsigned integer will be returned if the ratio is lower than 256, and a 16-bit unsigned integer otherwise.This is for historical reasons.

Returns:

ratio – Pulse picker divide ratio

Return type:

int

set_current(current)

Set current level setpoint with 0.1% precision.

converts from percent to permille and write register 0x38.

Parameters:

current (float) – Current level setpoint in percent w/ 0.1% precision (0 <= I <= 100)

set_emission(state)

Change emission state of laser to on/off

Uses nktp_dll to write to register 0x30.

Parameters:

state (bool) – True turns laser on, false turns emission off

set_interlock(value)

Reset or trip interlock with >0 or 0, respectively.

Manual: If the door interlock is in place, the key switch on the front plate is in On position and the External bus is terminated with e.g. a bus defeater then the Interlock circuit can be reset via the Interbus interface by sending a value greater than 0 to the Interlock register. Additionally, the opposite function (switching interlock relays off) can be done by sending the value 0 to the interlock register.

Parameters:

value (int) – 0 trips interlock. >0 resets interlock.

set_mode(setup_key)

Sets the “setup” of the laser according to options in manual.

Checks value provided is withing Extreme.setup_options.keys(), then writes to register 0x16. Get current status w/ Extreme.setup_status

Manual: With the Setup register, the operation mode of the SuperK EXTREME System can be controlled. The possible values are listed below; however, in some systems, not all modes are available.16-bit unsigned integer.

0: Constant current mode 1: Constant power mode 2: Externally modulated current mode 3: Externally modulated power mode 4: External feedback mode (Power Lock)

Parameters:

setup_key (int) – Interger corresponding to a key inside Extreme.setup_options

set_nim_delay(nim_delay)

Set NIM trigger delay time.

Writes register 0x38 and converts from delay time in seconds to corresponding int value using setpoint = int(nim_delay/9e-12)

Manual: On systems with NIM trigger output, the delay of this trigger signal can be adjusted with the NIM delay register. The input for this register should be an unsigned 16-bit value from 0 to 1023. The range is 0 – 9.2 ns. The average step size is 9 ps.

Parameters:

nim_delay (float) – Delay time given in seconds. (0 <= nim_delay <= 9.207e-9)

set_power(power)

Set power level setpoint with 0.1% precision.

Converts from percent to permille and write register 0x37.

Parameters:

power (float) – Power level setpoint in percent w/ 0.1% precision. (0 <= P <= 100)

set_pulse_picker_ratio(ratio)

Sets pulse picker ratio by writing register 0x34.

Manual: For SuperK EXTREME Systems featuring the pulse picker option, the divide ratio for the pulse picker can be controlled with the pulse picker ratio register.

Parameters:

ratio (int) – Interger corresponding to a key inside Extreme.setup_options

set_watchdog_interval(timeout)

Set the watchdog interval by calling registerWriteU8 on 0x36.

Manual: The system can be set to make an automatic shut-off (laser emission only – not electrical power) in case of lost communication. The value in the watchdog interval register determines how many seconds with no communication the system will tolerate. If the value is 0, the feature is disabled. 8-bit unsigned integer.

Parameters:

timeout (int) – time (seconds) the system will toleratre for communication loss.

property setup_status

Reads value of register 0x16 and returns corresponding status message.

See Extreme.setup_options for possible outcomes. Use Extreme.set_mode() to change value.

Returns:

Current setup status of laser based on manual values.

Return type:

str

status_messages = {0: 'Emission on', 1: 'Interlock relays off', 2: 'Interlock supply voltage low (possible short circuit)', 3: 'Interlock loop open', 4: 'Output Control signal low', 5: 'Supply voltage low', 6: 'Inlet temperature out of range', 7: 'Clock battery low voltage', 8: '-', 9: '-', 10: '-', 11: '-', 12: '-', 13: 'CRC error on startup (possible module address conflict)', 14: 'Log error code present', 15: 'System error code present'}

system status translation bits > string

Bit Index

Status

Bit 0:

Emission on

Bit 1:

Interlock relays off

Bit 2:

Interlock supply voltage low (possible short circuit)

Bit 3:

Interlock loop open

Bit 4:

Output Control signal low

Bit 5:

Supply voltage low

Bit 6:

Inlet temperature out of range

Bit 7:

Clock battery low voltage

Bit 13:

CRC error on startup (possible module address conflict)

Bit 14:

Log error code present

Bit 15:

System error code present

Type:

dict

property system_type

str, read-only: Access register 0x6B to determine Extreme/Fianium

From Manual: The system type is a newer implementation used to differentiate systems with minor differences. Older versions might not respond to this register. In that case the system type should be interpreted as 0 = SuperK Extreme. 8-bit unsigned integer. 0 = SuperK Extreme 1 = SuperK Fianium

property watchdog_interval

Get the watchdog interval by reading register 0x36.

Manual: The system can be set to make an automatic shut-off (laser emission only – not electrical power) in case of lost communication. The value in the watchdog interval register determines how many seconds with no communication the system will tolerate. If the value is 0, the feature is disabled. 8-bit unsigned integer.

Returns:

ratio – Pulse picker divide ratio

Return type:

int