Skip to content

Commit

Permalink
Merge pull request #14 from fchampalimaud/JG_typos_correction
Browse files Browse the repository at this point in the history
Correction of some typos
  • Loading branch information
ZegCricket authored Aug 16, 2024
2 parents eb60b00 + 417ff55 commit 180bbf4
Show file tree
Hide file tree
Showing 47 changed files with 115 additions and 723 deletions.
2 changes: 1 addition & 1 deletion docs/articles/install_bonsai.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Bonsai Installation

Before you can use the examples on this web site you need to install the following:
Before you can use the examples on this website you need to install the following:

1. Download and install the latest version of the [Bonsai installer](https://bonsai-rx.org/docs/articles/installation.html).
2. Install the Starter package:
Expand Down
3 changes: 0 additions & 3 deletions docs/articles/install_harp.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
Before you can use Harp devices in Bonsai you need to install the following:

1. Install Harp USB drivers from [here](https://ftdichip.com/wp-content/uploads/2021/08/CDM212364_Setup.zip)

2. Install the generic Harp packages for Bonsai:
1. Open your Bonsai application
2. Go to Manage Packages
3. In Package Sources select Bonsai Packages
4. Search for Harp
5. Install Harp Library and Harp Design Library

3. Install the specific Harp device packages for Bonsai:
1. In Package Sources select nuget.org
2. Search for your desired device (eg 'Harp Behavior')
3. Install the package


## Documentation

Further information can be found here:
Expand Down
6 changes: 3 additions & 3 deletions docs/articles/welcome.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Welcome

Wecome to CF.Bonsai, a website from the [Champalimaud Foundation](https://www.fchampalimaud.org/) that contains annotated examples of recurring neuroscience tasks programmed in [Bonsai](https://bonsai-rx.org/). Many of these examples make use of the [Harp](https://harp-tech.org/articles/about.html) hardware protocol to interface with a variety of peripheral devices.
Welcome to CF.Bonsai, a website from the [Champalimaud Foundation](https://www.fchampalimaud.org/) that contains annotated examples of recurring neuroscience tasks programmed in [Bonsai](https://bonsai-rx.org/). Many of these examples make use of the [Harp](https://harp-tech.org/articles/about.html) hardware protocol to interface with a variety of peripheral devices.


## Getting started

Start by installing the necessary Bonsai and Harp software from the Getting Started menu on the left panel. Then, find your example of choice, and follow the instructions to run it. Every example can be copied directly to Bonsai, and includes a set of annotations that explain the most significant parts of the code. If the example involves hardware (as those of Harp) additional electrical diagrams are provided with the necessary connections between the components.
Start by installing the necessary Bonsai and Harp software from the [Getting Started](install_bonsai.md) menu on the left panel. Then, find your example of choice, and follow the instructions to run it. Every example can be copied directly to Bonsai, and includes a set of annotations that explain the most significant parts of the code. If the example involves hardware (as those of Harp) additional electrical diagrams are provided with the necessary connections between the components.



Expand All @@ -22,7 +22,7 @@ More information about Harp can be found at [bonsai-rx.org](https://bonsai-rx.or

## Harp

Harp is an open-source standard for asynchronous real-time data acquisition and experimental control in neuroscience. The Harp ecosystem currently includes devices to configure, control, and collect data from a wide range of peripheral devices such as cameras, LEDs, nosepokes, and motors.
Harp is an open-source standard for asynchronous real-time data acquisition and experimental control in neuroscience. The Harp ecosystem currently includes devices to configure, control and collect data from a wide range of peripheral devices such as cameras, LEDs, nosepokes and motors.

More information about Harp can be found at [harp-tech.org](https://harp-tech.org/articles/about.html).

Expand Down
6 changes: 1 addition & 5 deletions docs/workflows/BonsaiExamples/Audio/PlayTone/PlayTone.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
## Summary
This example demonstrates how to play a tone with fixed frequency and duration whenever a key is pressed.


## Workflow
:::workflow
![Example](~/workflows/BonsaiExamples/Audio/PlayTone/PlayTone.bonsai)
:::


## Details
1. Plays a tone whenever 'A' is pressed.
1. Generates a sinusoidal wave form with 44100 samples with amplitude of 10000 and frequency of 1000Hz. Given that the sampling rate is set to 44100Hz, the wave generated will allow the tone to last for 1s.
2. Plays the tone.

## Follow up
The example shows how to modify the frequency and durations to obtain different tones on-the-fly.


The example shows how to modify the frequency and durations to obtain different tones on-the-fly.
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
## Summary
This example demonstrates how to play a tone with fixed frequency and duration whenever a key is pressed.


## Workflow
:::workflow
![Example](~/workflows/BonsaiExamples/Audio/PlayTone/PlayTone.bonsai)
:::


## Details
1. Plays a tone whenever 'A' is pressed.
1. Generates a sinusoidal wave form with 44100 samples with amplitude of 10000 and frequency of 1000Hz. Given that the sampling rate is set to 44100Hz, the wave generated will allow the tone to last for 1s.
2. Plays the tone.

## Follow up
The example shows how to modify the frequency and durations to obtain different tones on-the-fly.


The example shows how to modify the frequency and durations to obtain different tones on-the-fly.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Moving Circle

## Summary
This example demonstrates how to draw a circle in Shaders and update its position according to mouse movements.

## Workflow

:::workflow
![Example](~/workflows/BonsaiExamples/BonVision/MovingCircle/MovingCircle.bonsai)
:::

## Summary
This example demonstrates how to draw a circle in Shaders and update its position according to mouse movements.

## Details
1. Creates and initializes a simple shaders window with the standard resources necessary to draw the circle.
2. Creates an orthographic view with the normalized window coordinates, and sets up a behavior subject 'DrawScene' to be used whenever an update is to occur.
Expand All @@ -18,5 +18,3 @@ This example demonstrates how to draw a circle in Shaders and update its positio
Move the mouse over the Shaders window to observe the result.

## Follow-up


Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@
## Summary
This example demonstrates how to create an array, add elements to it and remove elements from it.


## Workflow
:::workflow
![Example](~/workflows/BonsaiExamples/DataTypes/ArrayManipulation/ArrayManipulation.bonsai)
:::


## Details
1. Create an int array with one element
1. Create an int array with one element.
1. Receives a single int value and terminates the sequence. Closing the sequence is essential to create the array (see 1.2).
2. Creates an array with the single int value received.
3. Initializes the subject MyArray with the int array created.
2. Adds a new int value to the array whenever 'A' is pressed.
1. Gets the current number of 'A' key presses.
2. Creates a new int array with the elements in MyArray added by the current number of key presses.
3. Updates My array with the new array created.
3. Updates MyArray with the new array created.
3. Removes the last element from MyArray whenever 'S' is pressed.
1. Creates a new array without the last element.
2. Updates MyArray with the new int array createdy.
2. Updates MyArray with the new int array created.
4. Outputs the current values of the array at 200ms intervals.
1. Enables the visualization of the current content of MyArray. Enable TimeSeriesVisualizer in this node to see the result of inteacting with the array.
1. Enables the visualization of the current content of MyArray. Enable TimeSeriesVisualizer in this node to see the result of interacting with the array.


## Notes
The key elements of this workflow are the Concat and ToArray nodes from the Reactive package. Concat produces a flat sequence of values with the individual elements of an array, while ToArray composes an array out of a flat sequence of values (insofar as that sequence terminates). Mastering these two nodes is key to understanding this example.

Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Basic Type Conversions

## Summary
This example demonstrates how to convert across the different numeric data types using direct CSharp expressions in the ExpressionTransform node.

## Workflow

:::workflow
![Example](~/workflows//BonsaiExamples/DataTypes/BasicTypeConversions/BasicTypeConversions.bonsai)
:::


## Summary
This example demostrates how to convert across the different numeric data types using direct CSharp expressions in the ExpressionTransform node.

## Details
1. Generates an int value
2. Converts the int into a float value using the method Convert.ToSingle() method
Expand All @@ -20,5 +19,4 @@ This example demostrates how to convert across the different numeric data types

The *it* argument passed to each method inside the ExpressionTransform nodes represents the actual input value of the node.

Verify the output type of each node (by right clicking on the node) and use the TextVisualizeR to best inspect the output of each node.

Verify the output type of each node (by right-clicking on the node) and use the TextVisualizer to best inspect the output of each node.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Create Float Array

## Summary
Const

## Workflow

:::workflow
![Example](~/workflows/BonsaiExamples/DataTypes/CreateFloatArray/CreateFloatArray.bonsai)
:::

## Summary
Const

## Details
1. Const

## Follow-up


Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Basic file list processing
# Basic File List Processing

## Summary
This example demonstrates how to read data from a list of files, process each file individually and create new files with the output.

## Workflow

:::workflow
![Example](~/workflows//BonsaiExamples/IO/BasicFileListProcessing/BasicFileListProcessing.bonsai)
:::

## Summary
This example demostrates how to read data from a list of files, process each file individually and create new files with the output.

## Details
1. Gets a list of filenames from a given directory as string array.*
2. Generates one event per each element in the string array.
3. Processes each file individually. In this example, we read the number stored in each file, multiply it by two, and create a new file with the result with the string '_new' added to it.

*Before running the code you need to download [file1.txt](https://github.com/fchampalimaud/cf.bonsai/blob/main/docs/workflows/BonsaiExamples/IO/ProcessFileList/file1.txt) and [file2.txt](https://github.com/fchampalimaud/cf.bonsai/blob/main/docs/workflows/BonsaiExamples/IO/ProcessFileList/file1.txt) to a directory, and modify the Path propery in the GetFiles node accordingly.
*Before running the code you need to download [file1.txt](https://github.com/fchampalimaud/cf.bonsai/blob/main/docs/workflows/BonsaiExamples/IO/ProcessFileList/file1.txt) and [file2.txt](https://github.com/fchampalimaud/cf.bonsai/blob/main/docs/workflows/BonsaiExamples/IO/ProcessFileList/file1.txt) to a directory, and modify the Path property in the GetFiles node accordingly.


## Follow up
A more elaborated example for processing a list of files can be found [here](/workflows/BonsaiExamples/IO/RefinedFileListProcessing/RefinedFileListProcessing.html)
A more elaborated example for processing a list of files can be found [here](../ElaborateFileListProcessing/ElaborateFileListProcessing.md).
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Elaborate file list processing
# Elaborate File List Processing

## Summary
This example demonstrates how to serially process a list of files in a given directory (and including subdirectories), and generate output files accordingly.

This example demonstrates how to serially process a list of files in a given directory (including subdirectories) and generate output files accordingly.

## Workflow
:::workflow
![Example](~/workflows/BonsaiExamples/IO/ElaborateFileListProcessing/ElaborateFileListProcessing.bonsai)
:::


## Details
1. Obtains a list of files from an input directory and initializes the necessary subjects to run the workflow. The input directory, the file search pattern, and the output directory can be set as properties of the group node.
2. Processes each file sequentially.
Expand All @@ -24,6 +22,3 @@ This example demonstrates how to serially process a list of files in a given dir


*Before running the code you need to download this [folder](https://drive.google.com/drive/folders/1mqcMzhN2vP5cOGFi4CCXcgHYZ6bmlk9m?usp=sharing), and modify the *Input path* property in the *Init File Processing* node in 1.



Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Sample Discrete Uniform Distribution

## Summary
This example demonstrates how to randomly sample from a discrete uniform distribution.

## Workflow

:::workflow
![Example](~/workflows//BonsaiExamples/Numeric.Distributions/SampleDiscreteUniformDistribution/SampleDiscreteUniformDistribution.bonsai)
:::


## Summary
This example demostrates how to randomly sample from a discrete uniform distribution.

## Details
1. Creates BehaviorSubject (MyDistribution) with a discrete uniform distribution with values ranging from 0 to 10.
2. Samples randomly from MyDistribution when 'A' is pressed.
Expand All @@ -19,5 +18,3 @@ Visualize the output of Sample node using the TimeSeriesVisualized and while mai
If you want to repeat the same randomly sampled values everytime Bonsai is started set the Seed property to a value in the CreateRandom node.

**Important Note:** If you want to sample more than once from a given distribution do not connect the Sample directly to the output of the CreateDiscreteUniform node. This will recreate the distribution everytime you take sample, which will result in undesired results.


Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Sample Nomrmal Distribution
# Sample Normal Distribution

## Summary
This example demonstrates how to randomly sample from a continuous normal distribution.

## Workflow

:::workflow
![Example](~/workflows//BonsaiExamples/Numeric.Distributions/SampleNormalDistribution/SampleNormalDistribution.bonsai)
:::


## Summary
This example demostrates how to randomly sample from a continuous normal distribution.

## Details
1. Creates BehaviorSubject (MyDistribution) with a normal distribution with mean of 0 and standard deviation of 1.
2. Samples randomly from MyDistribution when 'A' is pressed.
Expand All @@ -19,5 +18,3 @@ Visualize the output of Sample node using the TimeSeriesVisualized and while mai
If you want to repeat the same randomly sampled values everytime Bonsai is started set the Seed property to a value in the CreateRandom node.

**Important Note:** If you want to sample more than once from a given distribution do not connect the Sample directly to the output of the CreateNormal node. This will recreate the distribution everytime you take sample, which will result in undesired results.


Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Udp Server and Client

## Summary
This example demonstrates how to setup an Osc server and an Osc client, and how messages can be sent from one to the other.

## Workflow

:::workflow
![Example](~/workflows//BonsaiExamples/Osc/UDPSendAndReceive/UDPSendAndReceive.bonsai)
:::

## Summary
This example demostrates how to setup an Osc server and an Osc client, and how messages can be sent from one to the other.

## Details
1. Creates a udp communication channel. In this example, this channel will be listening in port 2323, the messages sent by localhost port 0.
2. Creates a second udp communication channel. In this example, this channel will use port 0, to send messages to localhost port 2323.
3. Generates and sends an Osc message with the x and y position of the mouse whevever the mouse moves.
3. Generates and sends an Osc message with the x and y position of the mouse whenever the mouse moves.
4. Emits events whenever a message is received with the x and y coordinates of the mouse.

## Follow-up
In this example the communcation is done via the localhost (i.e. it uses the same machine both for sending and receiving messages). However, the code can be run in different machines (as far as the machines are in the same LAN network), where the mouse movements executed in one can be sent to the other. To do, this you only need to change the localhost in UdpReceive and UdpSend by the IP addresses of both each machine.
In this example the communication is done via the localhost (i.e. it uses the same machine both for sending and receiving messages). However, the code can be run in different machines (as far as the machines are in the same LAN network), where the mouse movements executed in one can be sent to the other. To do this, you only need to change the localhost in UdpReceive and UdpSend by the IP addresses of both each machine.


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Columnwise Operations
# Column-wise Operations

## Summary
This example demonstrates how to project information of a matrix (in this case an image) into a single row vector using the max function.
Expand All @@ -13,4 +13,4 @@ This example demonstrates how to project information of a matrix (in this case a
2. Project the max values of each column to a single row vector.

## Follow-up
In addition the Max function one can use the Min, Sum, or Mean values. Row-wise operations can also be used by setting the Axis property in the Reduce node to 1.
In addition the Max function one can use the Min, Sum, or Mean values. Row-wise operations can also be used by setting the Axis property in the Reduce node to 1.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ This example demonstrates how to compose full images by appending single lines.
1. Initializes the behavior subjects necessary to run the example. It receives the *Width* and *Height* of the image as properties and it creates two subjects: *Black Line*, which consists of an image of a single black line, and *Temporary Image* which is initialized with the black line. In addition, it creates a random generator from which the pixel values will be sampled from.
2. Creates an image with random values whenever 'S' is pressed.
1. Initializes the *Temporary Image* subject to a single black line.
2. Emits a value for every line that will need to be generated
2. Emits a value for every line that will need to be generated.
3. Generates a new line with random values for each value emited in 2.2.
4. Appends the current line to the *Temporary Image*.
5. Checks if all lines have been generated.
6. When all lines have been generated, it crops the image to remove the black line.
7. Creates a subject with the finished image.


Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This example demonstrates how to set dynamically the values of a compound proper

## Details

1. Creates an image black image with three white circles whenever 'S' is pressed.
1. Creates a black image with three white circles whenever 'S' is pressed.
1. Creates a black canvas.
2. Adds three white circles.
3. Creates an image with the filled image.
Expand Down
Loading

0 comments on commit 180bbf4

Please sign in to comment.