Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs/apidoc/Bonsai_SpikeGLX_Trigger.md

This file was deleted.

7 changes: 7 additions & 0 deletions docs/apidoc/Bonsai_SpikeGLX_TriggerGT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
uid: Bonsai.SpikeGLX.TriggerGT
---

> [!WARNING]
> [`TriggerGT`](xref:Bonsai.SpikeGLX.TriggerGT) works only with SpikeGLX runs configured to use **remote controlled start and stop** triggering.
[!include[TriggerGT](~/articles/spikeglx-triggerGT.md)]
10 changes: 5 additions & 5 deletions docs/articles/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It is designed to supplement the core functionalities of SpikeGLX (*i.e.*, visua
`Bonsai.SpikeGLX` provides three ways of interacting with an ongoing SpikeGLX run:
- streaming data from SpikeGLX into Bonsai with [`Fetch`];
- controlling SpikeGLX digital output lines with [`DigitalOutput`]; and
- starting and stopping recordings with [`Trigger`].
- starting and stopping recordings with [`TriggerGT`].

A brief summary of the functionality of each of these operators is provided here. A more detailed description of each may be found on the associated Reference page.

Expand All @@ -20,18 +20,18 @@ A brief summary of the functionality of each of these operators is provided here
[!include[DigitalOutput](~/articles/spikeglx-digitaloutput.md)]

## Save Data
SpikeGLX is expressly designed for saving Neuropixels data. As a result, it is recommended to use SpikeGLX's built-in capabilities to save your data; however, `Bonsai.SpikeGLX` provides ways to control which parts of a run SpikeGLX should save. If a SpikeGLX run is configured to use "remote controlled start and stop" triggering, [`Trigger`] may be used to set gate and trigger values.
SpikeGLX is expressly designed for saving Neuropixels data. As a result, it is recommended to use SpikeGLX's built-in capabilities to save your data; however, `Bonsai.SpikeGLX` provides ways to control which parts of a run SpikeGLX should save. If a SpikeGLX run is configured to use "remote controlled start and stop" triggering, [`TriggerGT`] may be used to set gate and trigger values.

[!include[Trigger](~/articles/spikeglx-trigger.md)]
[!include[TriggerGT](~/articles/spikeglx-triggerGT.md)]

> [!NOTE]
> SpikeGLX also provides the ability to trigger recordings using a TTL line. In some cases, this may be preferred over using [`Trigger`].
> SpikeGLX also provides the ability to trigger recordings using a TTL line. In some cases, this may be preferred over using [`TriggerGT`].

If you do wish to save data you have streamed into Bonsai using [`Fetch`], you can use the [`MatrixWriter`] operator from the `Bonsai.Dsp` package.

<!--Reference Style Links -->
[`Fetch`]: xref:Bonsai.SpikeGLX.Fetch
[`DigitalOutput`]: xref:Bonsai.SpikeGLX.DigitalOutput
[`Trigger`]: xref:Bonsai.SpikeGLX.Trigger
[`TriggerGT`]: xref:Bonsai.SpikeGLX.TriggerGT
[`Timer`]: xref:Bonsai.Reactive.Timer
[`MatrixWriter`]: xref:Bonsai.Dsp.MatrixWriter
17 changes: 0 additions & 17 deletions docs/articles/spikeglx-trigger.md

This file was deleted.

13 changes: 13 additions & 0 deletions docs/articles/spikeglx-triggerGT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
uid: spikeglx-trigger
title: TriggerGT
---

For example, the below workflow starts a new gate immediately, and then toggles the trigger every five seconds. This results in SpikeGLX saving five-second periods of the run every ten seconds.

:::workflow
![TriggerGT](../workflows/GettingStarted-TriggerGT.bonsai)
:::

<!--Reference Style Links -->
[`TriggerGT`]: xref:Bonsai.SpikeGLX.TriggerGT
158 changes: 0 additions & 158 deletions docs/workflows/GettingStarted-Trigger.bonsai

This file was deleted.

61 changes: 61 additions & 0 deletions docs/workflows/GettingStarted-TriggerGT.bonsai
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.9.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:glx="clr-namespace:Bonsai.SpikeGLX;assembly=Bonsai.SpikeGLX"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="Annotation">
<Name>Set Gate</Name>
<Text><![CDATA[]]></Text>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="glx:TriggerGT">
<glx:Host>localhost</glx:Host>
<glx:Port>4142</glx:Port>
<glx:Gate>SetHigh</glx:Gate>
<glx:Trigger>SetLow</glx:Trigger>
</Combinator>
</Expression>
<Expression xsi:type="Annotation">
<Name>Toggle Trigger</Name>
<Text><![CDATA[]]></Text>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Timer">
<rx:DueTime>PT5S</rx:DueTime>
<rx:Period>PT10S</rx:Period>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="glx:TriggerGT">
<glx:Host>localhost</glx:Host>
<glx:Port>4142</glx:Port>
<glx:Gate>NoChange</glx:Gate>
<glx:Trigger>SetHigh</glx:Trigger>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Delay">
<rx:DueTime>PT5S</rx:DueTime>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="glx:TriggerGT">
<glx:Host>localhost</glx:Host>
<glx:Port>4142</glx:Port>
<glx:Gate>NoChange</glx:Gate>
<glx:Trigger>SetLow</glx:Trigger>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
4 changes: 3 additions & 1 deletion src/Bonsai.SpikeGLX/DigitalOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ namespace Bonsai.SpikeGLX
/// a sequence of values representing the state of the line.
/// </summary>
[Combinator]
[Description("Sets one or more digital output lines through SpikeGLX from a sequence of values representing the state of the line.")]
[WorkflowElementCategory(ElementCategory.Sink)]
[Description("Sets one or more digital output lines through SpikeGLX from a sequence of values representing the state of the line.")]
public class DigitalOutput
{
/// <summary>
/// Gets or sets the IP address of the SpikeGLX command server.
/// </summary>
[Category("Command Server")]
[Description("The IP address of the SpikeGLX command server.")]
public string Host { get; set; } = "localhost";

/// <summary>
/// Gets or sets the port of the SpikeGLX command server.
/// </summary>
[Category("Command Server")]
[Description("The port of the SpikeGLX command server.")]
public int Port { get; set; } = 4142;

Expand Down
18 changes: 10 additions & 8 deletions src/Bonsai.SpikeGLX/Fetch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,32 @@ namespace Bonsai.SpikeGLX
/// <summary>
/// Represents an operator that generates a sequence of data buffers from a SpikeGLX data stream.
/// </summary>
[Description("Streams buffers of data from a SpikeGLX data stream.")]
[Combinator(MethodName = nameof(Generate))]
[WorkflowElementCategory(ElementCategory.Source)]
[Description("Streams buffers of data from a SpikeGLX data stream.")]
public class Fetch : Source<Mat>
{
/// <summary>
/// Gets or sets the duration of fetched data buffers, in ms.
/// </summary>
[Description("Duration of streamed data buffers, in ms.")]
public int BufferLength { get; set; } = 1000;

/// <summary>
/// Gets or sets the IP address of the SpikeGLX command server
/// </summary>
[Category("Command Server")]
[Description("IP address of the SpikeGLX command server." +
"\"localhost\" evaluates to 127.0.0.1.")]
public string Host { get; set; } = "localhost";

/// <summary>
/// Gets or sets the port of the SpikeGLX command server.
/// </summary>
[Category("Command Server")]
[Description("Port of the SpikeGLX command server.")]
public int Port { get; set; } = 4142;

/// <summary>
/// Gets or sets the duration of fetched data buffers, in ms.
/// </summary>
[Description("Duration of streamed data buffers, in ms.")]
public int BufferLength { get; set; } = 1000;

/// <summary>
/// Gets or sets the stream type (0: NIDAQ, 1: Onebox, 2: IMEC Probe).
/// </summary>
Expand Down Expand Up @@ -173,4 +175,4 @@ public IObservable<Mat> Generate<TSource>(IObservable<TSource> source)
.RefCount();
}
}
}
}
Loading