pynwb.core module

pynwb.core.prepend_string(string, prepend=' ')[source]
class pynwb.core.NWBMixin(name)[source]

Bases: hdmf.container.AbstractContainer

Parameters:name (str) – the name of this container
get_ancestor(neurodata_type=None)[source]

Traverse parent hierarchy and return first instance of the specified data_type

Parameters:neurodata_type (str) – the data_type to search for
class pynwb.core.NWBContainer(name)[source]

Bases: pynwb.core.NWBMixin, hdmf.container.Container

Parameters:name (str) – the name of this container
namespace = 'core'
neurodata_type = 'NWBContainer'
class pynwb.core.NWBDataInterface(name)[source]

Bases: pynwb.core.NWBContainer

Parameters:name (str) – the name of this container
namespace = 'core'
neurodata_type = 'NWBDataInterface'
class pynwb.core.NWBData(name, data)[source]

Bases: pynwb.core.NWBMixin, hdmf.container.Data

Parameters:
data
__getitem__(args)[source]
append(arg)[source]
extend(arg)[source]
namespace = 'core'
neurodata_type = 'NWBData'
class pynwb.core.ScratchData(name, data, notes='')[source]

Bases: pynwb.core.NWBData

Parameters:
namespace = 'core'
neurodata_type = 'ScratchData'
class pynwb.core.NWBTable(columns, name, data=[])[source]

Bases: pynwb.core.NWBData

Subclasses should specify the class attribute __columns__.

This should be a list of dictionaries with the following keys:

  • name the column name
  • type the type of data in this column
  • doc a brief description of what gets stored in this column

For reference, this list of dictionaries will be used with docval to autogenerate the add_row method for adding data to this table.

If __columns__ is not specified, no custom add_row method will be added.

The class attribute __defaultname__ can also be set to specify a default name for the table class. If __defaultname__ is not specified, then name will need to be specified when the class is instantiated.

Parameters:
columns
add_row(values)[source]
Parameters:values (dict) – the values for each column
which(**kwargs)[source]

Query a table

__getitem__(args)[source]
to_dataframe()[source]

Produce a pandas DataFrame containing this table’s data.

classmethod from_dataframe(df, name=None, extra_ok=False)[source]
Construct an instance of NWBTable (or a subclass) from a pandas DataFrame. The columns of the dataframe
should match the columns defined on the NWBTable subclass.
Parameters:
  • df (DataFrame) – input data
  • name (str) – the name of this container
  • extra_ok (bool) – accept (and ignore) unexpected columns on the input dataframe
class pynwb.core.NWBTableRegion(name, table, region)[source]

Bases: pynwb.core.NWBData, hdmf.container.DataRegion

A class for representing regions i.e. slices or indices into an NWBTable

Parameters:
  • name (str) – the name of this container
  • table (NWBTable) – the ElectrodeTable this region applies to
  • region (slice or list or tuple or RegionReference) – the indices of the table
table

The ElectrodeTable this region applies to

region

The indices into table

__getitem__(idx)[source]
class pynwb.core.MultiContainerInterface(name)[source]

Bases: pynwb.core.NWBDataInterface, hdmf.container.MultiContainerInterface

Defined in PyNWB for API backward compatibility. See HDMF MultiContainterInterface for details.

Parameters:name (str) – the name of this container