g.USBamp
- class gpype.backend.sources.g_usbamp.GUSBamp[source]
Bases:
AmplifierSourceg.USBamp biosignal amplifier for real-time data acquisition.
Interface to g.tec’s g.USBamp wired biosignal amplifier.
- NUM_TIMELINE_CHANNELS = 1
- class Configuration[source]
Bases:
ConfigurationConfiguration class for g.USBamp amplifier parameters.
- class Keys[source]
Bases:
KeysConfiguration key constants for the g.USBamp amplifier.
Every key here is mandatory, so only settings the device reports back belong in it – those are always resolved to a concrete value before the configuration is built.
- ENABLE_TRIGGER = 'enable_trigger'
Configuration key for enabling the digital trigger channel
- ENABLE_COUNTER = 'enable_counter'
Configuration key for enabling counter channel
- COMMON_GROUND = 'common_ground'
Configuration key for per-group common ground
- COMMON_REFERENCE = 'common_reference'
Configuration key for per-group common reference
- SHORTCUT_ENABLED = 'shortcut_enabled'
Configuration key for the g.USBamp shortcut
- class OptionalKeys[source]
Bases:
OptionalKeysConfiguration keys that may legitimately be absent.
- BIPOLAR_CHANNELS = 'bipolar_channels'
Configuration key for per-channel bipolar derivation.
Optional rather than required because the driver exposes no read-back for it and None does not mean “unipolar”: it means the device’s own per-channel setting is left untouched. Substituting a list of zeros to satisfy a mandatory key would quietly change that to “set every channel unipolar”.
- SERIAL = 'serial'
The serial of the unit that opened, wherever one did. A process that opens no device – a server, or a replay – keeps None, which means what it meant to the author: whichever amplifier answers first.
- __init__(serial=None, sampling_rate=None, channel_count=None, frame_size=None, enable_trigger=None, enable_counter=None, common_ground=None, common_reference=None, shortcut_enabled=None, bipolar_channels=None, enable_oscar=False, edge_id=None, **kwargs)[source]
Initialize g.USBamp amplifier interface.
- Parameters:
serial (
str) – Device serial number. Uses first available if None.sampling_rate (
float) – Sampling frequency in Hz.channel_count (
int) – Number of channels to acquire.frame_size (
int) – Samples per data frame (NumberOfScans).enable_trigger (
bool) – Enable the digital trigger channel, which is appended after the acquired channels.enable_counter (
bool) – Enable the counter, which overwrites a channel rather than adding one. Measured to occupy physical channel 16, so it is only visible when all 16 channels are acquired.common_ground (
list) – Four booleans, one per channel group.common_reference (
list) – Four booleans, one per channel group.shortcut_enabled (
bool) – Enable the g.USBamp shortcut.bipolar_channels (
list) – Reference channel number per channel, 0 to derive that channel unipolar.enable_oscar (
bool) – Run OSCAR artifact removal on this stream.edge_id (
Optional[str]) – Which edge runs this node, matched against the edge process’s –edge-id. None, the default, is every edge; ignored when the pipeline is not distributed.**kwargs – Additional parameters for AmplifierSource.
- Raises:
NotImplementedError – If not running on Windows.
RuntimeError – If GDS library unavailable or device init fails.
ValueError – If a rate, frame size or channel count is not a whole number, or if a group list does not have one entry per channel group.
- channel_units()[source]
One ‘uV’ per acquired channel (vendor/gds-headers’s
GDSClientAPI_gUSBamp.h:GDS_GUSBAMP_SCALING.Offsetis in microvolts), None for the digital trigger when enabled, and None for the arrival stamp. A channel enablingenable_counteroverwrites a measured channel at a position this node does not track (seesetup’s docstring), so it is still declared ‘uV’.
- setup(data, port_context_in)[source]
Mark the digital trigger as a trigger, and stamp beside it.
The trigger is the only channel appended after the acquired ones, so its position is unambiguous. Saying it is a trigger is what keeps a filter off it: a bandpass turns an edge into a decaying oscillation, and nothing about the result announces that it was ever an event.
The configuration counts the channels handed to the driver, so the trigger is added here, on the port, and the arrival stamp after it.
Enabling the counter overwrites a measured channel rather than appending one, so it stays inside the measured block and the trigger’s position is unaffected either way. Its role is left as signal: the driver does not report that a channel was overwritten, and inferring the position from
enable_counterwould relabel a real electrode – measured, the counter reaches the stream only when all 16 channels are acquired, and g.HIamp puts it somewhere else again.
- start()[source]
Start g.USBamp data acquisition.
Initiates hardware data streaming and activates the amplifier for real-time biosignal processing.
- Return type: