pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

Don't allow creation of NWBGroups or NWBDatasets with spaces in the name

Open bendichter opened this issue 2 years ago • 2 comments

bendichter avatar Jan 04 '22 21:01 bendichter

Why? There might be already files around with spaces in the name and so I would say this ship has sailed.

t-b avatar Jan 04 '22 23:01 t-b

There is a potential issue in MatNWB, but only if a name is defined in a schema or extension. For instance, if you want to access the start_time of the TimeIntervals trials table, the syntax is trials.start_time. In this case, having a space would present a problem. But for custom columns, the syntax would be e.g. trials.vectordata.get('correct'). There, having a space would not be a problem. Therefore, I think we should enforce that names set in an extension do not have spaces so that it does not create a problem for MATLAB (we could swap in underscores to solve this problem if we want to, but underscores are already used for traversing the relative path within a neurodata object). Setting flexible names to strings with spaces does not present a problem in either PyNWB or MatNWB, but I do think it’s a bit odd to have different requirements depending on if the name is set in the schema vs. not, so I would say it should be best practice to not set flexible names to a string that contains a space.

This would not break read for any created files, even if they do contain spaces. PyNWB and MatNWB will continue to read them fine (though MatNWB will have a problem if the name was declared in an extension, as it always has). This would be a constraint on the API for creating new extensions

bendichter avatar Jan 05 '22 00:01 bendichter