allensdk.brain_observatory.nwb.nwb_utils module¶
- class allensdk.brain_observatory.nwb.nwb_utils.NWBWriter(nwb_filepath: str, session_data: dict, serializer: JsonReadableInterface | NwbReadableInterface | NwbWritableInterface)[source]¶
Bases:
objectBase class for writing NWB files
- property nwb_filepath: str¶
Path to write nwb file
- write_nwb(id_column_name: str = 'behavior_session_id', skip_metadata: List[str] | None = None, skip_stim: List[str] | None = None, **kwargs)[source]¶
Tries to write nwb to disk. If it fails, the filepath has “.error” appended
- Parameters:
- id_column_namestr
Name of the id column to pull from metadata.
- skip_metadatalist of str
Name of key in session_data to skip when comparing to session.
- skip_stimlist of str
Name of key in stimulus file to skip when comparing to session.
- kwargs: kwargs sent to `from_nwb`, `to_nwb`
- allensdk.brain_observatory.nwb.nwb_utils.add_image_to_nwb(nwbfile: NWBFile, image_data: Image, image_name: str)[source]¶
Adds image given by image_data with name image_name to nwbfile
- Parameters:
- nwbfile
nwbfile to add image to
- image_data
The image data
- image_name
Image name
- Returns:
- None
- allensdk.brain_observatory.nwb.nwb_utils.get_column_name(table_cols: list, possible_names: set) str[source]¶
This function returns a column name, given a table with unknown column names and a set of possible column names which are expected. The table column name returned should be the only name contained in the “expected” possible names. :param table_cols: the table columns to search for the possible name within :param possible_names: the names that could exist within the data columns :return: the first entry of the intersection between the possible names
and the names of the columns of the stimulus table