Skip to content

[Feature]: separation of NWBFile formation and dataset configuration #441

Description

@bendichter

What would you like to see added to NeuroConv?

We are in the process of generalizing NeuroConv to support HDF5 and Zarr backends and found that there are many places in the code that use H5DataIO, which is causing problems for the Zarr backend. Another problem is that you cannot set conversion options individually for different datasets, which has become a problem in some applications. The proposed solution is to remove all of these H5DataIO calls and instead provide a separate interface to alter these settings on a per-dataset basis in a later step. This provides a separation between setting the values of the data and metadata and setting the storage options.

Here is a proposal based on our conversation and some follow-up conversations with the NWB team:

  1. Remove all H5DataIO and any other backend-specific code from the underlying methods of run_conversion, and move all other code into a new method, named something like add_to_nwb(). For each large dataset (where an H5DataIO was previously used) we would instead add each container to a dict. Something like: data_interface.dataset_configs.update[container_id, field] = dict(**default_io_kwargs)

  2. The BaseDataInterface would have an additional optional backend arg. This can be called during init or can be set later with data_interface.set_backend("hdf5|zarr") with a default "hdf5". NWBConverter would similarly have a backend arg that propagates to inner interfaces.

  3. BaseDataInterface.set_dataset_configs() would take args of the same form as dataset_configs: **{(container_id, field): dict(**io_kwargs)}.

  4. BaseDataInterface.write() would first apply all the dataset_configs and then call the NWB**IO.write() command based on the backend chosen.

  5. BaseDataInterface.run_conversion() would stick around for backwards compatibility, and would call .add_to_nwb() and then .write(). We could allow for some basic compression options as before, but this method would not allow for dataset-specific conversion options.

Thoughts on this approach?

One thing I'm not entirely happy with is the fact that it will be difficult to see which container you are adjusting with the tuple (container_id, field), because a user won't be able to see the name, location, or neurodata type of that container. It might be better for this dict to be {readable_key: dict(container_id=uuid, field=str, io_kwargs=dict)},

Is your feature request related to a problem?

No response

Do you have any interest in helping implement the feature?

No.

Code of Conduct

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions