allensdk.brain_observatory.ecephys.ecephys_project_cache module

class allensdk.brain_observatory.ecephys.ecephys_project_cache.EcephysProjectCache(fetch_api: allensdk.brain_observatory.ecephys.ecephys_project_api.ecephys_project_api.EcephysProjectApi = <allensdk.brain_observatory.ecephys.ecephys_project_api.ecephys_project_warehouse_api.EcephysProjectWarehouseApi object>, fetch_tries: int = 2, stream_writer=<function write_from_stream>, **kwargs)[source]

Bases: allensdk.api.cache.Cache

CHANNELS_KEY = 'channels'
MANIFEST_VERSION = '0.2.1'
NATURAL_MOVIE_DIR_KEY = 'movie_dir'
NATURAL_MOVIE_KEY = 'natural_movie'
NATURAL_SCENE_DIR_KEY = 'natural_scene_dir'
NATURAL_SCENE_KEY = 'natural_scene'
PROBES_KEY = 'probes'
PROBE_LFP_NWB_KEY = 'probe_lfp_nwb'
SESSIONS_KEY = 'sessions'
SESSION_ANALYSIS_METRICS_KEY = 'session_analysis_metrics'
SESSION_DIR_KEY = 'session_data'
SESSION_NWB_KEY = 'session_nwb'
SUPPRESS_FROM_CHANNELS = ('air_channel_index', 'surface_channel_index', 'name', 'date_of_acquisition', 'published_at', 'specimen_id', 'session_type', 'isi_experiment_id', 'age_in_days', 'sex', 'genotype', 'has_nwb', 'lfp_temporal_subsampling_factor')
SUPPRESS_FROM_PROBES = ('air_channel_index', 'surface_channel_index', 'date_of_acquisition', 'published_at', 'specimen_id', 'session_type', 'isi_experiment_id', 'age_in_days', 'sex', 'genotype', 'has_nwb', 'lfp_temporal_subsampling_factor')
SUPPRESS_FROM_SESSION_TABLE = ('has_nwb', 'isi_experiment_id', 'date_of_acquisition')
SUPPRESS_FROM_UNITS = ('air_channel_index', 'surface_channel_index', 'has_nwb', 'lfp_temporal_subsampling_factor', 'epoch_name_quality_metrics', 'epoch_name_waveform_metrics', 'isi_experiment_id')
TYPEWISE_ANALYSIS_METRICS_KEY = 'typewise_analysis_metrics'
UNITS_KEY = 'units'
add_manifest_paths(self, manifest_builder)[source]

Add cache-class specific paths to the manifest. In derived classes, should call super.

classmethod fixed(**kwargs)[source]
classmethod from_lims(lims_kwargs=None, **kwargs)[source]
classmethod from_warehouse(warehouse_kwargs=None, **kwargs)[source]
get_all_ages(self, **session_kwargs)[source]
get_all_full_genotypes(self, **session_kwargs)[source]
get_all_session_types(self, **session_kwargs)[source]
get_all_sexes(self, **session_kwargs)[source]
get_channels(self, suppress=None)[source]

Load (potentially downloading and caching) a table whose rows are individual channels.

get_natural_movie_template(self, number)[source]
get_natural_scene_template(self, number)[source]
get_probes(self, suppress=None)[source]
get_session_data(self, session_id: int, filter_by_validity: bool = True, **unit_filter_kwargs)[source]

Obtain an EcephysSession object containing detailed data for a single session

get_session_table(self, suppress=None) → pandas.core.frame.DataFrame[source]
get_structure_acronyms(self, **channel_kwargs) → List[str][source]
get_unit_analysis_metrics_by_session_type(self, session_type, annotate: bool = True, filter_by_validity: bool = True, **unit_filter_kwargs)[source]

Cache and return a table of analysis metrics calculated on each unit from a specified session type. See get_all_session_types for a list of session types.

Parameters:
session_type : str

identifies the session type for which to fetch analysis metrics.

annotate : bool, optional

if True, information from the annotated units table will be merged onto the outputs

filter_by_validity : bool, optional

Filter units used by analysis so that only ‘valid’ units are returned, by default True

**unit_filter_kwargs :

Additional keyword arguments that can be used to filter units (for power users).

Returns:
metrics : pd.DataFrame

Each row corresponds to a single unit, describing a set of analysis metrics calculated on that unit.

get_unit_analysis_metrics_for_session(self, session_id, annotate: bool = True, filter_by_validity: bool = True, **unit_filter_kwargs)[source]

Cache and return a table of analysis metrics calculated on each unit from a specified session. See get_session_table for a list of sessions.

Parameters:
session_id : int

identifies the session from which to fetch analysis metrics.

annotate : bool, optional

if True, information from the annotated units table will be merged onto the outputs

filter_by_validity : bool, optional

Filter units used by analysis so that only ‘valid’ units are returned, by default True

**unit_filter_kwargs :

Additional keyword arguments that can be used to filter units (for power users).

Returns:
metrics : pd.DataFrame

Each row corresponds to a single unit, describing a set of analysis metrics calculated on that unit.

get_units(self, suppress: Union[List[str], NoneType] = None, filter_by_validity: bool = True, **unit_filter_kwargs) → pandas.core.frame.DataFrame[source]

Reports a table consisting of all sorted units across the entire extracellular electrophysiology project.

Parameters:
suppress : Optional[List[str]], optional

A list of dataframe column names to hide, by default None (None will hide dataframe columns specified in: SUPPRESS_FROM_UNITS)

filter_by_validity : bool, optional

Filter units so that only ‘valid’ units are returned, by default True

**unit_filter_kwargs :

Additional keyword arguments that can be used to filter units (for power users).

Returns:
pd.DataFrame

A table consisting of sorted units across the entire extracellular electrophysiology project

allensdk.brain_observatory.ecephys.ecephys_project_cache.count_owned(this, other, foreign_key, count_key, inplace=False)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.get_grouped_uniques(this, other, foreign_key, field_key, unique_key, inplace=False)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.read_csv(path) → pandas.core.frame.DataFrame[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.read_metrics_csv(path)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.read_movie(path)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.read_nwb(path)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.read_scene(path)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.write_csv(path, df)[source]
allensdk.brain_observatory.ecephys.ecephys_project_cache.write_metrics_csv(path, df)[source]