Hi @smjh1371, and welcome to the Nengo forums! 
From your question, it’s unclear whether you are asking in the context of NengoGUI (the browser-based GUI), or just Nengo (the simulator that you can run in the Python command line). I know it can be somewhat confusing, but Nengo can be used to refer to both. 
Since you are asking to do analysis on probe data, you are probably looking to include your Nengo networks in more complex systems. As such, my recommendation would be to write your Nengo code and run them from the Python command line, or to run it within a Jupyter notebook. The downside to these approaches is that you’ll need to manage the graphs and plots yourself (i.e., using a package like matplotlib). To get you started with this approach, all of the examples found on the Nengo documentation page are formatted as Jupyter notebooks. You can also find these examples in the Nengo codebase here.
The primary difference between a Nengo model that you run in the GUI and one that you run from the Python command line (or Jupyter notebook) is that you’ll need to invoke the Nengo simulator yourself (NengoGUI handles the simulator invocation for you). A quick example of this is as follows:
import nengo
import numpy as np
# Define Nengo network
with nengo.Network() as model:
a = nengo.Node(lambda t: np.sin(t))
b = nengo.Node(size_in=1)
nengo.Connection(a, b)
c = nengo.Probe(b)
# Create and start the Nengo simulator
with nengo.Simulator(model) as sim:
sim.run(1) # Run the simulator for 1s
After you create and run the simulator, you can then access probed data as follows:
t_values = sim.trange() # Provides a numpy array with all of the timesteps in the probed data
probed_values = sim.data[c] # Returns a numpy array with all of the probed data for probe `c`
The probed data will have shape TxD
where T
is the number of timesteps in the simulation (i.e., sim_runtime / sim.dt
– where sim.dt
defaults to 0.001s), and D
is the dimensionality of the probed object. For example, in the code above, T = 1000
and D = 1
(the output size of b
is 1).
If you put all of the code above into a single python file (e.g., like so: test_nengo_code.py (592 Bytes))
You can run the Nengo simulation from a terminal like so:
python test_nengo_code.py
If you include graphing and plotting code in the Python code, the plots will show up as additional windows when the code is run.
Working entirely within NengoGUI
If you want to work entirely in NengoGUI, then there’s no real way to get at the probed data. However, you can still perform arithmetic operations on data using Nengo nodes. Simply define the arithmetic operation as a function and create a node with that function as an input:
def my_func(x):
return <some_arthimetic_operation>
import nengo
import numpy as np
# Define Nengo network
with nengo.Network() as model:
a = nengo.Node(lambda t: np.sin(t))
b = nengo.Node(size_in=1)
nengo.Connection(a, b)
c = nengo.Node(my_func)
nengo.Connection(b, c, synapse=None) # Set None as synapse to avoid filtering the data
Once you have done this, you can then pull up the plot of the c
node to visualize the effect the arithmetic operation has on the “probed” data (i.e., the output of b
in the code above). Note that this arithmetic operation will be computed at every timestep of the simulation.