"""Load JSON trial data preserving the original NumPy dtypes and shapes.""" import json import numpy as np def load_trial(path): with open(path, encoding="utf-8") as stream: payload = json.load(stream) return {key: np.asarray(value["data"], dtype=value["dtype"]).reshape(value["shape"]) for key, value in payload["arrays"].items()}