allensdk.brain_observatory.ecephys.stimulus_analysis package

Submodules

Module contents

class allensdk.brain_observatory.ecephys.stimulus_analysis.DotMotion(ecephys_session, col_dir='Dir', col_speeds='Speed', trial_duration=1.0, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the dot motion stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) dm_analysis = DotMotion(session)

or, alternatively, pass in the file path::

dm_analysis = DotMotion(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

dm_analysis = DotMotion(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
or a list of unit_ids:

dm_analysis = DotMotion(session, filter=[914580630, 914580280, 914580278])

To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = dm_analysis.metrics()

property METRICS_COLUMNS
property directions
property known_spontaneous_keys
classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null stimulus (not used, so set to -1)

property number_directions
property number_speeds
property speeds
class allensdk.brain_observatory.ecephys.stimulus_analysis.DriftingGratings(ecephys_session, col_ori='orientation', col_tf='temporal_frequency', col_contrast='contrast', trial_duration=2.0, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the drifting gratings stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) dg_analysis = DriftingGratings(session)

or, alternatively, pass in the file path::

dg_analysis = DriftingGratings(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

dg_analysis = DriftingGratings(session, filter={'location': 'probeC', 'structure_acronym': 'VISp'})
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = dg_analysis.metrics()

property METRICS_COLUMNS
property conditionwise_statistics_contrast

Conditionwise statistics for contrast stimulus

property contrastvals

Array of grating temporal frequency conditions

classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

make_star_plot(unit_id)[source]

Make a 2P-style Star Plot based on presentationwise spike counts

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null (blank) stimulus

property number_contrast

Number of grating temporal frequency conditions

property number_ori

Number of grating orientation conditions

property number_tf

Number of grating temporal frequency conditions

property orivals

Array of grating orientation conditions

plot_raster(stimulus_condition_id, unit_id)[source]

Plot raster for one condition and one unit

plot_response_summary(unit_id, bar_thickness=0.25)[source]

Plot the spike counts across conditions

property stim_table_contrast
property stimulus_conditions_contrast

Stimulus conditions for contrast stimulus

property tfvals

Array of grating temporal frequency conditions

class allensdk.brain_observatory.ecephys.stimulus_analysis.Flashes(ecephys_session, col_color='color', trial_duration=0.25, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the full-field flash stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) fl_analysis = Flashes(session)

or, alternatively, pass in the file path::

fl_analysis = Flashes(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

fl_analysis = Flashes(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = fl_analysis.metrics()

property METRICS_COLUMNS
property colors

Array of ‘color’ conditions (black vs. white flash)

classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null stimulus (not used, so set to -1)

property number_colors

Number of ‘color’ conditions (black vs. white flash)

plot_raster(stimulus_condition_id, unit_id)[source]

Plot raster for one condition and one unit

plot_response(unit_id)[source]

Plot a histogram for the two conditions

class allensdk.brain_observatory.ecephys.stimulus_analysis.NaturalMovies(ecephys_session, trial_duration=None, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the natural movies stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) nm_analysis = NaturalMovies(session)

or, alternatively, pass in the file path::

nm_analysis = Flashes(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

nm_analysis = NaturalMovies(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = nm_analysis.metrics()

TODO: Need to find a default trial_duration otherwise class will fail

property METRICS_COLUMNS
classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition
class allensdk.brain_observatory.ecephys.stimulus_analysis.NaturalScenes(ecephys_session, col_image='frame', trial_duration=0.25, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the natural scenes stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) ns_analysis = NaturalScenes(session)

or, alternatively, pass in the file path::

ns_analysis = NaturalScenes(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

ns_analysis = NaturalScenes(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = ns_analysis.metrics()

property METRICS_COLUMNS
property frames
property images

Array of iamge labels

property images_nonblank
classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null (blank) stimulus

property number_images

Number of images shown

property number_nonblank

Number of images shown (excluding blank condition)

class allensdk.brain_observatory.ecephys.stimulus_analysis.ReceptiveFieldMapping(ecephys_session, col_pos_x='x_position', col_pos_y='y_position', trial_duration=0.25, minimum_spike_count=10.0, mask_threshold=0.5, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the receptive field mapping stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) rf_analysis = ReceptiveFieldMapping(session)

or, alternatively, pass in the file path::

rf_analysis = ReceptiveFieldMapping(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

rf_analysis = ReceptiveFieldMapping(
    session,
    filter={
    'location': 'probeC',
    'ecephys_structure_acronym': 'VISp'
    }
    )
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = rf_analysis.metrics()

property METRICS_COLUMNS
property azimuths

Array of stimulus azimuths

property elevations

Array of stimulus elevations

get_receptive_field(unit_id)[source]

Alias for _get_rf

classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null stimulus (not used, so set to -1)

property number_azimuths

Number of stimulus azimuths

property number_elevations

Number of stimulus elevations

plot_raster(stimulus_condition_id, unit_id)[source]

Plot raster for one condition and one unit

plot_rf(unit_id)[source]

Plot the spike counts across conditions

property receptive_fields

Spatial receptive fields for N units (9 x 9 x N matrix of responses)

class allensdk.brain_observatory.ecephys.stimulus_analysis.StaticGratings(ecephys_session, col_ori='orientation', col_sf='spatial_frequency', col_phase='phase', trial_duration=0.25, **kwargs)[source]

Bases: StimulusAnalysis

A class for computing single-unit metrics from the static gratings stimulus of an ecephys session NWB file.

To use, pass in a EcephysSession object::

session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) sg_analysis = StaticGratings(session)

or, alternatively, pass in the file path::

sg_analysis = StaticGratings(‘/path/to/my.nwb’)

You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:

sg_analysis = StaticGratings(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
To get a table of the individual unit metrics ranked by unit ID::

metrics_table_df = sg_analysis.metrics()

property METRICS_COLUMNS
classmethod known_stimulus_keys()[source]

Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.

make_fan_plot(unit_id)[source]

Make a 2P-style Fan Plot based on presentationwise spike counts

property metrics

Returns a pandas DataFrame of the stimulus response metrics for each unit.

property name

Return the stimulus name.

property null_condition

Stimulus condition ID for null (blank) stimulus

property number_ori

Number of grating orientation conditions

property number_phase

Number of grating phase conditions

property number_sf

Number of grating orientation conditions

property orivals

Array of grating orientation conditions

property phasevals

Array of grating phase conditions

plot_raster(stimulus_condition_id, unit_id)[source]

Plot raster for one condition and one unit

plot_response_summary(unit_id, bar_thickness=0.25)[source]

Plot the spike counts across conditions

property sfvals

Array of grating spatial frequency conditions