ipfx.attach_metadata.sink package

Submodules

ipfx.attach_metadata.sink.dandi_yaml_sink module

Sink for metadata intended to be uploaded to DANDI

class ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink[source]

Bases: ipfx.attach_metadata.sink.metadata_sink.MetadataSink

Sink specialized for writing data to a DANDI-compatible YAML file.

Attributes:
supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets.

Methods

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/dandi_yaml_sink.py:docstring of ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink.register’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/dandi_yaml_sink.py:docstring of ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink.register_target’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/dandi_yaml_sink.py:docstring of ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink.register_targets’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/dandi_yaml_sink.py:docstring of ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.dandi_yaml_sink.DandiYamlSink.serialize’
register(self, name, value, sweep_id, …) Attaches a named piece of metadata to this sink’s internal store.
register_target(self, target, Any]) Preregister a single target specification on this sink.
register_targets(self, targets, Any], …) Configures targets for this sink.
serialize(self, targets, Any], …) Writes this sink’s data to an external target or targets.
register(self, name:str, value:Any, sweep_id:Union[int, NoneType]=None)[source]

Attaches a named piece of metadata to this sink’s internal store. Should dispatch to a protected method which carries out appropriate validations and transformations.

Parameters:
name : the well-known name of the metadata
value : the value of the metadata (before any required transformations)
sweep_id : If provided, this will be interpreted as sweep-level

metadata and sweep_id will be used to identify the sweep to which value ought to be attached. If None, this will be interpreted as cell-level metadata

Raises:
ValueError : An argued piece of metadata is not supported by this sink
serialize(self, targets:Union[Dict[str, Any], Collection[Dict[str, Any]], NoneType]=None)[source]

Writes this sink’s data to an external target or targets. Does not modify this sink.

Parameters:
targets : If provided, these targets will be written to. Otherwise,

write to targets previously defined by register_target.

supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets. Calling serialize with no arguments will write to these.

ipfx.attach_metadata.sink.metadata_sink module

Base class for metadata sinks, which serve as a staging ground for metadata attachment.

class ipfx.attach_metadata.sink.metadata_sink.MetadataSink[source]

Bases: abc.ABC

Abstract(ish) interface for metadata sinks.

Attributes:
supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets.

Methods

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/metadata_sink.py:docstring of ipfx.attach_metadata.sink.metadata_sink.MetadataSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.metadata_sink.MetadataSink.register’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/metadata_sink.py:docstring of ipfx.attach_metadata.sink.metadata_sink.MetadataSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.metadata_sink.MetadataSink.register_target’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/metadata_sink.py:docstring of ipfx.attach_metadata.sink.metadata_sink.MetadataSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.metadata_sink.MetadataSink.register_targets’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/metadata_sink.py:docstring of ipfx.attach_metadata.sink.metadata_sink.MetadataSink, line 30)

toctree references unknown document ‘ipfx.attach_metadata.sink.metadata_sink.MetadataSink.serialize’
register(self, name, value, sweep_id, …) Attaches a named piece of metadata to this sink’s internal store.
register_target(self, target, Any]) Preregister a single target specification on this sink.
register_targets(self, targets, Any], …) Configures targets for this sink.
serialize(self, targets, Any], …) Writes this sink’s data to an external target or targets.
register(self, name:str, value:Any, sweep_id:Union[int, NoneType]=None)[source]

Attaches a named piece of metadata to this sink’s internal store. Should dispatch to a protected method which carries out appropriate validations and transformations.

Parameters:
name : the well-known name of the metadata
value : the value of the metadata (before any required transformations)
sweep_id : If provided, this will be interpreted as sweep-level

metadata and sweep_id will be used to identify the sweep to which value ought to be attached. If None, this will be interpreted as cell-level metadata

Raises:
ValueError : An argued piece of metadata is not supported by this sink
register_target(self, target:Dict[str, Any])[source]

Preregister a single target specification on this sink.

Parameters:
target : Must provide parameters required for serialization
register_targets(self, targets:Union[Dict[str, Any], Collection[Dict[str, Any]]])[source]

Configures targets for this sink. Calls to serialize (without new targets supplied) will write to these targets.

Parameters:
targets : Configure these targets. Each should be a dictionary which

passes this class’s validate_target method

serialize(self, targets:Union[Dict[str, Any], Collection[Dict[str, Any]], NoneType]=None)[source]

Writes this sink’s data to an external target or targets. Does not modify this sink.

Parameters:
targets : If provided, these targets will be written to. Otherwise,

write to targets previously defined by register_target.

supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets. Calling serialize with no arguments will write to these.

ipfx.attach_metadata.sink.nwb2_sink module

Sink for appending to an NWBFile (not in place)

class ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink(nwb_path: Union[str, pathlib.Path, None])[source]

Bases: ipfx.attach_metadata.sink.metadata_sink.MetadataSink

A metadata sink which modifies an NWBFile (in-memory representation of an NWB 2 file)

Attributes:
supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets.

Methods

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/nwb2_sink.py:docstring of ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink, line 31)

toctree references unknown document ‘ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink.register’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/nwb2_sink.py:docstring of ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink, line 31)

toctree references unknown document ‘ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink.register_target’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/nwb2_sink.py:docstring of ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink, line 31)

toctree references unknown document ‘ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink.register_targets’

System Message: WARNING/2 (/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/latest/ipfx/attach_metadata/sink/nwb2_sink.py:docstring of ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink, line 31)

toctree references unknown document ‘ipfx.attach_metadata.sink.nwb2_sink.Nwb2Sink.serialize’
register(self, name, value, sweep_id, …) Attaches a named piece of metadata to this sink’s internal store.
register_target(self, target, Any]) Preregister a single target specification on this sink.
register_targets(self, targets, Any], …) Configures targets for this sink.
serialize(self, targets, Any], …) Writes this sink’s data to an external target or targets.
register(self, name:str, value:Any, sweep_id:Union[int, NoneType]=None)[source]

Attaches a named piece of metadata to this sink’s internal store. Should dispatch to a protected method which carries out appropriate validations and transformations.

Parameters:
name : the well-known name of the metadata
value : the value of the metadata (before any required transformations)
sweep_id : If provided, this will be interpreted as sweep-level

metadata and sweep_id will be used to identify the sweep to which value ought to be attached. If None, this will be interpreted as cell-level metadata

Raises:
ValueError : An argued piece of metadata is not supported by this sink
serialize(self, targets:Union[Dict[str, Any], Collection[Dict[str, Any]], NoneType]=None)[source]

Writes this sink’s data to an external target or targets. Does not modify this sink.

Parameters:
targets : If provided, these targets will be written to. Otherwise,

write to targets previously defined by register_target.

supported_cell_fields

The names of each cell-level field supported by this sink.

supported_sweep_fields

The names of each sweep-level field supported by this sink.

targets

A sequence of preregistered targets. Calling serialize with no arguments will write to these.

ipfx.attach_metadata.sink.nwb2_sink.set_container_sources(container:hdmf.container.AbstractContainer, source:str)[source]

Traverse an NWBFile starting at a given container, setting the container_source attribute inplace on each container.

Parameters:
container : container_source will be set on this object as well as on

each of its applicable children.

source : The new value of container source

Module contents

Sinks (in-memory staging areas) for metadata

ipfx.attach_metadata.sink.default_sink_kinds() → Dict[str, Type[ipfx.attach_metadata.sink.metadata_sink.MetadataSink]][source]

Maps string names to metadata sink classes