str_to_array

ssapy.io.str_to_array(s)[source][source]

Convert a string representation of an array back into a NumPy array.

This function takes a string formatted as an array (e.g., “[1.0, 2.0, 3.0]”), removes the square brackets, splits the elements by commas, and converts them into a NumPy array of floats.

Parameters:

s (str) – A string representation of an array, with elements separated by commas and enclosed in square brackets.

Returns:

A NumPy array containing the float values extracted

from the input string.

Return type:

numpy.ndarray