Application Programming Interface

The main interface to controlling your TMS coil with localite-flow

Localite Flow

start(host)[source]

starts the localite-flow as a subprocess

You can stop the subprocess gracefully using kill()

Parameters

host (str) – the ip adress of the localite PC

kill(ext=('127.0.0.1', 6667))[source]

kill the localite-flow at the given address, whether it runs as a subprocess or in a local thread

Parameters

ext (Tuple[str, int] = ("127.0.0.1", 6667)) – the host:port where the localite-flow server was setup

Controlling the Coil

Before you can control the coil and read its parameters, make sure the localite-flow is running, e.g. with start() or using the command-line-interface.

User-interface to control the TMS

class Coil(coil=0, address=('127.0.0.1', 6667))[source]

Coil is a user-friendly interface to control the TMS and Localite

args

coil: int = 0

the coil to control, either 0 or 1

address: Tuple[str, int] = (“127.0.0.1”, 6667)

the host, port of the EXT server of the localite-flow

property amplitude

set the amplitude to MSO%

Return type

int

property connected

whether a stimulator is connected or not

Return type

bool

property didt

the di/dt of the last succesfull TMS pulse

Return type

Optional[int]

property id

The coils id {0,1}

localite can control 2 coils, this parameter identifies which one is controlled by this instance. Indexing starts at 0.

property mode

the mode of the stimulator

can be e.g. ‘Power’, ‘Twin’, ‘Dual’, ‘Standard’

Return type

str

property model

the name of the stimulator model

e.g. ‘MagVenture 65 X100 + Option’

Return type

str

property position

the current position of the coil

e.g. {“q0”: 17.0,”qx”: 17.0, “qy”: 17.0, “qz”: 17.0,

“x”: 37, “y”: 77, “z”: 53}

Return type

Optional[dict]

property position_reached

whether the target position has been reached or not

Return type

bool

push_marker(marker)[source]

pushes a str to the Marker-Stream running in the background

request(msg)[source]

add the coil id to the message and request a property from localite

Note

at least 1.5 seconds have to pass between queries, otherwise a cached answer to the request will be returned. This was necessary to prevent clogging and missed values from repeated requests.

Return type

Any

property target_index

get the current targets index

Return type

int

trigger()[source]

trigger a single pulse

property visible

whether the coil can be seen by the NDI camera or not

Return type

bool

property waveform

the waveform currently set in the stimulator

can be e.g. ‘Monophasic’, ‘Biphasic’, ‘Halfsine’, ‘Biphasic Burst’

Return type

str