asarray#

bamengine.ops.asarray(data)[source]#

Convert input to a numpy array.

Use this to convert Python lists (e.g., from simulation history) to arrays for use with other ops functions.

Parameters:

data (list, tuple, or array) – Input data to convert.

Returns:

NumPy array with float64 dtype.

Return type:

array

Examples

>>> import bamengine.ops as ops
>>> history = [0.05, 0.06, 0.07]  # Simulation history as list
>>> arr = ops.asarray(history)
>>> pct = ops.multiply(arr, 100)  # Convert to percentages
>>> # pct: [5.0, 6.0, 7.0]

Notes

This is useful for converting simulation results (often stored as lists) to arrays for mathematical operations or plotting.