openforcefield.utils.utils.deserialize_numpy

openforcefield.utils.utils.deserialize_numpy(serialized_np, shape)[source]

Deserializes a numpy array from a JSON-compatible string.

from https://stackoverflow.com/questions/30698004/how-can-i-serialize-a-numpy-array-while-preserving-matrix-dimensions#30699208

Parameters
serialized_npstr

A serialized numpy array

shapetuple of ints

The shape of the serialized array

Returns
——-
np_arraynumpy.ndarray

The deserialized numpy array