dipde
dipde copied to clipboard
Obscure Error message when connecting to ExternalPopulation
When an ExternalPopulation is accidentally set as the target of a connection, the model construction fails with an obscure error message that is unhelpful for debugging. A check should be made when the connection is attempted, and a more helpful debugging exception should be thrown.
_Error message:_
conn_dist = ConnectionDistribution(self.target.edges, self.weights, self.probs) AttributeError: 'ExternalPopulation' object has no attribute 'edges'
_Minimal code to reproduce the error:_
from dipde.internals.externalpopulation import ExternalPopulation
from dipde.internals.simulation import Simulation
from dipde.internals.connection import Connection as Connection
b1 = ExternalPopulation('100', record=True)
b2 = ExternalPopulation('100', record=True)
b1_b2 = Connection(b1, b2, 1, weights=[.005], probs=[1.], delay=0.0)
simulation = Simulation([b1, b2], [b1_b2])
simulation.run(dt=.001, tf=.1, t0=0)