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] Clarify indices are nonnegative integers. #535

Merged
merged 8 commits into from
Aug 24, 2020

Conversation

nicholst
Copy link
Collaborator

@nicholst nicholst commented Jul 22, 2020

At present, zero is not excluded for run and echo indices. Is this accidental or intended?

If zero's are excluded, this PR will make this explicit.

If zeros are to be discouraged, then perhaps we should say so?

@nicholst
Copy link
Collaborator Author

Sorry! I jumped too quick! @effigies points out that natural numbers are not unambiguously defined.

I've updated this to replace natural number with positive integer. It's a small difference, but, again, it seems we should be explicit as to whether 0's are allowed or not, or if allowed if they're discouraged.

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

I think it'd be good to exclude 0 as an index value explicitly (From my feeling this is already implicit in the spec).

But an edit would probably best be made under point 9. here: https://github.com/bids-standard/bids-specification/blob/master/src/02-common-principles.md#definitions

and then we could reference to this definition from elsewhere in the spec.

@effigies
Copy link
Collaborator

effigies commented Jul 27, 2020

I feel this is an unnecessary change. The most common use case will be sequential indices, starting at 1, but it's not clear why we should rule out other patterns, such as 0-indexing. run-0 seems perfectly interpretable to me, and software would need to do more work to find run-1 but not run-0 than finding both.

My vote would be leaving it as it is. If the collective does decide to change it, though, I think we should change all indices everywhere, including in the definitions, as Stefan notes. And we'll need to figure out a good English version of /0*[1-9][0-9]*/ as opposed to "numeric" which translates to /[0-9]+/.

@nicholst
Copy link
Collaborator Author

nicholst commented Jul 27, 2020 via email

@effigies
Copy link
Collaborator

Yes. Numeric characters are just [0-9], so negative numbers aren't possible.

@nicholst
Copy link
Collaborator Author

nicholst commented Jul 27, 2020 via email

@sappelhoff
Copy link
Member

While I agree it’s elegant to allow zeros, if someone later is
writing code to aggregate 1000’s of BIDS datasets, wouldn’t it be a
headache if a random sprinkling started indexing from zero while other
started from 1?

I have no help on this (50% / 50% opinion currently), but this may be related to #499

@effigies
Copy link
Collaborator

It's not obvious to me that it would be a problem, as I wouldn't expect run indices to form a meaningful grouping across datasets, but I don't mind RECOMMENDing that indexed entities be sequential and start from 1.

@nicholst nicholst changed the title [FIX] Rule-out 0 as an index value? [FIX] Make 1-indexing RECOMMENDED Jul 29, 2020
@nicholst
Copy link
Collaborator Author

Good call @effigies ... and I've updated the title and content of this PR to simply add the text indexing starting from 1 RECOMMENDED in the definition of run and echo.

@nicholst
Copy link
Collaborator Author

Oh dear... I ran git rebase master on my branch, so that when I personally run git diff master I only see changes on the two lines I edited, but now it appears that this PR has both this tiny change and changes from #536 (replace non-breaking spaces).

If someone knows what I need to do to fix this please let me know... sorry!

@effigies effigies closed this Jul 29, 2020
@effigies effigies reopened this Jul 29, 2020
@effigies
Copy link
Collaborator

Looking at the history, you appear to have run git pull after rebasing, which is probably because you tried git push and it said you needed to pull first. I would suggest rebasing again (selecting 51bb58d, 7202175 and d678512), and then git push --force.

I tried closing and reopening to see if that would fix the history, but it did not. If you set the flag that maintainers can edit your PR, I may be able to push a fixed branch, if it doesn't work out for you.

@nicholst
Copy link
Collaborator Author

Thanks @effigies ! But I got as far as git rebase 51bb58d and was told I had a slew of conflicts... not sure what to do.

On my page "Allow edits and access to secrets by maintainers" is checked so you should be able to mess with it.

@effigies
Copy link
Collaborator

Force-pushed.

Just to document what I did, in case it's helpful:

git checkout NoZeroRun
git rebase -i upstream/master

Which opened up a VIM:

pick 51bb58d Rule-out 0 as an index value
pick 7202175 Replace 'natural number' with 'positive integers'
pick b16cd4b Rule-out 0 as an index value
pick b955b7b Replace 'natural number' with 'positive integers'
pick d678512 Make 1-indexing recommended

Removed the duplicates, saved and closed:

pick 51bb58d Rule-out 0 as an index value
pick 7202175 Replace 'natural number' with 'positive integers'
pick d678512 Make 1-indexing recommended

Which showed:

Successfully rebased and updated refs/heads/NoZeroRun.

Then:

git push -f

@nicholst
Copy link
Collaborator Author

nicholst commented Jul 29, 2020 via email

Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

Thanks, changes look good to me. I merely added some line breaks where I thought they'd make sense

(and with "sense" I mean --> wherever I thought they may improve a future git diff, if we ever touch these lines again)

@sappelhoff sappelhoff requested a review from emdupre August 2, 2020 09:51
@nicholst
Copy link
Collaborator Author

nicholst commented Aug 2, 2020 via email

@sappelhoff
Copy link
Member

*I had understood we do line breaks only at the end of sentences. *

Yes, sorry for the misunderstanding --> We are not very strict about it, my heuristics are:

  • don't make the lines too long
  • always start a new line after the end of a sentence
  • if there is a natural break point within a sentence, use that to put a line break there
  • don't forget the goal: good readability for humans with and without diff rendering

@emdupre
Copy link
Collaborator

emdupre commented Aug 2, 2020

Thanks for bringing this up, @nicholst ! I'm lightly against this change, but I want to preface by saying I could easily be convinced 😸 I'm just not sure that I see the need for this yet.

To give a bit of context, a while back we had suggested that echo indices be required to sequentially increase with increasing echo times, but this was recognized as backwards incompatible and delayed to BIDS 2.0. This is actually something that BEP001 just had to downgrade to a recommendation for exactly this reason.

In developing tools for multi-echo data, then, we hit a bit of a wall in that -- although existing publicly-available multi-echo data sets start at 1 and use increasing indices -- tool developers still can't be sure that a given dataset is indeed using increasing indices. So, the recommendation doesn't help us directly in practice.

All that to say, so long as it's clear that we can't assume that data sets will actually follow this recommendation, then it's fine with me. But I worry somewhat that if this is included in the spec, tools developers or users might assume that BIDS compliant data sets start at one (and then, effectively, that echo indices increase sequentially), when we can't guarantee that to be true.

@satra
Copy link
Collaborator

satra commented Aug 2, 2020

i think (but could be convinced otherwise as well) that i agree with @effigies and @emdupre that changing this to a recommendation is ok but does not offer any obvious advantage over leaving it as is.

let me offer an example where the indexing may be used as semantics. i have an fmri study where i randomize a set of stimulus patterns. nothing in bids, says at this point that my run indices have to be in order of acquisition.

so i could reorder every participant in a consistent pattern of runs to correspond to a fixed ordering of the paradigm files (*events.tsv). i can use inheritance to make this common across every participant. further, for some reason (e.g. lack of scanning time, bad acquisition, etc.,.) the task run-1 or run-N could be missing. i still satisfy all of bids requirements and have reduced the possibility that different events.tsv are erroneous to a limited error surface.

given that it's a recommendation, the proposed change won't prevent one from still doing this, but the proposed changed may suggest to folks that a pattern starting from 1 should be catered for. instead the more general and current specification simply says the index is an integer and allows for flexibility of use. and it's left up to a tool developer to sort it and extract metadata as necessary. and thus any tools catering to the present specification is likely to be more generally applicable to numeric indexing, whether numerically sequential or not.

@nicholst
Copy link
Collaborator Author

nicholst commented Aug 3, 2020 via email

@satra
Copy link
Collaborator

satra commented Aug 3, 2020

@nicholst - i was getting at the notion that any pattern is ok. so perhaps i should instead ask, what does starting with 1 help with?

@nicholst
Copy link
Collaborator Author

nicholst commented Aug 3, 2020

Sorry @emdupre, I skipped over your comment, and the full meaning of @satra's. If you think the recommendation will lull developers to expect only 1 (and, worse, only sequential ordering), I can see the harm of the recommendation.

Anyway, I was about to push a change to remove the RECOMMENDED text to discover that, here on this remote island, VPNs and ssh-ing is blocked! I'll update this when I have a chance but it might not be for another 2 weeks.

Happy to hear any other comments in the mean time.

@sappelhoff sappelhoff added the discussion ongoing discussion label Aug 10, 2020
@nicholst
Copy link
Collaborator Author

Have now pared down the PR to remove any recommendation of 0- or 1-indexing.

The change now amounts to nothing more than specifying that only nonnegative integers are permitted as run and echo labels, which is strictly redundant given that BIDS <label> is defined to be "an alphanumeric value" in Common principles, but I think it is a clarification worth adding.

Copy link
Collaborator

@emdupre emdupre left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thank you, @nicholst !

@effigies effigies changed the title [FIX] Make 1-indexing RECOMMENDED [FIX] Clarify indices are nonnegative integers. Aug 19, 2020
Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

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

Thanks @nicholst and reviewers!

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.

5 participants