Introduction

Before diving into how the remote control for the Retina works, it has to be mentioned that we offer a Python controller class to facilitate easy remote control via Python. Depending on which control software your Retina driver runs, this is either WebSQController (for the WebSQ driver) or NerveController (for the Nerve driver, the newer control software for the Retina). The latest version of both, along with full documentation, is available in the Help section of the user interface. If your goal is to get started quickly we would recommend you access this class and look at the examples here. Use the WebSQ/Nerve tabs below to switch this whole page to match your driver.

Methods of communication

JSON RPC

In order to send commands to the Retina driver we make use of the JSON RPC protocol. Commands in this format can be send to the API endpoint: [Driver IP]/api. This allows for communication with the driver, independent of platform or language. A request object in a JSON RPC command is expected to have the following format:

{
    "method": "<method name>",
    "params": "<parameters for the method>",
    "jsonrpc": "2.0",
    "id": "<identifier>"
}

API

This table lists every JSON-RPC method exposed by the driver software, together with the params it accepts (as sent in a request’s params object) and the response it returns. It is generated automatically from the websq and nerve driver source code, so it always reflects what the running driver actually supports. Use the WebSQ/Nerve tabs below to match your driver.

Method

Params

Response

IVStatus

Not documented in source.

backupSettings

Not documented in source.

clearTemperatureData

Empties the temperature data file.

getAutoCoolDevices

Returns the device options for the automatic cooldown.

getAutoCoolStatus

Returns dictionary with all the automatic cooldown settings

getBackend

Returns a dictionary with all the backend settings

getBiasCurrent

ranks (default: None)

Returns the bias current in μA.

getDevices

Returns a dictionary with all the devices settings

getDiskUsage

Returns a dictionary With Disk usage details

getIvData

Not documented in source.

getIvFile

any (see response)

Generates a file with all relevant data of the latest IV sweep.

getLatchFrequencyLowerLimit

ranks (default: None)

Returns the frequency latching lower limit.

getLatchFrequencyUpperLimit

ranks (default: None)

Returns the frequency latching upper limit.

getLatchingVoltage

ranks (default: None)

Returns the latching voltage in mV.

getLog

lines (default: 1000)
filter (default: ['INFO', 'WARN', 'ERROR', 'DEBUG', 'CRITICAL', 'NOTSET'])

Returns the Tornado server log.

getNetworkSettings

adapter (default: ETH_NIC)

Not documented in source.

getPgaGain

ranks (default: None)

Returns the pgaGain.

getPrescale

ranks (default: None)

Returns the prescale.

getRecordData

Not documented in source.

getSerialNumber

Returns the serial number.

getSettings

Returns the entire settings model as a dictionary.

getSettingsNoData

Returns the settings without any data.

getTempData

Returns the entirety of the temperature data.
It is a list of dictionaries structured as such:
[{‘time’: float, ‘temp1’: float, ‘temp2’: float, ‘voltage1’: float, ‘voltage2’: float}, …]

getTriggerVoltage

ranks (default: None)

Returns the trigger voltage in mV.

getUnlatchSequences

ranks (default: None)

Returns the unlatch Sequence number.

jsonSchema

Gives the JSON schema for the settings model.

loadDefaults

Not documented in source.

offlineUpdate

fn

Not documented in source.

rebootSystem

delay (default: 1)

Not documented in source.

restoreSettings

Not documented in source.

setBiasCurrent

ranks (default: None)
value (default: None)

Set the bias currents for one or multiple channels, values given in μA.

setChannelLog

debug (default: False)
rank (default: 1)

Not documented in source.

setLatchFrequencyLowerLimit

ranks (default: None)
value (default: None)

Set the lower limit frequence, values given in (Counts / second)

setLatchFrequencyUpperLimit

ranks (default: None)
value (default: None)

Set the upper limit frequence, values given in (Counts / second)

setLatchingVoltage

ranks (default: None)
value (default: None)

Set the latching voltage, values given in mV.

setMcuStatus

mcuId
status

Not documented in source.

setNetworkSettings

any (see response)

Not documented in source.

setPgaGain

ranks (default: None)
value (default: None)

Set the pgaGain.
NOTE: Not sure if this is needed but I added it for completeness sake.

setPrescale

ranks (default: None)
value (default: None)

Set the prescale.
NOTE: Not sure if this is needed but I added it for completeness sake.

setSerialNumber

serial_number (default: None)

Returns the serial number.

setSettings

any (see response)

Updates the settings on the backend.
The _new_settings object can be any subset of the settings model
(You only need to pass that which you want to update),
as long as it has the same structure.

setSettingsFromFile

file (default: None)

Overwrites the settings with those of a given file.

setTriggerVoltage

ranks (default: None)
value (default: None)

Set the trigger voltage, values given in mV.

setUnlatchSequences

ranks (default: None)
value (default: None)

Set the unlatching sequences, values given in (10ms) sequences.

shutdownSystem

Shuts down the driver completely.
This is only applicable for the backport!

startAutoCool

settings

Starts the automatic cooldown process

startIV

start
step
stop
inttime
ranks

Start an IV sweep.

Parameters:
start: Starting bias current (uA)
step: Bias current step size (uA)
stop: Stopping bias current (uA)
inttime: Integration Time (ms)
ranks: (Optional) Ranks of the channels which you want to sweep.

startRecording

channels

Not documented in source.

stopAutoCool

settings

Stops the automatic cooldown process

stopIV

Stops the execution of all IV sweeps on the backend.

stopRecording

camera_view_enabled (default: False)

Not documented in source.

turnOffAllMcus

Not documented in source.

turnOnAllMcus

Not documented in source.

updateDriverSetup

setup

Updates the driver setup/configuration.
It can edit the amount of MCU’s and which CU’s are active within them.

updateTemperatureCalibration

data (default: None)

Updates the temperature calibrations files

updateTimezone

timezone (default: None)

Generates a file with all relevant data of the latest IV sweep.

Nerve’s RPC handlers do not carry source-level descriptions, so the response column only points to the Go handler that implements each method.

Method

Params

Response

backupSettings

Not documented in source (see handleBackupSettings).

getAutoCoolDevices

Not documented in source (see handleGetAutoCoolDevices).

getAutoCoolStatus

Not documented in source (see handleGetAutoCoolStatus).

getBackend

Not documented in source (see handleGetBackend).

getBiasCurrent

ranks ([]uint32)

Not documented in source (see handleGetBiasCurrent).

getCalibrationFileNames

Not documented in source (see handleGetCalibrationFileNames).

getChannels

Not documented in source (see handleGetChannels).

getDiskUsage

Not documented in source (see handleGetDiskUsage).

getLatchFrequencyLowerLimit

ranks ([]uint32)

Not documented in source (see handleGetLatchFrequencyLowerLimit).

getLatchFrequencyUpperLimit

ranks ([]uint32)

Not documented in source (see handleGetLatchFrequencyUpperLimit).

getLatchingVoltage

ranks ([]uint32)

Not documented in source (see handleGetLatchingVoltage).

getLog

lines (int, optional)
filter (
[]string, optional)

Not documented in source (see handleGetLog).

getNetworkSettings

Not documented in source (see handleGetNetworkSettings).

getPgaGain

ranks ([]uint32)

Not documented in source (see handleGetPgaGain).

getPlotSettings

Not documented in source (see handleGetPlotSettings).

getPrescale

ranks ([]uint32)

Not documented in source (see handleGetPrescale).

getSecondSensorEnabled

Not documented in source (see handleGetSecondSensorEnabled).

getSerialNumber

Not documented in source (see handleGetSerialNumber).

getSettings

Not documented in source (see handleGetSettings).

getTemperature

Not documented in source (see handleGetTemperature).

getTriggerVoltage

ranks ([]uint32)

Not documented in source (see handleGetTriggerVoltage).

getUnlatchSequences

ranks ([]uint32)

Not documented in source (see handleGetUnlatchSequences).

IVStatus
ivStatus

Not documented in source (see handleIVStatus).

jsonSchema

Not documented in source (see handleJSONSchema).

loadDefaults

Not documented in source (see handleLoadDefaults).

reboot

delay (*int, optional)

Not documented in source (see handleReboot).

resetAllMcus

Not documented in source (see handleResetAllMcus).

restoreSettings

Not documented in source (see handleRestoreSettings).

setBiasCurrent

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetBiasCurrent).

setChannelLog

debug (bool)
rank (*uint32, optional)

Not documented in source (see handleSetChannelLog).

setLatchFrequencyLowerLimit

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetLatchFrequencyLowerLimit).

setLatchFrequencyUpperLimit

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetLatchFrequencyUpperLimit).

setLatchingVoltage

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetLatchingVoltage).

setMcuStatus

id (uint8)
status (uint8)

Not documented in source (see handleSetMcuStatus).

setNetworkSettings

Not documented in source (see handleSetNetworkSettings).

setPgaGain

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetPgaGain).

setPrescale

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetPrescale).

setRecord
setRecording

value (bool)

Not documented in source (see handleSetRecord).

setSecondSensorEnabled

value (bool)

Not documented in source (see handleSetSecondSensorEnabled).

setSerialNumber

value (string)

Not documented in source (see handleSetSerialNumber).

setSettings

Not documented in source (see handleSetSettings).

setTriggerVoltage

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetTriggerVoltage).

setUnlatchSequences

ranks ([]uint32)
value (number or string)

Not documented in source (see handleSetUnlatchSequences).

startAutoCool

Not documented in source (see handleStartAutoCool).

startIV
startIv

ranks ([]uint32)
start (*float32)
startValue (*float32)
stop (*float32)
stopValue (*float32)
step (*float32)
stepValue (*float32)
intTime (*uint32)

Not documented in source (see handleStartIV).

stopAutoCool

Not documented in source (see handleStopAutoCool).

stopIV
stopIv

Not documented in source (see handleStopIV).

turnOffAllMcus

Not documented in source (see handleTurnOffAllMcus).

turnOnAllMcus

Not documented in source (see handleTurnOnAllMcus).

updateDriverSetup

setup (map[uint32][]uint32)

Not documented in source (see handleUpdateDriverSetup).

updateTimezone

Not documented in source (see handleUpdateTimezone).

A full list of methods, with expected parameters and responses, can be found in the appendix under API.

Websocket (Readout only)

The websocket outputs a direct stream of bytes which gives the most efficient way to readout data by far. You can access the websocket by listening to the following endpoint: [Driver IP]/counts. The exact framing of these bytes depends on which control software your driver runs.

The messages which are send here consist of 32 bytes, and structured as show in table Table: Channel Unit message structure (WebSQ). Every measurement interval of 10ms, these messages will be bundled and send to the websocket as one byte string. These messages will have to be split up again for readout.

Table: Channel Unit message structure (WebSQ)

Parameter

Type

Bytes

Description

McuId

Int8

1

ID of the Retina Box.

CuId

Int8

1

ID of the Retina Channel Unit.

cuStatus

Int8

1

Status of the Channel Unit, see table Table: Status codes of the channel units in the appendix for more information

Padding

-

1

Can any 1 byte value

MonitorV

Float

4

Monitor Voltage (V)

biasI

Float

4

Bias Current (A)

Counts

Int32

4

Counts measured in one measurement interval (10ms)

intSize

Int32

4

Size of integration interval in Number of measurement intervals of 10ms

Rank

Int32

4

Channel Rank

Time

Double

8

Timestamp

Every websocket frame starts with a single type byte (0 for counts, 1 for IV data, which is currently ignored by the controller), followed by a 12 byte header described in table Table: Counts header structure (Nerve), followed by one 9 byte record per channel unit as described in table Table: Channel Unit message structure (Nerve). A single frame can bundle records for multiple channel units and multiple measurement intervals.

Table: Counts header structure (Nerve)

Parameter

Type

Bytes

Description

Time

UInt64

8

Timestamp (ms)

intSize

UInt32

4

Size of integration interval in Number of measurement intervals of 10ms

Table: Channel Unit message structure (Nerve)

Parameter

Type

Bytes

Description

cuStatus

Int8

1

Status of the Channel Unit, see table Table: Status codes of the channel units in the appendix for more information

Channel Number

UInt32

4

Channel number of the Channel Unit.

Counts

UInt32

4

Counts measured in one measurement interval (10ms)

Python

Installation instructions, usage examples, and the full API reference for the Python controller class are provided below.

Installation

Download the Python controller class matching your driver software below, and place it in the same directory as your script. It can then be imported directly, as shown in the examples below.

Download the controller script: WebSQController.py

Download the controller script: NerveController.py

Examples

We include a few examples of how to use the Python controller class matching your driver software. The latest versions of these will be available in the help section of the user interface. We explore a few basic functionalities.

Collecting Counts

This example collects 20 counts messages for each channel from the websocket, at the driver’s current integration time. This should return, for each of the 20 samples, a list of the counts for every channel.

from WebSQController import WebSQController

# Please change this to be the IP address of the driver in your network
websq_domain = 'http://192.168.10.10/'

sq = WebSQController(websq_domain)

# Collects 20 counts messages for every channel.
counts = sq.getNCounts(20)
print(counts)

Download this example

IV Sweeping

This example performs and IV sweep and prints the result for the first channel.

from WebSQController import WebSQController

# Please change this to be the IP address of the driver in your network
websq_domain = 'http://192.168.10.10/'

sq = WebSQController(websq_domain)

traces = sq.sweepIv(0, 50, 1, 100)

channels = list(traces.keys())
first_channel = channels[0]

print(f"Data for channel {first_channel}:")
print("Bias Current (uA):")
print(traces[first_channel]['biasI'])
print("Monitor Voltage (V):")
print(traces[first_channel]['monitorV'])

Download this example

Setting the Bias Current

This is an example of how to set values on the driver for a specific channel.

from WebSQController import WebSQController

# Please change this to be the IP address of the driver in your network
websq_domain = 'http://192.168.10.10/'
sq = WebSQController(websq_domain)

print("Setting the bias current to 20 uA, for channel 1")

sq.setBiasI(20e-6, channels=[1])

print("Getting the bias current value of channel 1:")
print(sq.getBiasI(channels=[1]))

Download this example

Collecting Counts

This example collects 20 counts messages for each channel from the websocket, at the driver’s current integration time. This should return, for each of the 20 samples, a list of the counts for every channel.

from NerveController import NerveController

# Please change this to be the IP address of the driver in your network
nerve_domain = 'http://192.168.10.10/'

sq = NerveController(nerve_domain)

# Collects 20 counts messages for every channel.
counts = sq.getNCounts(20)
print(counts)

Download this example

IV Sweeping

This example starts an IV sweep, waits for it to finish, and prints the result for the first channel.

import time

from NerveController import NerveController

# Please change this to be the IP address of the driver in your network
nerve_domain = 'http://192.168.10.10/'

sq = NerveController(nerve_domain)

sq.startIv(0, 50, 1, 100)

# Wait for the sweep to finish: 51 steps of 100 ms, plus a bit of overhead.
time.sleep(6)
sq.stopIv()

traces = sq.getIvData()

channels = list(traces.keys())
first_channel = channels[0]

print(f"Data for channel {first_channel}:")
print("Bias Current (uA):")
print(traces[first_channel]['biasI'])
print("Monitor Voltage (V):")
print(traces[first_channel]['monitorV'])

Download this example

Setting the Bias Current

This is an example of how to set values on the driver for a specific channel.

from NerveController import NerveController

# Please change this to be the IP address of the driver in your network
nerve_domain = 'http://192.168.10.10/'
sq = NerveController(nerve_domain)

print("Setting the bias current to 20 uA, for channel 1")

sq.setBiasI(20e-6, channels=[1])

print("Getting the bias current value of channel 1:")
print(sq.getBiasI(channels=[1]))

Download this example

Methods

This section contains the full API reference for the Python controller class matching your driver software, generated directly from its docstrings.

class WebSQController.WebSQController(domain=None)

Bases: JsonRpc

This class can send requests to the websq via the JSON RPC protocol. Set the domain of the websq in the initialization.

A lot of funtionality requires the settings object. Function that rely on the settings object can be passed settings as a keyword argument to prevent retrieving the settings object multiple times.

Some functionality accepts the channels parameter. This parameter determines from which channels you pull the data. The channels parameter is a list of ranks or locations of the channels. Ranks can be given as integers, and locations can be given as either a tuple or a list formatted as [mcuId, cuId].

The rankMap specifies the exact location of these detectors. If this is not set (or None) all locations are returned.

close()
startRecording(channels=[])

Turns on recording mode, the data recorded will be returned by the stopRecording command

stopRecording()

Stops recording mode, will return the data which was collected while recording.

convertToRank(rank_or_location)

Takes a channel notation in either rank or location (‘mcuId.cuId’), and converts it to the corresponding rank.

convertToLocation(rank_or_location)

Takes a channel notation in either rank or location (‘mcuId.cuId’), and converts it to the corresponding location.

getChannelInformation(name, channels=[])

Gets the channel information for the quantity “name”.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

a list containing the values read for the requested quantity

Return type:

list

setChannelConfiguration(name, value, channels=None)

Sets the channel configuration name to value.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

setTriggerV(value, channels=None)

Sets the trigger level for the counters for each channel (all selected channels the same value). The trigger voltage is in Volts and must be in the range (-10, 10).

Parameters:
value : float

The trigger level to set (in V) for all channels. Supported range: (-10, 10)V.

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

setBiasI(value, channels=None)

Sets the bias current level for each channel (all selected channels the same value).

Parameters:
value : float

The bias current to set (in A).

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

setChannelValueMultiple(name, values)

Sets an array of values for parameter ‘name’ for all channels.

Parameters:
name : string

Name of the channelunit configuration parameter which you want to change.

values : array

Array of values which you want to assign for all channels. This is assumed to be sorted by rank.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

setBiasIMultiple(values)

Sets the bias current level for each channel given by the array values.

Parameters:
values : array

Array of floats indicating the bias current to set in each channel (in A).

Returns:

updated_settings – The new and updated settings.

Return type:

dict

setTriggerVMultiple(values)

Sets the Trigger level for the counter for each channel given by the array values. The Trigger current for each channel is in V and must be in the range (-10,10) V.

Parameters:
values : array

Array of floats indicating the trigger level in each channel (in V).

Returns:

updated_settings – The new and updated settings.

Return type:

dict

getTriggerV(channels=None)

Gets the trigger level for each channel.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

a list containing the trigger level for each requested channel

Return type:

list

getBiasI(channels=None)

Gets the bias current for each channel.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

a list containing the bias current for each requested channel

Return type:

list

rebootSystem(**params)
getDevices()
getBackend()
getSettings() dict

Gets the settings once, then caches it as a property. reloadSettings() can be called to get the most recent settings

reloadSettings() dict

Clears chached settings requests settings from the api

setSettings(**params)
getIvFile(details='', datatype='txt', devicedetails=True)

Return a file with the latest iv measurement.

Parameters:
details : str

Optionally you can pass some extra details/comments in the file.

datatype : str

The export datatype, either txt, csv, json.

devicedetails : bool

Whether or not to include some extra details of the devices.

Returns:

A dictionary with ivData as the root element.

Return type:

dict

getLog(lines=1000)
getRankMap()
getRankByIds(mcuId, cuId)
getAllLocations()
getAllRanks()
getIntTime()
setIntTime(intTime)

intTime in (ms) should be in steps of 10ms.

getTemperatureData()

Returns all the stored temperature data.

getTemperatures()

Returns the latests temperatures measured

startIv(biasIStart, biasIStop, biasIStep, intTime, channels=None)

Start a IV measurement on the cus of selectedCus or if not provided all of them.

Parameters:
biasIStart : float

The current to start (in uA).

biasIStop : float

The current to stop (in uA)

biasIStep : float

The step size of the sweep (in uA).

intTime : float

The integration time (in ms) of a single step.

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

The the new updated settings you have send to the server.

Return type:

dict

stopIv()

Stop the current IV measurement that is running.

Returns:

Succes if the IV sweep was stopped succesfully.

Return type:

string

getIvData(channels=None)

Get the IV curves of the last measurement.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

A dictionary that maps the location [mcuId, cuId] to a dictionary object that contains the biasI, counts, and monitorV.

Return type:

dict

sweepIv(biasIStart, biasIStop, biasIStep, intTime, overhead=1, channels=None)

Start a IV sweep and then return the measured data. Blocks the thread with a time.sleep.

Parameters:
biasIStart : float

The current to start (in uA).

biasIStop : float

The current to stop (in uA)

biasIStep : float

The step size of the sweep (in uA).

intTime : float

The integration time (in ms) which is the duration of each step.

overhead : float, default=1

Wait overhead seconds longer than necessary because of latency.

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

A dictionary that maps the location [mcuId, cuId] to a dictionary object that contains the biasI, counts, and monitorV.

Return type:

dict

getNMessages(n=1, channels=None, attribute=None)

Retrieves a N number of messages from the driver.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

attribute : str, optional

Attribute can be passed here to only return a list with the value of this attribute. Options: mcuId, cuId, cuStatus, monitorV, biasI, counts, intSize, rank, time.

Returns:

List of N lists of requested attribute for each channel, or a list of N lists of the message dictionaries.

Return type:

list

getMessageNoDelay(channels=None, attribute=None)

Directly returns the latest received messages in the websocket without any delay. WARNING: channel unit messages can be send/received later/earlier then others, so your result can be slightly desynced.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

attribute : str, optional

Attribute can be passed here to only return a list with the value of this attribute. Options: mcuId, cuId, cuStatus, monitorV, biasI, counts, intSize, rank, time.

Returns:

List of requested attribute for each channel, or a list of the message dictionaries.

Return type:

list

getCounts(channels=None)

Get the current counts measurement. The amount of counts during the current integration time.

Parameters:
channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

List of current counts for each channel.

Return type:

list

getNCounts(n=10, channels=None)

Collects an n number of counts, for all the given channels.

Parameters:
n : int, optional

The number of counts to collect.

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

List of length n with counts for each channel.

Return type:

list

transformToArray(data, quantity)

Transform your iv data or counts data to a ‘a x b’ array for quantity

Parameters:
data : dict

Dictionary which is the iv data from getIvData or sweepIv or the counts data from getCounts or collectCounts

quantity : str

This is the name of quantity: biasI, counts, or monitorV for iv data counts, time, monitorV for count data

Returns:

result – list as ‘a x b’ data array where a is the amount of channels in order of the ranks. and b is the amount of data measured.

Return type:

list[list]

getIvHistory()

Gets the IV history for all channels and returns a list of lists with the bias current in the first list and the monitor voltage for each CU as the next.

Returns:

result – the first list is the bias current the other lists are the monitor voltages (V) of the channels sorted by rank.

Return type:

list[list]

getIcHistory()

Gets the IC history for all channels and returns a list of lists with the bias current in the first list and the monitor voltage for each CU as the next.

Returns:

result – the first list is the bias current the other lists are the counts of the channels sorted by rank.

Return type:

list[list]

setNetworkSettings(**params)

Sets the networking settings.

Parameters:
**params

dhcpbool

Wether or not to enable DHCP.

addressstr

The static IP address, in case DHCP is off.

gatewaystr

The gateway IP.

setHostName(hostname)
decode_websocket_msg(msg, attribute=None)

Deconstructs a basic websocket message.

Parameters:
msg : bytes

A byte string of combined channel unit messages. Each channel message is 32 bytes.

attribute : str, optional

You can pass a specific attribute name. If this is given only a list of values for this attribute is returned.

Returns:

result – A list of decoded messages. If no attribute name is passed it will be a dict with all values. Otherwise it will be a list of values for just this attribute.

Return type:

list

class NerveController.NerveController(domain: str)

Bases: JsonRpc

This class can send requests to a SQ Nerve via the JSON RPC protocol. Set the domain of the SQ Nerve in the initialization. SQ Nerve is the latest control software for the Single Quantum Retina as of January 2026.

close()
getChannels() dict[str, dict[str, Any]]

Returns a dictionary with the channels in the system, with the following structure:

{
    channel_number: {
        *channel_parameters*,
    },
    ...
}
getChannelInformation(parameter_name: str, channels: list[int] | None = None) list[Any]

Gets the channel information for the parameter “parameter_name”.

Parameters:
parameter_name : str

The name of the parameter to get.

channels : list, optional

A list of channels given by their channel numbers.

Returns:

a list containing the retrieved values for the requested quantity.

Return type:

list

setChannelUnitsValue(parameter_name: str, value_or_values: Any | list[Any], channels: list[int] | None = None)

Sets the parameter ‘parameter_name’ to ‘value_or_values’ for all given channels. If no channels are provided it will set it for all channels.

Parameters:
parameter_name : str, optional

The name of the parameter to set.

value_or_values : list or float

The value or list of values to set for the parameter. If a single value is provided all channels will be set to that value. If a list is provided it is assumed to be sorted by channel number.

channels : list, optional

A list of channel numbers to set the parameter for. If this is not provided it will select all of them.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

getTriggerV(channels: list[int] | None = None)

Gets the trigger level for each channel.

Parameters:
channels : list, optional

A list of channel numbers to get the trigger level for. If this is not provided it will select all of them.

Returns:

a list containing the trigger level for each requested channel

Return type:

list

setTriggerV(value_or_values: list[float | int], channels: list[int] | None = None)

Sets the trigger level for the counters for each channel (all selected channels the same value). The trigger voltage is in Volts and must be in the range (-10, 10).

Parameters:
value_or_values : float or list

The trigger level to set (in V) for all channels. Supported range: (-10, 10)V. If a list is provided it is assumed to be sorted by channel number. If a single value is provided all channels will be set to that value.

channels : list, optional

A list of channel numbers to set the parameter for. If this is not provided it will select all of them.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

getBiasI(channels: list[int] | None = None)

Gets the bias current for each channel.

Parameters:
channels : list, optional

A list of channel numbers to get the trigger level for. If this is not provided it will select all of them.

Returns:

a list containing the bias current for each requested channel

Return type:

list

setBiasI(value_or_values: list[float | int], channels: list[int] | None = None)

Sets the bias current level for each channel (all selected channels the same value).

Parameters:
value_or_values : float or list

The bias current to set (in A). If a list is provided it is assumed to be sorted by channel number. If a single value is provided all channels will be set to that value.

channels : list, optional

A list of channel numbers to set the parameter for. If this is not provided it will select all of them.

Returns:

updated_settings – The new and updated settings.

Return type:

dict

restartSoftware(delay: int = 0)

Restarts the software.

Parameters:
delay : int

Optionally a delay can be passed in seconds.

getSettings() dict

Gets the current Retina driver settings.

setSettings(**params: Any) dict

Set new Retina driver settings and overwrite only provided fields.

getIntTime() int

Get the integration time in milliseconds.

setIntTime(intTime: int) dict

Set integration time in milliseconds.

setStreamState(state: bool) dict

Turn the counts stream on or off.

getLog(lines: int = 1000) list[dict]

Returns the current log object.

Parameters:
lines : int

The number of lines/entries to get from the log

Returns:

log – The log structed as a list of dictionary objects.

Return type:

list[dict]

getTemperatureData() dict

Returns all the stored temperature data.

getTemperatures() tuple[float, float | None]

Return the latest measured temperatures for sensor 1 and sensor 2.

startIv(biasIStart: float, biasIStop: float, biasIStep: float, intTime: float, channels: list[int] | None = None)

Start a IV measurement on the selected channels or if not provided all of them.

Parameters:
biasIStart : float

The current to start (in uA).

biasIStop : float

The current to stop (in uA)

biasIStep : float

The step size of the sweep (in uA).

intTime : float

The integration time (in ms) of a single step.

channels : list, optional

A list of channels given as either their rank or their location. The location of a channel is given as ‘mcuId.cuId’. If this is not provided it will select all of them.

Returns:

The the new updated settings you have send to the server.

Return type:

dict

stopIv() str

Stop the current IV measurement that is running.

Returns:

Success if the IV sweep was stopped successfully.

Return type:

string

getIvData(raw: bool = False) dict

Get the data of the latest IV sweep.

Parameters:
raw : bool

If True, return the raw driver payload under data.

Returns:

A dictionary which either contains the raw data from the driver if raw is True, or a processed dictionary with lists of biasI, counts, monitorV and integration_time per channel. The keys in this dictionary are the channel numbers.

Return type:

dict

getNMessages(n: int = 1, channels: list[int] | None = None, attribute: str | None = None) list[Any]

Retrieves a N number of messages from the driver.

Parameters:
n : int

Number of integration intervals to collect.

channels : list, optional

Channel numbers to include. If not provided, all channels are used.

attribute : str, optional

Optional field to extract from each message. Valid options are: intTime, status, channel_number, counts.

Returns:

List of N lists of requested attribute for each channel, or a list of N lists of the message dictionaries.

Return type:

list

getMessageNoDelay(channels: list[int] | None = None, attribute: str | None = None)

Directly returns the latest received messages in the websocket without any delay. WARNING: channel unit messages can be send/received later/earlier then others, so your result can be slightly desynced.

Parameters:
channels : list, optional

Channel numbers to include. If not provided, all channels are used.

attribute : str, optional

Attribute can be passed here to only return a list with the value of this attribute. Options: mcuId, cuId, cuStatus, monitorV, biasI, counts, intSize, rank, time.

Returns:

List of requested attribute for each channel, or a list of the message dictionaries.

Return type:

list

getCounts(channels: list[int] | None = None)

Get the current counts measurement. The amount of counts during the current integration time.

Parameters:
channels : list, optional

Channel numbers to include. If not provided, all channels are used.

Returns:

List of current counts for each channel.

Return type:

list

getNCounts(n: int = 10, channels: list[int] | None = None)

Collects an n number of counts, for all the given channels.

Parameters:
n : int

The number of counts to collect.

channels : list, optional

Channel numbers to include. If not provided, all channels are used.

Returns:

List of length n with counts for each channel.

Return type:

list

transformToArray(iv_data: dict, quantity: str)

Transform your iv data or counts data to an array for quantity

Parameters:
iv_data : dict

Dictionary which is the iv data from getIvData or sweepIv or the counts data from getCounts or collectCounts

quantity : str

This is the name of quantity: biasI, counts, or monitorV for iv data counts, time, monitorV for count data

Returns:

result – Two-dimensional array where the first row is biasI and each following row contains quantity values for one channel.

Return type:

list[list]

getIvHistory()

Gets the IV history for all channels and returns a list of lists with the bias current in the first list and the monitor voltage for each CU as the next.

Returns:

result – the first list is the bias current the other lists are the monitor voltages (V) of the channels sorted by rank.

Return type:

list[list]

getIcHistory()

Gets the IC history for all channels and returns a list of lists with the bias current in the first list and counts for each CU in following lists.

Returns:

result – the first list is the bias current the other lists are the counts of the channels sorted by rank.

Return type:

list[list]