nengo_spa.testing

Support for unit testing SPA models.

Functions

assert_sp_close(t, data, target_sp[, skip, …])

Test that the RMSE to a Semantic Pointer is below threshold.

nengo_spa.testing.assert_sp_close(t, data, target_sp, skip=0.0, duration=None, atol=0.2, normalized=False)[source]

Test that the RMSE to a Semantic Pointer is below threshold.

Parameters
  • t ((T,) array_like) – Time values for data in seconds, usually obtained with nengo.Simulator.trange.

  • data ((T, D) array_like) – Simulation data for T timesteps and D dimensions.

  • target_sp (SemanticPointer) – Target Semantic Pointer.

  • skip (float, optional) – Amount of seconds to ignore at the beginning of the data.

  • duration (float, optional) – Amount of seconds to consider after the skipped portion.

  • atol (float, optional) – Absolute tolerated RMSE.

  • normalize (bool, optional) – Whether to normalize the simulation data to unit length in each timestep.