from_datasets#
- ethograph.from_datasets(datasets)[source]#
Build a TrialTree from a list of per-trial xarray Datasets.
Shorthand for
TrialTree.from_datasets.Each dataset must have
attrs["trial"]set to a unique trial identifier.- Parameters:
datasets (list[xarray.Dataset]) – One Dataset per trial.
- Return type:
Examples
>>> import xarray as xr, numpy as np, ethograph as eto >>> trials = [] >>> for i in range(1, 4): ... ds = xr.Dataset({"speed": xr.DataArray(np.random.rand(300), dims=["time"])}) ... ds.attrs["trial"] = i ... trials.append(ds) >>> dt = eto.from_datasets(trials) >>> dt.trials [1, 2, 3]