Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Recommend SI units formatting to adhere to CMIXF-12 #411

Merged
merged 22 commits into from
Jun 22, 2020

Conversation

sappelhoff
Copy link
Member

@sappelhoff sappelhoff commented Feb 10, 2020

replaces #151 as proposed by @satra , please see discussion therein!

Here is a summary:

  • In BIDS we accept SI units only (...and in very special circumstances, custom units - but they'd need to be documented in JSON files)
  • Currently, we have nowhere in the spec clarified how the FORMATTING of the SI units should be done (although some users and developers have assumed that the units appendix shows the required formatting)
  • Thus in practice, users have applied either ASCII formatting (e.g., "u" instead of "µ") or unicode formatting (µ) ... with the problem being that some unicodes look the same, while being different (e.g., µ and μ ... micro vs. mu)

This PR is intended to explicitly state how we want the FORMATTING of SI units to be. Namely, we prefer ASCII formatting according to MIXF (metric interchange format), see --> http://people.csail.mit.edu/jaffer/MIXF/CMIXF-12.

For backward compatibility, we will allow unicode characters, but further clarify the exact unicode we expect (e.g, U+00B5 for the micro sign µ).

Please see the proposed changes in this PR and approve or discuss!

more recent summary: #411 (comment)

To do

Copy link
Collaborator

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table looks good. I have some suggested alternative wording for the new text. Hopefully this is more unambiguous about what is permitted and what is required.

I dropped the bit about multiple unicode code points. If you feel it's worth working back in, that's fine.

src/99-appendices/05-units.md Outdated Show resolved Hide resolved
@sappelhoff
Copy link
Member Author

Thanks @effigies, I think your wording was more unambiguous and I added it.

I think we could still clarify a bit more with the units, before we try to get this PR in.

1. For encoding a unit, can a user pick any combination of:

  • prefix and unit, e.g. microV, microvolt
  • symbol and unit, e.g. uV, µV, uvolt, µvolt
  • factor and unit, e.g. 1e-6V, 1e-6volt (probably not)

... or do we require e.g. SYMBOL and UNIT

2. (implied in 1.) Can a user write out the complete unit? E.g., volt OR V are both permissible?

3. Regarding lower and upper case, I assume that we go with how it's handled in CMIXF-12, yet it may be good to make this more obvious with an additional sentence.

@sappelhoff
Copy link
Member Author

sappelhoff commented Feb 24, 2020

let me just make a proposal that's easier to criticize than my 3 questions above.

Let's add this sentence right before the table:

Units MUST consist of the `unit symbol` with an optionally accompanying
`prefix symbol` (see table below). Appropriate upper- or lower- casing MUST
be applied as declared by CMIXF-12.

Examples:
1. `uV` or `µV` are permissible, but NOT: `microV`, `µvolt`, `1e-6V`, etc.

feel free to add an example. Or adjust this text to be more clear.

@satra
Copy link
Collaborator

satra commented Feb 24, 2020

should we clarify that combinations of units are allowed if required. For example slew rate (T/m/s).

@effigies
Copy link
Collaborator

@sappelhoff I agree in principle with what you are proposing, but we should also note that CMIXF-12 does have conventions for derived units, including parentheses, exponents, multiplication and division.

@sappelhoff
Copy link
Member Author

reminder: this PR will also need to be coordinated with #391

@sappelhoff
Copy link
Member Author

This is a biggish change, I'd like to get some more feedback on this @yarikoptic @robertoostenveld @nicholst @oesteban

@sappelhoff
Copy link
Member Author

sappelhoff commented Apr 21, 2020

I think this issue deserves more attention, so let me write a summary for everbody to catch up and offer their opinion.

Selective tag list (please tag more people that I forgot):

@yarikoptic @robertoostenveld @nicholst @oesteban @franklin-feingold @emdupre @Remi-Gau @satra @VisLab @dorahermes @effigies

This issue is about how to format units in BIDS.

Brief history

The problem

I think it's great that the validator now checks units ... but this also put the finger on the wound in our spec: Namely, that the way units are currently defined in BIDS is unclear with regards to formatting.

We clearly state that we RECOMMEND SI units but we are unclear as to how we want these units to be formatted.

Some users have taken a look at our units appendix and deduced that they can make use of any combination of:

  • unit name
  • unit symbol
  • prefix name
  • prefix symbol

For example: µV, µVolt, microVolt, microV as formattings of "micro volts"

and this is also exactly what the validator currently checks.

Yet nowhere in the spec to we REQUIRE this behavior. So other users have (arguably reasonably) formatted their SI units in some other ways. E.g., uV to reflect "micro volts".

Current situation and where to go from here

This brings us to the current situation: The specification is unclear with how to format units, but the validator is strict in what it accepts as a valid unit.

This PR is intended to clarify how we want to have units formatted in BIDS. If you care about this problem, please offer your opinion ... and if you know somebody who might care, please refer them to this place :-) 🚀

@sappelhoff sappelhoff added this to the 1.3.1 milestone Apr 21, 2020
@nicholst
Copy link
Collaborator

I like the clarity of MIXF but I can understand that doesn't totally specify things.

This seems like an area where others have put some thought, though... I don't have time to digest, but it seems the following will be helpful...

The last one, an IEEE/ANSI standard, even has a section titled "Application of SI prefixes".

I'm hoping we can simply direct readers to one of these standards to say "do it that way, but render it as per MIXF".

@alexrockhill

This comment has been minimized.

@satra
Copy link
Collaborator

satra commented Apr 23, 2020

but I can understand that doesn't totally specify things

@nicholst - can you unpack this a bit more? there is an entire yacc parser for cmixf-12 at the end of the document, so technically it does provide a complete representation of formatting as well.

also i know there are some additional issues in BIDS w.r.t units that we have to tackle such as the fact that certain things (age, height, weight) represented as SI are likely to impose significant constraints on certain groups in certain countries. (perhaps this should be a separate issue, but likely to come up in all contexts).

@nicholst
Copy link
Collaborator

Hi @satra,

I should have rephrased my comment as "I interpret @sappelhoff's message to mean that MIXF doesn't totally specify things" :)

@sappelhoff: Maybe you can clarify what's missing from MIXF?

@sappelhoff
Copy link
Member Author

Maybe you can clarify what's missing from MIXF?

I don't think that there is something missing from MIXF. And I do think that it may be a nice way forward to require MIXF formatting of SI units.

Yet, I see several issues that need to be discussed with more people than the usual suspects, because we have a high chance of breaking existing tools and datasets:

  • Previously users have formatted SI units however they wanted, and nobody (including the validator) complained
  • Now, the validator checks BIDS datasets according to rules that are not clearly specified in our specification (see my summary post)
  • Thus, users may now start to adopt the "validator" rules, which are not clearly defined BIDS specification rules (because we are unclear in the spec)
  • Hence we should clarify BIDS specification rules, and make the validator enforce these rules ... to avoid a second "breakage"

I agree with @nicholst that it would be nice to simply refer to another standard: "Please use units according to this" ... and even better if there is an existing validator for that standard that we can simply tie into our bids-validator


@satra yes I think that it'd be helpful to split off the discussion about age, and I am interested to hear more about why you think weight and height could be problematic to be represented in SI.

@sappelhoff
Copy link
Member Author

I went through the PR once more and changed the REQUIRED keywords back to RECOMMENDED.

Now the PR achieves the following:

  1. RECOMMEND CMIXF-12 units
  2. provide examples of CMIXF-12 and say why we want it
  3. align present spec examples to our new recommendation
  4. more consistently link to the units section instead of specifying how to define units in different places
  5. Clarify that some unicodes (5, to be exact) are backward compatible

From what I see, we are not breaking any previous versions of BIDS. Only making some recommendations where previously we were unclear.

This PR is now ready to be merged from my side. Please review and approve ... or tell me that I overlooked something. And thanks for your patience 👍

Copy link
Collaborator

@nicholst nicholst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sappelhoff sappelhoff requested a review from effigies June 15, 2020 14:10
Copy link
Collaborator

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most suggestions are to use [<section name>](...) rather than [<section name> section](...), which I think is more consistent with how we link elsewhere in the document. We may be somewhat inconsistent, as well, so feel free to reject if you think this damages readability.

Note that there are a number of links ending parentheticals, so the parentheticals aren't getting closed.

A couple other comments, but otherwise this LGTM.

src/02-common-principles.md Outdated Show resolved Hide resolved
src/99-appendices/05-units.md Outdated Show resolved Hide resolved
src/02-common-principles.md Outdated Show resolved Hide resolved
src/02-common-principles.md Outdated Show resolved Hide resolved
src/03-modality-agnostic-files.md Outdated Show resolved Hide resolved
src/99-appendices/05-units.md Outdated Show resolved Hide resolved
@effigies
Copy link
Collaborator

Sorry, yes. The "Review" button did not show that I had these in queue, I guess because they were outdated. I'll delete them.

@sappelhoff sappelhoff changed the title [FIX] Clarify SI units formatting to be according to CMIXF-12 [FIX] Recommend SI units formatting to adhere to CMIXF-12 Jun 17, 2020
@sappelhoff
Copy link
Member Author

I will merge this PR early next week, so everybody has some more time to complain or approve ... a bit like they say at some weddings:

Speak now or forever hold your peace

@sappelhoff
Copy link
Member Author

Thanks a lot to everybody who helped along the way. Especially to @satra who brought this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion ongoing discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.