Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@OverLordGoldDragon
Copy link
Contributor

  • annots[idx]["onset"] is inclusive on time starts, so to include all of idx, add duration and decrement a sample
  • int is redundant

 - `annots[idx]["onset"]` is inclusive on time *starts*, so to include all of `idx`, add duration and decrement a sample
 - `int` is redundant
@agramfort
Copy link
Collaborator

that gives you now samples of 3000 values for 30s at 100Hz and before it was 3001?

@OverLordGoldDragon
Copy link
Contributor Author

I don't follow, can you clarify?

@OverLordGoldDragon
Copy link
Contributor Author

I don't understand assert duration_h < 7 and duration_h > 6 in test_sleep_physionet.py, where did these values come from? I checked and everything seems sensible, with duration_h being 7.008330555555555.

@agramfort
Copy link
Collaborator

agramfort commented May 17, 2024 via email

@OverLordGoldDragon
Copy link
Contributor Author

annots[idx]["onset"] is inclusive on time starts, so to include all of idx, add duration and decrement a sample

Put differently, the intent is to include the entire segment annots[idx], but that's not what happens, only the very first sample is being included. I.e. currently, if x = data[start:end], it's

start = onset
end = onset + 1

whereas it should be

start = onset
end = onset + duration

@OverLordGoldDragon
Copy link
Contributor Author

Also, the existing code fails the new assertion I added (it's off by one sample, as expected), mine doesn't. The assertion's motivated by https://sci-hub.st/10.1109/TNSRE.2018.2813138 ,

a human sleep expert looks at the different time series recorded over the night and assigns to each 30 s time segment
a sleep stage following a reference nomenclature such as ...

a_tmax = annots[sleep_event_inds[-1]]
tmin = a_tmin["onset"] - crop_wake_mins * 60
tmax = a_tmax["onset"] + a_tmax["duration"] - dT + crop_wake_mins * 60
raw.crop(tmin=max(tmin, raw.times[0]), tmax=min(tmax, raw.times[-1]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe you just want to keep old version but set include_tmax=False in raw.crop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That only resolves - dT.

Copy link
Collaborator

Choose a reason for hiding this comment

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

can you already fix accordingly? also can you see why CIs fail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants