Python Module API
Syntalos provides a Python API to easily build new modules. Python modules do not
run within the Syntalos process, and instead communicate with the main application
via an interface provided by the syntalos_mlink
Python module.
This API can be used from either the Python Script module, or by
standalone modules that are written in Python entirely.
The Python interface is documented below.
syntalos_mlink
Syntalos Python Module Interface
__init__(args, *kwargs) Overloaded function.
__init__(self: VectorDouble) -> None
__init__(self: VectorDouble, arg0: list[float]) -> None
Copy constructor
- __init__(self: VectorDouble, arg0: Iterable) -> None
count(self: list[float], x: float) -> int
Return the number of times x
appears in the list
remove(self: list[float], x: float) -> None
Remove the first item from the list whose value is x. It is an error if there is no such item.
extend(args, *kwargs) Overloaded function.
- extend(self: list[float], L: list[float]) -> None
Extend the list by appending all the items in the given list
- extend(self: list[float], L: Iterable) -> None
Extend the list by appending all the items in the given list
Common base class for all non-exit exceptions.
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
- add_note
- args
print_types_synonyms() -> None
list_types_synonyms() -> object
init_link(slink: SyntalosLink = None) -> SyntalosLink
Initialize the connection with a running Syntalos instance.
Representation of a module input port.
set_throttle_items_per_sec(self: InputPort, items_per_sec: int) -> None
Limit the amount of input received to a set amount of elements per second.
Representation of a module output port.
submit(self: OutputPort, arg0: object) -> None
Submit the given entity to the output port for transfer to its destination(s).
set_metadata_value(self: OutputPort, arg0: str, arg1: object) -> None
Set (immutable) metadata value for this port.
set_metadata_value_size(self: OutputPort, arg0: str, arg1: object) -> None
Set (immutable) metadata value for a 2D size type for this port.
firmata_register_digital_pin(self: OutputPort, pin_id: int, name: str, is_output: bool, is_pullup: bool = False) -> FirmataControl
Convenience function to create a command to register a named digital pin and immediately submit it on this port. The registered pin can later be referred to by its name.
firmata_submit_digital_value(self: OutputPort, name: str, value: bool) -> FirmataControl
Convenience function to write a digital value to a named pin.
firmata_submit_digital_pulse(self: OutputPort, name: str, duration_msec: int = 50) -> FirmataControl
Convenience function to emit a digital pulse on a named pin.
A video frame.
Members:
UNKNOWN
START
PAUSE
STOP
STEP
CUSTOM
__init__(args, *kwargs) Overloaded function.
__init__(self: ControlCommand) -> None
__init__(self: ControlCommand, arg0: ControlCommandKind) -> None
Members:
UNKNOWN
NEW_DIG_PIN
NEW_ANA_PIN
IO_MODE
WRITE_ANALOG
WRITE_DIGITAL
WRITE_DIGITAL_PULSE
SYSEX
__init__(args, *kwargs) Overloaded function.
__init__(self: FirmataControl) -> None
__init__(self: FirmataControl, arg0: FirmataCommandKind) -> None
A block of timestamped integer signal data.
A block of timestamped float signal data.
println(text: str) -> None
Print text to stdout.
raise_error(message: str) -> None
Emit an error message string, immediately terminating the current action and (if applicable) the experiment.
time_since_start_msec() -> int
Get time since experiment started in milliseconds.
time_since_start_usec() -> int
Get time since experiment started in microseconds.
wait(msec: int) -> None
Wait (roughly) for the given amount of milliseconds without blocking communication with the master process.
wait_sec(sec: int) -> None
Wait (roughly) for the given amount of seconds without blocking communication with the master process.
await_data(timeout_usec: int = -1) -> None
Wait for new data to arrive and call selected callbacks. Also keep communication with the Syntalos master process.
is_running() -> bool
Return True if the experiment is still running, False if we are supposed to shut down.
schedule_delayed_call(delay_msec: int, callable_fn: Callable[[], None]) -> None
Schedule call to a callable to be processed after a set amount of milliseconds.
get_input_port(id: str) -> object
Get reference to input port with the give ID.
get_output_port(id: str) -> object
Get reference to output port with the give ID.
call_on_show_settings(callable_fn: Callable[[QByteArray], None]) -> None
Call the given function when the module's settings dialog should be shown.
call_on_show_display(callable_fn: Callable[[], None]) -> None
Call the given function when the module's display window should be shown.
save_settings(settings_data: QByteArray) -> None
Send module settings data to Syntalos for safekeeping.
new_firmatactl_with_id_name(kind: FirmataCommandKind, pin_id: int, name: str) -> FirmataControl
Create new Firmata control command with a given pin ID and registered name.
new_firmatactl_with_id(kind: FirmataCommandKind, pin_id: int) -> FirmataControl
Create new Firmata control command with a given pin ID.
new_firmatactl_with_name(kind: FirmataCommandKind, name: str) -> FirmataControl
Create new Firmata control command with a given pin name (the name needs to be registered previously).