Wrapping Numpy functions

PhysicalQuantities.numpywrapper.ceil(qu: ndarray | PhysicalQuantity)[source]

Return the ceiling of the input, element-wise.

Parameters

qu:

Input data

Returns

PhysicalQuantity

The ceiling of each element

Examples

>>> import PhysicalQuantities.numpywrapper as nw
>>> nw.ceil(1.3 mm)
2.0 mm
PhysicalQuantities.numpywrapper.floor(qu: ndarray | PhysicalQuantity)[source]

Return the floor of the input, element-wise.

Parameters

qu:

Input data

Returns

PhysicalQuantity

The floor of each element

Examples

>>> import PhysicalQuantities.numpywrapper as nw
>>> nw.floor(1.3 mm)
1 mm
PhysicalQuantities.numpywrapper.linspace(start, stop, num=50, endpoint=True, retstep=False)[source]

A units-enabled linspace

Parameters

start: PhysicalQuantity or float

Start value

stop: PhysicalQuantity or float

Stop value

num: int

Number of points

endpoint: bool

If true, include stop point

retstep: bool

If true, return (samples, step)

Returns

Return equally spaced samples between start and stop

Examples

>>> import PhysicalQuantities.numpywrapper as nw
>>> nw.linspace(0 GHz, 100 GHz, 200)
PhysicalQuantities.numpywrapper.max(qu: ndarray | PhysicalQuantity)[source]

Return the maximum of an array or maximum along an axis.

Parameters

qu :

Input data

Returns

array_like

Maximum of an array or maximum along an axis

PhysicalQuantities.numpywrapper.sqrt(qu: ndarray | PhysicalQuantity)[source]

Return the square root of the input, element-wise.

Parameters

qu:

Input data

Returns

PhysicalQuantity

The floor of each element

Examples

>>> import PhysicalQuantities.numpywrapper as nw
>>> nw.sqrt(4 m**2)
2.0 m
PhysicalQuantities.numpywrapper.tophysicalquantity(arr: ndarray | PhysicalQuantity, unit=None)[source]
Convert numpy array or list containing PhysicalQuantity elements to PhysicalQuantity object containing

array or list

Parameters

arr: list or numpy array

unit: unit name or unit object

Returns

PhysicalQuantity

Array wrapped as PhysicalQuantity

Examples

>>> a = [ 1mm, 2m, 3mm]
>>> b = toPhysicalQuantity(a)
>>> b
[ 1 2000 3] mm