allensdk.brain_observatory.nwb package¶
Submodules¶
Module contents¶
-
allensdk.brain_observatory.nwb.
add_corrected_fluorescence_traces
(nwbfile, corrected_fluorescence_traces)[source]¶
-
allensdk.brain_observatory.nwb.
add_eye_gaze_data_interfaces
(pynwb_container: pynwb.core.NWBContainer, pupil_areas: pandas.core.series.Series, eye_areas: pandas.core.series.Series, screen_coordinates: pandas.core.frame.DataFrame, screen_coordinates_spherical: pandas.core.frame.DataFrame, synced_timestamps: pandas.core.series.Series) → pynwb.core.NWBContainer[source]¶
-
allensdk.brain_observatory.nwb.
add_eye_gaze_mapping_data_to_nwbfile
(nwbfile: pynwb.file.NWBFile, eye_gaze_data: dict) → pynwb.file.NWBFile[source]¶
-
allensdk.brain_observatory.nwb.
add_eye_tracking_ellipse_fit_data_to_nwbfile
(nwbfile: pynwb.file.NWBFile, eye_dlc_tracking_data: dict, synced_timestamps: pandas.core.series.Series) → pynwb.file.NWBFile[source]¶
-
allensdk.brain_observatory.nwb.
add_image
(nwbfile, image_data, image_name, module_name, module_description, image_api=None)[source]¶
-
allensdk.brain_observatory.nwb.
add_invalid_times
(nwbfile, epochs)[source]¶ Write invalid times to nwbfile if epochs are not empty Parameters ———- nwbfile: pynwb.NWBFile epochs: list of dicts
records of invalid epochsReturns: - pynwb.NWBFile
-
allensdk.brain_observatory.nwb.
add_running_data_df_to_nwbfile
(nwbfile, running_data_df, unit_dict, index_key='timestamps')[source]¶ Adds running speed data to an NWBFile as timeseries in acquisition and processing
Parameters: - nwbfile : pynwb.NWBFile
File to which runnign speeds will be written
- running_speed : pandas.DataFrame
Contains ‘speed’ and ‘times’, ‘v_in’, ‘vsig’, ‘dx’
- unit : str, optional
SI units of running speed values
Returns: - nwbfile : pynwb.NWBFile
-
allensdk.brain_observatory.nwb.
add_running_speed_to_nwbfile
(nwbfile, running_speed, name='speed', unit='cm/s')[source]¶ Adds running speed data to an NWBFile as a timeseries in acquisition
Parameters: - nwbfile : pynwb.NWBFile
File to which runnign speeds will be written
- running_speed : RunningSpeed
Contains attributes ‘values’ and ‘timestamps’
- name : str, optional
used as name of timeseries object
- unit : str, optional
SI units of running speed values
Returns: - nwbfile : pynwb.NWBFile
-
allensdk.brain_observatory.nwb.
add_segmentation_mask_image
(nwbfile, segmentation_mask_image, image_api=None)[source]¶
-
allensdk.brain_observatory.nwb.
add_stimulus_presentations
(nwbfile, stimulus_table, tag='stimulus_epoch')[source]¶ Adds a stimulus table (defining stimulus characteristics for each time point in a session) to an nwbfile as epochs.
Parameters: - nwbfile : pynwb.NWBFile
- stimulus_table: pd.DataFrame
Each row corresponds to an epoch of time. Columns define the epoch (start and stop time) and its characteristics. Nans will be replaced with the empty string. Required columns are:
start_time :: the time at which this epoch started stop_time :: the time at which this epoch ended
- tag : str, optional
Each epoch in an nwb file has one or more tags. This string will be applied as a tag to all epochs created here
Returns: - nwbfile : pynwb.NWBFile
-
allensdk.brain_observatory.nwb.
add_stimulus_timestamps
(nwbfile, stimulus_timestamps, module_name='stimulus')[source]¶
-
allensdk.brain_observatory.nwb.
create_eye_gaze_mapping_dataframe
(eye_gaze_data: dict) → pandas.core.frame.DataFrame[source]¶
-
allensdk.brain_observatory.nwb.
create_eye_tracking_nwb_processing_module
(eye_dlc_tracking_data: dict, synced_timestamps: pandas.core.series.Series) → pynwb.base.ProcessingModule[source]¶
-
allensdk.brain_observatory.nwb.
create_gaze_mapping_nwb_processing_modules
(eye_gaze_data: dict)[source]¶
-
allensdk.brain_observatory.nwb.
eye_tracking_data_is_valid
(eye_dlc_tracking_data: dict, synced_timestamps: pandas.core.series.Series) → bool[source]¶
-
allensdk.brain_observatory.nwb.
read_eye_dlc_tracking_ellipses
(input_path: pathlib.Path) → dict[source]¶ Reads eye tracking ellipse fit data from an h5 file.
- Args:
- input_path (Path): Path to eye tracking ellipse fit h5 file
- Returns:
- dict: Loaded h5 data. Each ‘params’ field contains dataframes with]
- ellipse fit parameters. Dataframes contain 5 columns each consisting of: “center_x”, “center_y”, “height”, “phi”, “width”
-
allensdk.brain_observatory.nwb.
read_eye_gaze_mappings
(input_path: pathlib.Path) → dict[source]¶ Reads eye gaze mapping data from an h5 file.
- Args:
- input_path (Path): Path to eye gaze mapping h5 data file produced by
- ‘allensdk.brain_observatory.gaze_mapping’ module.
- Returns:
- dict: Loaded h5 data.
- *_eye_areas: Area of eye (in pixels^2) over time *_pupil_areas: Area of pupil (in pixels^2) over time *_screen_coordinates: y, x screen coordinates (in cm) over time *_screen_coordinates_spherical: y, x screen coordinates (in deg) over time synced_frame_timestamps: synced timestamps for video frames (in sec)
-
allensdk.brain_observatory.nwb.
setup_table_for_invalid_times
(invalid_epochs)[source]¶ Create table with invalid times if invalid_epochs are present
Parameters: - invalid_epochs: list of dicts
of invalid epoch records
Returns: - pd.DataFrame of invalid times if epochs are not empty, otherwise return None