NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

matnwb does not support spaces in names #35

Open bendichter opened 6 years ago

bendichter commented 6 years ago

Since names are used as field names of objects, matnwb does not allow them to have spaces. pynwb does allow spaces. Maybe a compromise would be to automatically replace all spaces with underscores in matnwb.

lawrence-mbf commented 6 years ago

I believe spaces work with open Sets (basically, any Group structure that can have 0 or more items in it) as they are Map-backed. The only other place that could include spaces would be at the YAML level (core schema and extensions) which will definitely require some work.

Is there a bug where this doesn't work, or are you experiencing a use case that breaks this?

bendichter commented 6 years ago

Yes, the problem I was having with specifically with the names in an extension YAML, but I think the best solution would be to enforce no spaces on the pynwb side

lawrence-mbf commented 6 years ago

So I see two thing needing work to get extensions with spaces working:

  1. Add a check when generating files to replace spaces in property values. This should be fairly simple.
  2. Do a check before reading a compound data type, recreate the compound type using new member names, then reading it as normal.

This will "allow" spaces for class properties and makes compound data types readable if they have spaces.

I'll look into this.