from_data_dir
- classmethod MPPData.from_data_dir(data_dir, data_config, mode='r', base_dir=None, keys=(), optional_keys=('mpp', 'labels', 'latent', 'conditions'), **kwargs)[source]
Initialise
MPPDatafrom directory.Read data from key.npy for each key in keys. If present, will also read key.npy for each key in optional_keys.
The information can be spread out over a chain of directories. In this case, a mpp_params.json file in data_dir indicates that more data can be found in base_data_dir (defined in mpp_params). First, the data from base_data_dir is loaded, and then the remaining information from data_dir is added.
Each data_dir along this chain has to contain at least x.npy, y.npy, obj_ids.npy, metadata.csv and channels.csv.
- Parameters
data_dir (
str) – Path to the specific directory containing one set of npy and csv files as described above. Note that this path should be relative to base_dir, which is set to data_config.DATA_DIR by default.data_config (
str) – Name of the data_config file registered in campa_config.data_configs.mode (
str) – mmap_mode fornp.load(). Set to None to load data in memory.base_dir (
Optional[str]) – Look for data in base_dir/data_dir. Default in data_config.DATA_DIR.keys (
Iterable[str]) – Read data from key.npy for each key in keys.optional_keys (
Iterable[str]) – If present, read key.npy for each key in optional_keys.
- Return type