ctn-waterloo/nengo — pull request #224 by tbekolay (2013-12-10 22:38:03+00:00)
Title: Simulator and nodes now handle time explicitly

Previously, time was tracked in a node, `model.t`, which was automatically connected to any node that we figured would want access to time. With this PR, whether or not a node has access to the current timestep depends on the function that the node computes (if the node computes a function).

- If a node's function accepts 0 arguments, it is not passed any.
- If a node's function accepts 1 argument, it is passed the current timestep.
- If a node's function accepts 2 or more arguments (even if those are passed as `*args`) it is passed both the current timestep and x, which is a numpy array with all of its input connections.

Other changes made to augment or support this:

- `simulator.Simulator`'s signaldict has a `__time__` key
whose value is a numpy scalar with the current timestep
- `nonlinearities.PythonFunction` has a `n_args` property that determines
how many arguments the function accepts
- `simulator.Simulator` does not "probe" time, but instead exposes
a `time` function that returns a numpy array of the timesteps,
which is generated using `np.linspace`. This is mostly for plotting. Not probing time should save a bit of time during simulation.
- By default, `time` uses the model's dt.
If a `dt` is passed, it uses that instead (this is for probes that
are sampled at a different rate than model's dt;
see `tests/test_ensemble.py` for an example that uses this).

This PR (should) address Issues #198, #212, and #222.