quantity_with_dimensions function

(Shortest import: from brian2.units.fundamentalunits import quantity_with_dimensions)

brian2.units.fundamentalunits.quantity_with_dimensions(floatval, dims)[source]

Create a new Quantity with the given dimensions. Calls get_or_create_dimensions with the dimension tuple of the dims argument to make sure that unpickling (which calls this function) does not accidentally create new Dimension objects which should instead refer to existing ones.

Parameters

floatval : float

The floating point value of the quantity.

dims : Dimension

The physical dimensions of the quantity.

Returns

q : Quantity

A quantity with the given dimensions.

See also

get_or_create_dimensions

Examples

>>> from brian2 import *
>>> quantity_with_dimensions(0.001, volt.dim)
1. * mvolt