Open yarikoptic opened 5 years ago
I would like such a tool as well. Just printing the NWBFile
object gives some basic information. We could write a simple script that outputs just that:
I think that is pretty good, though the output reflects the organization of the PyNWB object and types, not the schema organization. e.g. experimenter
is part of the general
group within the NWBFile
group according to the schema, but is a property of the NWBFile
object above.
Or we could have the function print a more extensive hierarchy listing of the hdf5 object, perhaps by adapting the ls function of deepdish:
deepdish does not yet handle variable-length strings (shown as "Node" above) so this solution would require some work as well.
I think that is pretty good, though the output reflects the organization of the PyNWB object and types, not the schema organization
Based on the original issue, I think this seems to be what this issue asking for. Diving into the HDF5 hierarchy itself, I think can be done with h5ls, h5dump, h5py, deepish etc., I think what would be most useful is a tool that knows about the NWB types and does ls for that. I think to a first degree, doing a print of NWBFile would be a good start and then things could evolve from there, e.g., different options to dive into the file. Some command-line options that would probably be useful:
--neurodata_type <value>
: Print all entries in a file with the given neurodata_type--verbose
: For a more detailed print of the values --recursive
: To also recursively print the contents of types contained in NWBFile (e.g., the TimeSeries etc.)For a more interactive (rather than command-line-tool) option you can also look at https://github.com/NeurodataWithoutBorders/nwb-jupyter-widgets
NWBFile level of detail, may be even by default listing just number of devices, electrode groups, sounds indeed the level. If output structure also gets 'file' field (first if ordered) , then
* I even wondered about --diff-only option
To do diffs should probably be a separate tool. Also, doing diff will require additional development to compare NWBFile objects. While having functionality and tools to compare NWBFiles and do diffs will be useful, I think that should be a separate issue and tool.
Yeap, for full blown diff comparing data - a separate tool (we have nib-diff in nibabel). Here I meant literally post analysis of what pynwb-ls about you return, and removing fields with identical value. But feel free to ignore for now ;-)
Generic tools, such as
h5dump
, without NWB knowledge about data types etc are too crude hard to use. pynwb provides nice pythonic interfaces... I wondered if there could be a script/entrypoint provided by pynwb library, names e.g.nwb-ls
which would per file provide very basic information about # of datasets, time series etc, and may be unique neuro datatypes etc present in the file.E.g., although a simpler case, we have a similar tool nib-ls in nibabel IO library for neuroimaging. It allows to quickly display basic details about neuroimaging files at hand, even with basic stats if requested via additional flag, e.g.
Example of nib-ls output
```shell dbic/QA$ nib-ls -s sub-emmet*/ses*/func/*.nii.gz sub-emmet/ses-20180508/func/sub-emmet_ses-20180508_task-rest_acq-p2_bold.nii.gz int16 [ 80, 80, 30, 200] 3.00x3.00x3.99x2.00 sform [37906520] [1, 1.4e+03] sub-emmet/ses-20180521/func/sub-emmet_ses-20180521_task-rest_acq-3mm_bold.nii.gz int16 [ 82, 82, 48, 150] 3.02x3.02x3.00x0.43 sform [45633462] [1, 8.3e+02] sub-emmet/ses-20180521/func/sub-emmet_ses-20180521_task-rest_acq-p2Xs4X35mm_bold.nii.gz int16 [ 80, 80, 32, 200] 3.00x3.00x3.99x2.00 sform [40428007] [1, 1.4e+03] sub-emmet/ses-20180521/func/sub-emmet_ses-20180521_task-rest_acq-p2_bold.nii.gz int16 [ 80, 80, 30, 200] 3.00x3.00x3.99x2.00 sform [37898743] [1, 1.3e+03] sub-emmet/ses-20180531/func/sub-emmet_ses-20180531_task-rest_acq-3mm_bold.nii.gz int16 [ 82, 82, 48, 150] 3.02x3.02x3.00x0.43 sform [44318617] [1, 8.6e+02] sub-emmet/ses-20180531/func/sub-emmet_ses-20180531_task-rest_acq-p2_bold.nii.gz int16 [ 80, 80, 30, 200] 3.00x3.00x3.99x2.00 sform [37914970] [1, 1.3e+03] ```