allensdk.brain_observatory.ecephys.ecephys_project_api package

Submodules

Module contents

class allensdk.brain_observatory.ecephys.ecephys_project_api.EcephysProjectApi[source]

Bases: object

get_channels(channel_ids: ArrayLike | None = None, probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None)[source]
get_isi_experiments(*args, **kwargs)[source]
get_natural_movie_template(number) Iterable[source]
get_natural_scene_template(number) Iterable[source]
get_probe_lfp_data(probe_id: int) Iterable[source]
get_probes(probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None)[source]
get_session_data(session_id: int) Iterable[source]
get_sessions(session_ids: ArrayLike | None = None, published_at: str | None = None)[source]
get_unit_analysis_metrics(unit_ids: ArrayLike | None = None, ecephys_session_ids: ArrayLike | None = None, session_types: ArrayLike | None = None) DataFrame[source]
get_units(unit_ids: ArrayLike | None = None, channel_ids: ArrayLike | None = None, probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None)[source]
class allensdk.brain_observatory.ecephys.ecephys_project_api.EcephysProjectFixedApi[source]

Bases: EcephysProjectApi

get_channels(*args, **kwargs)[source]
get_isi_experiments(*args, **kwargs)[source]
get_natural_movie_template(number, *args, **kwargs)[source]
get_natural_scene_template(number, *args, **kwargs)[source]
get_probe_lfp_data(probe_id, *args, **kwargs)[source]
get_probes(*args, **kwargs)[source]
get_session_data(session_id, *args, **kwargs)[source]
get_sessions(*args, **kwargs)[source]
get_targeted_regions(*args, **kwargs)[source]
get_units(*args, **kwargs)[source]
class allensdk.brain_observatory.ecephys.ecephys_project_api.EcephysProjectLimsApi(postgres_engine, app_engine)[source]

Bases: EcephysProjectApi

STIMULUS_TEMPLATE_NAMESPACE = 'brain_observatory_1.1'
classmethod default(lims_credentials: DbCredentials | None = None, app_kwargs=None, asynchronous=False)[source]

Construct a “straightforward” lims api that can fetch data from lims2.

Parameters:
lims_credentialsDbCredentials

Credentials and configuration for postgres queries against the LIMS database. If left unspecified will attempt to provide credentials from environment variables.

app_kwargsdict

High-level configuration for http requests. See allensdk.brain_observatory.ecephys.ecephys_project_api.http_engine.HttpEngine and AsyncHttpEngine for details.

asynchronousbool

If true, (http) queries will be made asynchronously.

Returns:
EcephysProjectLimsApi
get_channels(channel_ids: ArrayLike | None = None, probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None) DataFrame[source]

Download a table of ecephys channel records.

Parameters:
channel_ids

A collection of integer identifiers for ecephys channels. If provided, results will be filtered to these channels.

probe_ids

A collection of integer identifiers for ecephys probes. If provided, results will be filtered to channels on these probes.

session_ids

A collection of integer identifiers for ecephys sessions. If provided, results will be filtered to channels recorded from during these sessions.

published_at

A date (rendered as “YYYY-MM-DD”). If provided, only channels recorded from during sessions published before this date will be returned.

Returns:
a pd.DataFrame whose rows are ecephys channels.
get_natural_movie_template(number: int) Iterable[bytes][source]

Download a template for the natural movie stimulus. This is the actual movie that was shown during the recording session.

Parameters:
number

idenfifier for this movie (note that this is an integer, so to get the template for natural_movie_three you should pass in 3)

Returns:
An iterable yielding an npy file as bytes
get_natural_scene_template(number: int) Iterable[bytes][source]

Download a template for the natural scene stimulus. This is the actual image that was shown during the recording session.

Parameters:
number

idenfifier for this scene

Returns:
An iterable yielding a tiff file as bytes.
get_probe_lfp_data(probe_id: int) Iterable[bytes][source]

Download an NWB file containing detailed data for the local field potential recorded from an ecephys probe.

Parameters:
probe_id

Download an NWB file for this probe’s LFP

Returns:
An iterable yielding an NWB file as bytes.
get_probes(probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None) DataFrame[source]

Download a table of ecephys probe records.

Parameters:
probe_ids

A collection of integer identifiers for ecephys probes. If provided, results will be filtered to these probes.

session_ids

A collection of integer identifiers for ecephys sessions. If provided, results will be filtered to probes recorded from during these sessions.

published_at

A date (rendered as “YYYY-MM-DD”). If provided, only probes recorded from during sessions published before this date will be returned.

Returns:
a pd.DataFrame whose rows are ecephys probes.
get_session_data(session_id: int) Iterable[bytes][source]

Download an NWB file containing detailed data for an ecephys session.

Parameters:
session_id

Download an NWB file for this session

Returns:
An iterable yielding an NWB file as bytes.
get_sessions(session_ids: ArrayLike | None = None, published_at: str | None = None) DataFrame[source]

Download a table of ecephys session records.

Parameters:
session_ids

A collection of integer identifiers for ecephys sessions. If provided, results will be filtered to these sessions.

published_at

A date (rendered as “YYYY-MM-DD”). If provided, only sessions published before this date will be returned.

Returns:
a pd.DataFrame whose rows are ecephys sessions.
get_unit_analysis_metrics(unit_ids: ArrayLike | None = None, ecephys_session_ids: ArrayLike | None = None, session_types: ArrayLike | None = None) DataFrame[source]

Fetch analysis metrics (stimulus set-specific characterizations of unit response patterns) for ecephys units. Note that the metrics returned depend on the stimuli that were presented during recording ( and thus on the session_type)

Parameters

unit_ids :

integer identifiers for a set of ecephys units. If provided, the response will only include metrics calculated for these units

ecephys_session_ids :

integer identifiers for a set of ecephys sessions. If provided, the response will only include metrics calculated for units identified during these sessions

session_types :

string names identifying ecephys session types (e.g. “brain_observatory_1.1” or “functional_connectivity”)

Returns:
a pandas dataframe indexed by ecephys unit id whose columns are
metrics.
get_units(unit_ids: ArrayLike | None = None, channel_ids: ArrayLike | None = None, probe_ids: ArrayLike | None = None, session_ids: ArrayLike | None = None, published_at: str | None = None) DataFrame[source]

Download a table of records describing sorted ecephys units.

Parameters:
unit_ids

A collection of integer identifiers for sorted ecephys units. If provided, only return records describing these units.

channel_ids

A collection of integer identifiers for ecephys channels. If provided, results will be filtered to units recorded from these channels.

probe_ids

A collection of integer identifiers for ecephys probes. If provided, results will be filtered to units recorded from these probes.

session_ids

A collection of integer identifiers for ecephys sessions. If provided, results will be filtered to units recorded during these sessions.

published_at

A date (rendered as “YYYY-MM-DD”). If provided, only units recorded during sessions published before this date will be returned.

Returns:
a pd.DataFrame whose rows are ecephys channels.
class allensdk.brain_observatory.ecephys.ecephys_project_api.EcephysProjectWarehouseApi(rma_engine=None)[source]

Bases: EcephysProjectApi

classmethod default(asynchronous=False, **rma_kwargs)[source]
get_channels(channel_ids=None, probe_ids=None)[source]
get_natural_movie_template(number)[source]
get_natural_scene_template(number)[source]
get_probe_lfp_data(probe_id)[source]
get_probes(probe_ids=None, session_ids=None)[source]
get_session_data(session_id, **kwargs)[source]
get_sessions(session_ids=None, has_eye_tracking=None, stimulus_names=None)[source]
get_unit_analysis_metrics(unit_ids=None, ecephys_session_ids=None, session_types=None)[source]

Download analysis metrics - precalculated descriptions of unitwise responses to visual stimulation.

Parameters:
unit_idsarray-like of int, optional

Unique identifiers for ecephys units. If supplied, only download metrics for these units.

ecephys_session_idsarray-like of int, optional

Unique identifiers for ecephys sessions. If supplied, only download metrics for units collected during these sessions.

session_typesarray-like of str, optional

Names of session types. e.g. “brain_observatory_1.1” or “functional_connectivity”. If supplied, only download metrics for units collected during sessions of these types

Returns:
pd.DataFrame

A table of analysis metrics, indexed by unit_id.

get_units(unit_ids=None, channel_ids=None, probe_ids=None, session_ids=None, *a, **k)[source]
movie_re = re.compile('.*natural_movie_(?P<num>\\d+).npy')
scene_re = re.compile('.*/(?P<num>\\d+).tiff')
property stimulus_templates
exception allensdk.brain_observatory.ecephys.ecephys_project_api.MissingDataError[source]

Bases: ValueError