pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

Convention to specify SIUnit

Open jcfr opened this issue 8 years ago • 8 comments

While going through the File tutorial, I noticed the SIunit placeholder was used few times.

Looking for examples, I read through the TimeSeries class definition and also the schema documentation

From the schema doc:

The data stored can be in any unit. The attributes of the data field must indicate the SI unit that the data relates to (or appropriate counterpart, such as color-space) and the multiplier necessary to convert stored values to the specified SI unit.

From the TimeSeries class definition:

https://github.com/NeurodataWithoutBorders/pynwb/blob/67a3bca2c37c42cb963b2ea1509952567bdf35cd/src/pynwb/base.py#L106-L108

That led me to think the unit must be specified in their plural form: Seconds instead of Second.

That said, looking at Wikipedia, the unit names are in their singular form:

  • second
  • metre
  • ...

What should be the recommended form ? Also should it be lower or upper cased ?

cc: @nicain

jcfr avatar Apr 04 '18 01:04 jcfr

How about we use the standard abbreviations for the units? Like s / V in their official casing?

t-b avatar Apr 04 '18 03:04 t-b

Personally I think "seconds" is more descriptive than "s", but that's just my personal feeling, but I'm fine with whatever makes most sense for neuroscientists. Once you decide, please add a short section to the format docs to describe it:

https://github.com/NeurodataWithoutBorders/nwb-schema/blob/dev/docs/format/source/format_description.rst

We should probably also have a dict somewhere in PyNWB where standard unit strings are stored so that users can a) look up the the correct strings there and b) we can do error checking on assignment.

oruebel avatar Apr 04 '18 16:04 oruebel

what about using something external that provides support for units already rather than writing it?

e.g. https://pypi.python.org/pypi/units/

mgrauer avatar Apr 04 '18 16:04 mgrauer

Thanks everyone for the feedback

Personally I think "seconds" is more descriptive than "s",

:+1:

I'm fine with whatever makes most sense for neuroscientists

:+1:

dict somewhere in PyNWB

That would work (or also something like pynwb.units.second, ... ), at first I think we need to agree on what should be the convention for units and then come up with a technical solution.

I wonder how unit are currently stored in files. @NeurodataWithoutBorders/hck04 ?

something external ... provides support for units

That would be an option, but the unit package referenced uses single letter unit which are not very expressive

https://bitbucket.org/adonohue/units/src/b187fbf3c1d403df9326670e7a00e2522fc74215/units/si.py?at=default&fileviewer=file-view-default#si.py-6:27

jcfr avatar Apr 04 '18 17:04 jcfr

Some other inconsistencies with units:

JFPerkins avatar Apr 04 '18 17:04 JFPerkins

I think single-letter units are fine as long as we have a standard set of units and their single-letter equivalents. For visualization, we are much more likely to want the single-letter versions. Ideally, the API can give us access to both versions. I'd like to be able to do something like:

>>> data.unit
<Unit 'Second'>
>>> str(data.unit)
's'

campagnola avatar Apr 04 '18 18:04 campagnola

A list of SI units can be found here.

t-b avatar Apr 06 '18 01:04 t-b

@rly I believe you had addresses this issue; can this be closed?

oruebel avatar Sep 10 '21 23:09 oruebel