ephys_link.common

Commonly used functions and dictionaries

Contains globally used helper functions and typed dictionaries (to be used as callback parameters)

Functions

dprint

Print message if debug is enabled.

Classes

AngularOutputData

Output format for manipulator angle requests.

CanWriteInputDataFormat

Data format for setting can write state.

DriveToDepthInputDataFormat

Data format for depth driving requests.

DriveToDepthOutputData

Output format for depth driving.

GetManipulatorsOutputData

Output format for get manipulators request.

GotoPositionInputDataFormat

Data format for positional requests.

InsideBrainInputDataFormat

Data format for setting inside brain state.

PositionalOutputData

Output format for positional requests.

ShankCountOutputData

Output format for number of shanks.

StateOutputData

Output format for boolean state requests.

dprint(message: str) None[source]

Print message if debug is enabled.

Parameters:

message (str) – Message to print.

Returns:

None

class GotoPositionInputDataFormat[source]

Bases: TypedDict

Data format for positional requests.

Parameters:
  • manipulator_id (str) – ID of the manipulator to move.

  • pos (list[float]) – Position to move to in mm (X, Y, Z, W).

  • speed (float) – Speed to move at in mm/s.

manipulator_id: str
pos: list[float]
speed: float
class InsideBrainInputDataFormat[source]

Bases: TypedDict

Data format for setting inside brain state.

Parameters:
  • manipulator_id (str) – ID of the manipulator to move.

  • inside (bool) – Whether the manipulator is inside the brain.

manipulator_id: str
inside: bool
class DriveToDepthInputDataFormat[source]

Bases: TypedDict

Data format for depth driving requests.

Parameters:
  • manipulator_id (str) – ID of the manipulator to move.

  • depth (float) – Depth to drive to in mm.

  • speed (float) – Speed to drive at in mm/s.

manipulator_id: str
depth: float
speed: float
class CanWriteInputDataFormat[source]

Bases: TypedDict

Data format for setting can write state.

Parameters:
  • manipulator_id (str) – ID of the manipulator to move.

  • can_write (bool) – Whether the manipulator can write.

  • hours (float) – Number of hours the manipulator can write for.

manipulator_id: str
can_write: bool
hours: float
class GetManipulatorsOutputData(manipulators: list, num_axes: int, dimensions: list, error: str)[source]

Bases: dict

Output format for get manipulators request.

Parameters:
  • manipulators (list) – List of manipulator IDs (as strings).

  • num_axes (int) – Number of axes this manipulator has.

  • dimensions (list) – Size of the movement space in mm (first 3 axes).

  • error (str) – Error message.

Example:

Example generated dictionary {"manipulators": ["1", "2"], "num_axes": 4, "dimensions": [20, 20, 20], "error": ""}

json() str[source]

Return JSON string

class PositionalOutputData(position: list, error: str)[source]

Bases: dict

Output format for positional requests.

Parameters:
  • position (list) – Position in mm (as a list, empty on error) in X, Y, Z, W order.

  • error (str) – Error message.

Example:

Example generated dictionary {"position": [10.429, 12.332, 2.131, 12.312], "error": ""}

json() str[source]

Return JSON string

class AngularOutputData(angles: list, error: str)[source]

Bases: dict

Output format for manipulator angle requests.

Parameters:
  • angles (list) – Angles in degrees (as a list, can be empty) in yaw, pitch, roll order.

  • error (str) – Error message.

json() str[source]

Return JSON string

class ShankCountOutputData(shank_count: int, error: str)[source]

Bases: dict

Output format for number of shanks.

Parameters:
  • shank_count (int) – Number of shanks on the probe (-1 if error).

  • error (str) – Error message.

json() str[source]

Return JSON string

class DriveToDepthOutputData(depth: float, error: str)[source]

Bases: dict

Output format for depth driving.

Parameters:
  • depth (float) – Depth in mm (0 on error).

  • error (str) – Error message.

Example:

Example generated dictionary {"depth": 1.23, "error": ""}

json() str[source]

Return JSON string

class StateOutputData(state: bool, error: str)[source]

Bases: dict

Output format for boolean state requests.

Parameters:
  • state (bool) – State of the event.

  • error (str) – Error message.

Example:

Example generated dictionary {"state": True, "error": ""}

json() str[source]

Return JSON string