deepof.data.TableDict
- class deepof.data.TableDict(tabs: Dict, typ: str, table_path: str | None = None, arena: str | None = None, arena_dims: array | None = None, animal_ids: List = ('',), center: str | None = None, connectivity: Graph | None = None, polar: bool | None = None, exp_conditions: dict | None = None, shapes: Dict = {})
Main class for storing a single dataset as a dictionary with individuals as keys and pandas.DataFrames as values.
Includes methods for generating training and testing datasets for the supervised and unsupervised models.
- __init__(tabs: Dict, typ: str, table_path: str | None = None, arena: str | None = None, arena_dims: array | None = None, animal_ids: List = ('',), center: str | None = None, connectivity: Graph | None = None, polar: bool | None = None, exp_conditions: dict | None = None, shapes: Dict = {})
Store single datasets as dictionaries with individuals as keys and pandas.DataFrames as values.
Includes methods for generating training and testing datasets for the autoencoders.
- Parameters:
tabs (Dict) – Dictionary of pandas.DataFrames with individual experiments as keys.
typ (str) – Type of the dataset. Examples are “coords”, “dists”, and “angles”. For logging purposes only.
table_path (str) – Path to the root directory that is going to be used to save table iterations.
arena (str) – Type of the arena. Must be one of “circular-autodetect”, “circular-manual”, or “polygon-manual”. Handled internally.
arena_dims (np.array) – Dimensions of the arena in mm.
animal_ids (list) – list of animal ids.
center (str) – Type of the center. Handled internally.
connectivity (nx.Graph) – Bodypart graph of a mouse.
polar (bool) – Whether the dataset is in polar coordinates. Handled internally.
exp_conditions (dict) – dictionary with experiment IDs as keys and experimental conditions as values.
shapes (Dict) – Dictionary containing the shapes of all stored tables
Methods
__init__(tabs, typ[, table_path, arena, ...])Store single datasets as dictionaries with individuals as keys and pandas.DataFrames as values.
clear()copy()filter_condition(exp_filters)Return a subset of the original table_dict object, containing only videos belonging to the specified experimental condition.
filter_id([selected_id])Filter a TableDict object to keep only those columns related to the selected id.
filter_videos(keys)Return a subset of the original table_dict object, containing only the specified keys.
fromkeys([value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
get_training_set(current_table_dict[, ...])Generate training and test sets as table_dicts for model training.
items()keys()merge(*args[, ignore_index, file_name, ...])Take a number of table_dict objects and merges them to the current one.
new_dict_same_header([tabs, only_keys])Creates a new table dict based on a given dictionary and the existing header information.
pca([n_components, kernel])Return a training set generated from the 2D original data (time x features) and a PCA projection to a n_components space.
pop(k[,d])If key is not found, default is returned if given, otherwise KeyError is raised
popitem()Remove and return a (key, value) pair as a 2-tuple.
preprocess(coordinates[, window_size, ...])Preprocess pose tables for model training.
random_projection([n_components, kernel])Return a training set generated from the 2D original data (time x features) and a random projection to a n_components space.
sample_windows_from_data([time_bin_info, ...])Samples a set of windows from data entries, enhancing readability and reducing complexity.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
umap([n_components])Return a training set generated from the 2D original data (time x features) and a PCA projection to a n_components space.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()- __init__(tabs: Dict, typ: str, table_path: str | None = None, arena: str | None = None, arena_dims: array | None = None, animal_ids: List = ('',), center: str | None = None, connectivity: Graph | None = None, polar: bool | None = None, exp_conditions: dict | None = None, shapes: Dict = {})
Store single datasets as dictionaries with individuals as keys and pandas.DataFrames as values.
Includes methods for generating training and testing datasets for the autoencoders.
- Parameters:
tabs (Dict) – Dictionary of pandas.DataFrames with individual experiments as keys.
typ (str) – Type of the dataset. Examples are “coords”, “dists”, and “angles”. For logging purposes only.
table_path (str) – Path to the root directory that is going to be used to save table iterations.
arena (str) – Type of the arena. Must be one of “circular-autodetect”, “circular-manual”, or “polygon-manual”. Handled internally.
arena_dims (np.array) – Dimensions of the arena in mm.
animal_ids (list) – list of animal ids.
center (str) – Type of the center. Handled internally.
connectivity (nx.Graph) – Bodypart graph of a mouse.
polar (bool) – Whether the dataset is in polar coordinates. Handled internally.
exp_conditions (dict) – dictionary with experiment IDs as keys and experimental conditions as values.
shapes (Dict) – Dictionary containing the shapes of all stored tables