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
Quantitywith the given dimensions. Callsget_or_create_dimensionswith the dimension tuple of thedimsargument 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 :
floatThe floating point value of the quantity.
dims :
DimensionThe physical dimensions of the quantity.
- Returns:
q :
QuantityA quantity with the given dimensions.
See also
get_or_create_dimensionsExamples
>>> from brian2 import * >>> quantity_with_dimensions(0.001, volt.dim) 1. * mvolt