allensdk.brain_observatory.nwb package¶
Subpackages¶
Submodules¶
Module contents¶
- allensdk.brain_observatory.nwb.add_cell_specimen_table(nwbfile: NWBFile, cell_specimen_table: DataFrame, session_metadata: dict)[source]¶
This function takes the cell specimen table and writes the ROIs contained within. It writes these to a new NWB imaging plane based off the previously supplied metadata
- Parameters:
- nwbfile: NWBFile
this is the in memory NWBFile currently being written to which ROI data is added
- cell_specimen_table: pd.DataFrame
this is the DataFrame containing the cells segmented from a ophys experiment, stored in json file and loaded. example: /home/nicholasc/projects/allensdk/allensdk/test/
brain_observatory/behavior/cell_specimen_table_789359614.json
- session_metadata: dict
Dictionary containing cell_specimen_table related metadata. Should include at minimum the following fields:
“emission_lambda”, “excitation_lambda”, “indicator”, “targeted_structure”, and ophys_frame_rate”
- Returns:
- nwbfile: NWBFile
The altered in memory NWBFile object that now has a specimen table
- allensdk.brain_observatory.nwb.add_corrected_fluorescence_traces(nwbfile, corrected_fluorescence_traces)[source]¶
- allensdk.brain_observatory.nwb.add_eye_gaze_data_interfaces(pynwb_container: NWBContainer, pupil_areas: Series, eye_areas: Series, screen_coordinates: DataFrame, screen_coordinates_spherical: DataFrame, synced_timestamps: Series) NWBContainer [source]¶
- allensdk.brain_observatory.nwb.add_eye_gaze_mapping_data_to_nwbfile(nwbfile: NWBFile, eye_gaze_data: dict) NWBFile [source]¶
- allensdk.brain_observatory.nwb.add_eye_tracking_ellipse_fit_data_to_nwbfile(nwbfile: NWBFile, eye_dlc_tracking_data: dict, synced_timestamps: Series) 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 epochs
- Returns:
- pynwb.NWBFile
- allensdk.brain_observatory.nwb.add_running_acquisition_to_nwbfile(nwbfile, running_acquisition_df: DataFrame)[source]¶
- allensdk.brain_observatory.nwb.add_running_speed_to_nwbfile(nwbfile, running_speed, name='speed', unit='cm/s', from_dataframe=False)[source]¶
Adds running speed data to an NWBFile as a timeseries in acquisition
- Parameters:
- nwbfilepynwb.NWBFile
File to which running speeds will be written
- running_speedUnion[RunningSpeed, pd.DataFrame]
Either a RunningSpeed object or pandas DataFrame. Contains attributes ‘values’ and ‘timestamps’
- namestr, optional
Used as name of timeseries object
- unitstr, optional
SI units of running speed values
- from_dataframebool, optional
Whether running_speed is a dataframe or not. Default is False.
- Returns:
- nwbfilepynwb.NWBFile
- allensdk.brain_observatory.nwb.add_segmentation_mask_image(nwbfile, segmentation_mask_image, image_api=None)[source]¶
- allensdk.brain_observatory.nwb.add_stimulus_timestamps(nwbfile, stimulus_timestamps, module_name='stimulus')[source]¶
- allensdk.brain_observatory.nwb.check_nwbfile_version(nwbfile_path: str, desired_minimum_version: str, warning_msg: str)[source]¶
- allensdk.brain_observatory.nwb.create_eye_gaze_mapping_dataframe(eye_gaze_data: dict) DataFrame [source]¶
- allensdk.brain_observatory.nwb.create_eye_tracking_nwb_processing_module(eye_dlc_tracking_data: dict, synced_timestamps: Series) ProcessingModule [source]¶
- allensdk.brain_observatory.nwb.create_gaze_mapping_nwb_processing_modules(eye_gaze_data: dict)[source]¶
- allensdk.brain_observatory.nwb.create_stimulus_presentation_time_interval(name: str, description: str, columns_to_add: Iterable) TimeIntervals [source]¶
- allensdk.brain_observatory.nwb.eye_tracking_data_is_valid(eye_dlc_tracking_data: dict, synced_timestamps: Series) bool [source]¶
- allensdk.brain_observatory.nwb.read_eye_dlc_tracking_ellipses(input_path: 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: 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)