pyhs3.tensorutils.ensure_array

pyhs3.tensorutils.ensure_array(value)[source]

Ensure a value is a numpy array with dtype float64.

Converts scalars to 0-d arrays and lists to 1-d arrays. Existing numpy arrays are converted to float64 dtype if needed.

Parameters:

value (float | list[float] | ndarray[tuple[Any, ...], dtype[float64]]) – Input value (scalar, list, or array)

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Returns:

NumPy array with dtype float64