Class StimTrigger
JSON configuration
Use these block entries inside a pipeline configuration. Input names must match other blocks in that pipeline; device addresses and file paths must match your setup.
JSON configuration:
{
"StimGate": {
"Type": "StimTrigger",
"Inputs": [ "Stimulus" ],
"DesiredRate": 200,
"Path": "C:/Data/session1"
}
}
Params: None. Requires exactly one input (a Stimulus block).
How Type, Inputs and Params work · Block catalogue and parameter reference
Implements
Inherited Members
Namespace: MOSAIC.Models.FlowControl
Assembly: MOSAIC.dll
Syntax
public class StimTrigger : BaseBlock, INotifyPropertyChanged, INotifyPropertyChanging, ISubscriber, IPublisher, IBaseBlockProps, IJsonExportable, IDisposable, IAsyncDisposable
Remarks
Overview: The StimTrigger listens for (string state, Vector<double> target)
tuples from a Stimulus block. When the state is "capture", the target vector is
published downstream (signalling the Buffer to start collecting and providing the target).
When the state transitions away from "capture", null is published
(signalling the Buffer to stop and finalise the segment).
State machine:
"capture"received → publish target vector, set IsCapturing = true.- Any other state received while capturing → publish null, set IsCapturing = false.
- Non-capture states while not capturing → ignored (no publish).
CSV logging: When a Path is specified, Dumper
automatically logs the published target vector during capture via Publish(object).
The null stop signal is silently skipped by the dumper.
Constructors
StimTrigger(string, double)
Initializes a new StimTrigger block.
Declaration
public StimTrigger(string name = "StimTrigger", double desiredRate = 200)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Display name of the block. |
| double | desiredRate | Desired processing rate in Hz. |
Fields
_isCapturing
Backing field for IsCapturing.
Declaration
private bool _isCapturing
Field Value
| Type | Description |
|---|---|
| bool |
Properties
DumpFilePrefix
Recordings from this block are named <block>_trigger.csv.
Declaration
protected override string DumpFilePrefix { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
IsCapturing
Gets a value indicating whether the block is currently in the capturing state
(i.e., the upstream Stimulus is in its "capture" phase).
Declaration
public bool IsCapturing { get; private set; }
Property Value
| Type | Description |
|---|---|
| bool |
JsonTypeName
Block type identifier for JSON serialization. Override for a custom name.
Declaration
protected override string JsonTypeName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
Methods
ConfigureInput(IServiceProvider, JsonModel)
Creates a StimTrigger from a JSON pipeline definition.
Declaration
public static StimTrigger ConfigureInput(IServiceProvider sp, JsonModel m)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceProvider | sp | Service provider for dependency injection. |
| JsonModel | m | JSON model. Must have exactly one input (a Stimulus block). |
Returns
| Type | Description |
|---|---|
| StimTrigger | A configured StimTrigger instance. |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown if the input count is not exactly 1. |
OnReceive(object, object)
Handles input from the connected Stimulus block. Publishes the target vector during capture and null when capture ends.
Declaration
protected override void OnReceive(object sender, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | sender | The upstream Stimulus block. |
| object | value | Expected to be a |