electrode_board
The ‘electrode_board’ module provides support for working with board definition files.
- class purpledrop.electrode_board.Board(board_def: Dict[str, Any])[source]
Represents the top-level object in an electrode board definition file
- static load_from_string(data: AnyStr) purpledrop.electrode_board.Board[source]
Create a board from a JSON string in memory
- class purpledrop.electrode_board.ControlPoint(grid_coord: Tuple[float, float], image_coord: Tuple[float, float])[source]
Represents a control point in an image
A control point is a pair of corresponding points – one in image coordinates and the other in grid coordinates – used to calibrate the position of the electrode grid relative to fiducials.
- class purpledrop.electrode_board.Fiducial(corners: List[List[int]], label: str = '')[source]
Represents a fiducial location
- class purpledrop.electrode_board.Layout(layout_def: Dict[str, Any])[source]
Represents the ‘layout’ property of a baord definition
A layout defines the placement and pin mapping for the electrodes on the board.
- grid_location_to_pin(x: int, y: int, grid_number: int = 0)[source]
Return the pin number at given grid location, or None if no pin is defined there.
- class purpledrop.electrode_board.Registration(data: dict)[source]
A registration is a collection of fiducials and control points which together define relationship between the electrode locations and fiducials
- purpledrop.electrode_board.list_boards()[source]
Find all available board definitions.
Uses same search rules as load_board; see
load_board().- Returns
A list of board names, which can be passed to load_board
- purpledrop.electrode_board.load_board(name) Optional[purpledrop.electrode_board.Board][source]
Load a board definition by name or path
Attempt to load a board definition from the name, using the following priorities (the first to succeed is returned):
Load as a full path
Load from ~/.config/purpledrop/boards/{name}.json
Load from package resources (purpledrop/boards in repo)
- purpledrop.electrode_board.load_peripheral(pdata, templates=None)[source]
Load a peripheral from a dict
This loads a peripheral with support for templates, as used in the board definition file format
- Parameters
pdata – A dict containing the peripheral definition
templates – A dict mapping types to template definitions