allensdk.brain_observatory.nwb.nwb_utils module

class allensdk.brain_observatory.nwb.nwb_utils.NWBWriter(nwb_filepath: str, session_data: dict, serializer: Union[allensdk.core._data_object_base.readable_interfaces.JsonReadableInterface, allensdk.core._data_object_base.readable_interfaces.NwbReadableInterface, allensdk.core._data_object_base.writable_interfaces.NwbWritableInterface])[source]

Bases: object

Base class for writing NWB files

nwb_filepath

Path to write nwb file

write_nwb(self, **kwargs)[source]

Tries to write nwb to disk. If it fails, the filepath has “.error” appended

Parameters:
kwargs: kwargs sent to `from_json`, `from_nwb`, `to_nwb`
allensdk.brain_observatory.nwb.nwb_utils.add_image_to_nwb(nwbfile: pynwb.file.NWBFile, image_data: allensdk.brain_observatory.behavior.image_api.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
allensdk.brain_observatory.nwb.nwb_utils.get_image(nwbfile: pynwb.file.NWBFile, name: str, module: str) → allensdk.brain_observatory.behavior.image_api.Image[source]