allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates module

class allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusImage(warped: numpy.ndarray, unwarped: numpy.ndarray, name: str)[source]

Bases: object

Container class for image stimuli

name
class allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusImageFactory[source]

Bases: object

Factory for StimulusImage

static from_processed(warped: numpy.ndarray, unwarped: numpy.ndarray, name: str) → allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusImage[source]

Creates a StimulusImage from processed input (usually nwb). Image has already been warped and preprocessed

from_unprocessed(self, input_array: numpy.ndarray, name: str) → allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusImage[source]

Creates a StimulusImage from unprocessed input (usually pkl). Image needs to be warped and preprocessed

class allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusTemplate(image_set_name: str, images: List[allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusImage])[source]

Bases: object

Container class for a collection of image stimuli

image_names
image_set_name
images
items(self)[source]
keys(self)[source]
to_dataframe(self) → pandas.core.frame.DataFrame[source]
values(self)[source]
class allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusTemplateFactory[source]

Bases: object

Factory for StimulusTemplate

static from_processed(image_set_name: str, image_attributes: List[dict], unwarped: List[numpy.ndarray], warped: List[numpy.ndarray]) → allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusTemplate[source]

Create StimulusTemplate from nwb or other processed input. Stimulus templates created this way DO NOT need to be processed to acquire unwarped versions of the images presented.

NOTE: The ordering of image_attributes, unwarped, and warped matter!

NOTE: Warped images display what was seen on a monitor by a subject. Unwarped images display a ‘diagnostic’ version of the stimuli to be presented.

Parameters:
image_set_name : str
The name of the image set. Example:

Natural_Images_Lum_Matched_set_TRAINING_2017.07.14

image_attributes : List[dict]

A list of dictionaries containing image metadata. Must at least contain the key:

image_name

But will usually also contain:

image_category, orientation, phase, spatial_frequency, image_index

unwarped : List[np.ndarray]

A list of unwarped image arrays

warped : List[np.ndarray]

A list of warped image arrays

Returns:
StimulusTemplate

A StimulusTemplate object

static from_unprocessed(image_set_name: str, image_attributes: List[dict], images: List[numpy.ndarray]) → allensdk.brain_observatory.behavior.stimulus_processing.stimulus_templates.StimulusTemplate[source]

Create StimulusTemplate from pkl or unprocessed input. Stimulus templates created this way need to be processed to acquire unwarped versions of the images presented.

NOTE: The ordering of image_attributes and images matter!

NOTE: Warped images display what was seen on a monitor by a subject. Unwarped images display a ‘diagnostic’ version of the stimuli to be presented.

Parameters:
image_set_name : str
The name of the image set. Example:

Natural_Images_Lum_Matched_set_TRAINING_2017.07.14

image_attributes : List[dict]

A list of dictionaries containing image metadata. Must at least contain the key:

image_name

But will usually also contain:

image_category, orientation, phase, spatial_frequency, image_index

images : List[np.ndarray]

A list of image arrays

Returns:
StimulusTemplate

A StimulusTemplate object