allensdk.brain_observatory.behavior.data_files.sync_file module

class allensdk.brain_observatory.behavior.data_files.sync_file.SyncFile(filepath: str | Path, permissive: bool = False)[source]

Bases: DataFile

A DataFile which contains methods for accessing and loading visual behavior stimulus *.pkl files.

This file type contains global timing information for different data streams collected during a behavior + ophys session.

Attributes:
filepathstr or Path

Full path to sync file on disk.

permissivebool

Permissively load from sync file. If True, do no raise when a given sync line is not present. Default False.

classmethod from_json(dict_repr: dict, permissive: bool = False) SyncFile[source]

Populates a DataFile from a JSON compatible dict (likely parsed by argschema)

Returns:
DataFile:

An instantiated DataFile which has data and filepath properties

classmethod from_lims(db: PostgresQueryMixin, behavior_session_id: int | str, permissive: bool = False) SyncFile[source]

Populate a DataFile from an internal database (likely LIMS)

Returns:
DataFile:

An instantiated DataFile which has data and filepath properties

static load_data(filepath: str | Path, permissive: bool = False) dict[source]

Given a filepath (that is meant to by read by the DataFile type), load the contents of the file into a Python type. (dict, DataFrame, list, etc…)

Parameters:
filepathUnion[str, Path]

The filepath that the DataFile class should load.

Returns:
Any

A Python data type that has been parsed/loaded from the provided filepath.

property permissive: bool
class allensdk.brain_observatory.behavior.data_files.sync_file.SyncFileReadableInterface[source]

Bases: ABC

Marks a data object as readable from sync file

abstractmethod classmethod from_sync_file(*args) DataObject[source]

Populate a DataObject from the sync file

Returns:
DataObject:

An instantiated DataObject which has name and value properties

allensdk.brain_observatory.behavior.data_files.sync_file.from_json_cache_key(cls, dict_repr: dict, permissive: bool = False)[source]
allensdk.brain_observatory.behavior.data_files.sync_file.from_lims_cache_key(cls, db, behavior_session_id: int)[source]