Vector elemnt printing

if i give a one dimensional vector as input and probe and I want to print only one number of input but the whole array is getting printed.
import nengo
import numpy as np

with nengo.Network() as model:
inp = nengo.Node([1, 2, 3])

i_p =nengo.Probe(inp)

with nengo.Simulator(model) as sim:

how do I print only first element or just one the desired elements from the vector?

If you look at the shape of the probed data, you’ll see that for your code, the data has the following shape: (10, 3). You can get the shape of the data by doing this:


Looking at the data shape, you can deduce that the data is 2-dimensional, with the first dimension being the number of data points there is. There should be one data point per timestep of the simulation. Since you ran the simulation for 0.01s, and the default timestep is 0.001s, there should be 10 data points (which there is). The second dimension is then the dimensionality of the output data. In your code, you are probing a 3D value, and this is reflected in the probed data as well (the second dimension is 3).

The probed data is a Numpy array, so to isolate a specific dimension of the output data, you should use Numpy’s slicing and indexing notation to do so. For example, if you want to get the second dimension of the output for all of the timesteps, do:

print([i_p][:, 1])

Or, if you want to get the entire output for just the second timestep do:

print([i_p][1, :])