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.MetadataSinkSink specialized for writing data to a DANDI-compatible YAML file.
-
register(name: str, value: Any, sweep_id: Optional[int] = 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.
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 metadataValueError : An argued piece of metadata is not supported by this sink
-
serialize(targets: Union[Dict[str, Any], Collection[Dict[str, Any]], None] = None)[source]¶ Writes this sink’s data to an external target or targets. Does not modify this sink.
- 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.ABCAbstract(ish) interface for metadata sinks.
-
register(name: str, value: Any, sweep_id: Optional[int] = 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.
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 metadataValueError : An argued piece of metadata is not supported by this sink
-
register_target(target: Dict[str, Any])[source]¶ Preregister a single target specification on this sink.
target : Must provide parameters required for serialization
-
register_targets(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.
- targets : Configure these targets. Each should be a dictionary which
- passes this class’s validate_target method
-
serialize(targets: Union[Dict[str, Any], Collection[Dict[str, Any]], None] = None)[source]¶ Writes this sink’s data to an external target or targets. Does not modify this sink.
- 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.MetadataSinkA metadata sink which modifies an NWBFile (in-memory representation of an NWB 2 file)
-
register(name: str, value: Any, sweep_id: Optional[int] = 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.
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 metadataValueError : An argued piece of metadata is not supported by this sink
-
serialize(targets: Union[Dict[str, Any], Collection[Dict[str, Any]], None] = None)[source]¶ Writes this sink’s data to an external target or targets. Does not modify this sink.
- 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.
- 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