import numpy as np import h5py from scipy.interpolate import interp1d class Data: def __init__(self, filename, group_key): self.filename = filename self.datasets = [] with h5py.File(self.filename, "r") as h5: if 1: print(f"Atribuudid grupis '{group_key}'") grp = h5[group_key] self.current = grp["current_raw"][()] / grp.attrs["c_mem"] self.current_t = grp["current_t"][()] self.ECal = grp.attrs["vrev"] self.gGaL = grp.attrs["gmax"] self.eid = group_key def get_current_slice(self, times: np.ndarray): interpolator = interp1d(self.current_t, self.current, fill_value="extrapolate") return interpolator(times)