Added an error in VectorCells init if class is initialized directly.
Removed default value of None for Other_Agent in AgentVectorCells init, as None is not an allowed value.
Raised an error in ObjectVectorCells if there are no objects in the environment.
New warning added:
Added a warning in classes where the number of neurons can be changed internally, overriding params["n"]. This is to avoid confusion when a user requests 10 neurons, but ends up with 64, for example. The added code specifically checks whether n was passed as a parameter, and will not produce a warning if n was added in from a default parameter dictionary.
New warning examples:
In the simple case that applies to HeadDirectionCells in 1D environments and to SpeedCell, if you run something like:
from ratinabox import Agent, Environment, SpeedCell
you get:
```UserWarning: Ignoring 'n' parameter value (3) that was passed for SpeedCell. Only 1 speed cell is needed.```
2. In the slightly more complex case that applies to `VectorCells` and its child classes, if you run something like
from ratinabox import Agent, Environment, FieldOfViewOVCs
Env = Environment(params={"objects": [[0.5, 0.5]]})
Ag = Agent(Env)
then there's no warning. In the first case, because you didn't specify an `n` value [1] and in the second case, because the `n` value is not changed.
However, if you run
from ratinabox import Agent, Environment, FieldOfViewOVCs
you get:
```UserWarning: Ignoring 'n' parameter value (10) that was passed, and setting number of ObjectVectorCell neurons to 58, inferred from the cell arrangement parameter.```
[1] To ensure that no superfluous warning is produced in this case, I had to create an extra attribute `_warn_n_change` that can be set in a child class. This allows the init of `VectorCells` to know whether `n` was actively passed by the user or was added to `params` at some point during the initialization chain (e.g., from a child class' default parameters).
Small fixes and new warning for Neurons classes.
Fixes:
VectorCells
init if class is initialized directly.None
forOther_Agent
inAgentVectorCells
init, asNone
is not an allowed value.New warning added:
params["n"]
. This is to avoid confusion when a user requests 10 neurons, but ends up with 64, for example. The added code specifically checks whethern
was passed as a parameter, and will not produce a warning ifn
was added in from a default parameter dictionary.New warning examples:
HeadDirectionCells
in 1D environments and toSpeedCell
, if you run something like:Env = Environment(params={"objects": [[0.5, 0.5]]}) Ag = Agent(Env) SpeedCell(Ag, params={"n": 3})
from ratinabox import Agent, Environment, FieldOfViewOVCs
Env = Environment(params={"objects": [[0.5, 0.5]]}) Ag = Agent(Env)
FieldOfViewOVCs(Ag, params={"object_tuning_type": "random", "cell_arrangement": "diverging_manifold"}) FieldOfViewOVCs(Ag, params={"object_tuning_type": "random", "cell_arrangement": "random", "n":10})
from ratinabox import Agent, Environment, FieldOfViewOVCs
Env = Environment(params={"objects": [[0.5, 0.5]]}) Ag = Agent(Env) FieldOfViewOVCs(Ag, params={"object_tuning_type": "random", "cell_arrangement": "diverging_manifold", "n": 10})