DimensionMismatchError class

(Shortest import: from brian2 import DimensionMismatchError)

class brian2.units.fundamentalunits.DimensionMismatchError(description, *dims)[source]

Bases: Exception

Exception class for attempted operations with inconsistent dimensions.

For example, 3*mvolt + 2*amp raises this exception. The purpose of this class is to help catch errors based on incorrect units. The exception will print a representation of the dimensions of the two inconsistent objects that were operated on.