Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 12, 2024
1 parent 7e9f47e commit ce99816
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Software Guide/Bonsai.ONIX/Nodes/AnalogIODevice.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,13 @@ <h2>Configuration<a class="headerlink" href="#configuration" title="Link to this
</tbody>
</table>
</section>
<section id="loading-scripts">
<h2>Loading Scripts<a class="headerlink" href="#loading-scripts" title="Link to this heading">#</a></h2>
<p>The following scripts can be used to load the data produced by this workflow in Python (using Numpy):</p>
<ul class="simple">
<li><p><a class="reference download internal" download="" href="../../../_downloads/5dbab7913e2369375757c80cc6cc682b/load-analog-data.py"><code class="xref download docutils literal notranslate"><span class="pre">load-analog-data.py</span></code></a></p></li>
</ul>
</section>
</section>

<script type="text/javascript">
Expand Down Expand Up @@ -607,6 +614,7 @@ <h2>Configuration<a class="headerlink" href="#configuration" title="Link to this
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#configuration">Configuration</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#loading-scripts">Loading Scripts</a></li>
</ul>
</nav></div>

Expand Down
14 changes: 14 additions & 0 deletions _downloads/5dbab7913e2369375757c80cc6cc682b/load-analog-data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np
import matplotlib.pyplot as plt

# Load data from AnalogIO workflow
suffix = '2024-04-11T12_24_25'; # Change to match file names' suffix

analog_time = np.fromfile('analog-clock_' + suffix + '.raw', dtype=np.uint64) / 250e6
analog_data = np.fromfile('analog-data_' + suffix + '.raw', dtype=np.float32)
analog_data = np.reshape(analog_data, (-1, 12))


# plot the first 100k samples on each channel (1 second of data)
plt.close('all')
plt.plot(analog_time[0:100000], analog_data[0:100000, :])
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ options.
- The direction of the channel. If set to Output, the measured voltage is
automatically looped back through the analog input.

Loading Scripts
--------------------------
The following scripts can be used to load the data produced by this workflow in Python (using Numpy):

- :download:`load-analog-data.py <../../../_static/bonsai/workflows/load-analog-data.py>`
23 changes: 21 additions & 2 deletions _static/bonsai/workflows/AnalogIO.bonsai
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.6.2"
<WorkflowBuilder Version="2.8.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p1="clr-namespace:Bonsai.ONIX;assembly=Bonsai.ONIX"
xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
Expand Down Expand Up @@ -69,14 +70,32 @@
<Expression xsi:type="MemberSelector">
<Selector>Data</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:MatrixWriter">
<dsp:Path>analog-data_.raw</dsp:Path>
<dsp:Suffix>Timestamp</dsp:Suffix>
<dsp:Overwrite>false</dsp:Overwrite>
<dsp:Layout>ColumnMajor</dsp:Layout>
</Combinator>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Clock</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="dsp:MatrixWriter">
<dsp:Path>analog-clock_.raw</dsp:Path>
<dsp:Suffix>Timestamp</dsp:Suffix>
<dsp:Overwrite>false</dsp:Overwrite>
<dsp:Layout>ColumnMajor</dsp:Layout>
</Combinator>
</Expression>
</Nodes>
<Edges>
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="2" To="4" Label="Source1" />
<Edge From="2" To="5" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="5" To="6" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
4 changes: 2 additions & 2 deletions _static/bonsai/workflows/AnalogIO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions _static/bonsai/workflows/load-analog-data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np
import matplotlib.pyplot as plt

# Load data from AnalogIO workflow
suffix = '2024-04-11T12_24_25'; # Change to match file names' suffix

analog_time = np.fromfile('analog-clock_' + suffix + '.raw', dtype=np.uint64) / 250e6
analog_data = np.fromfile('analog-data_' + suffix + '.raw', dtype=np.float32)
analog_data = np.reshape(analog_data, (-1, 12))


# plot the first 100k samples on each channel (1 second of data)
plt.close('all')
plt.plot(analog_time[0:100000], analog_data[0:100000, :])
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit ce99816

Please sign in to comment.