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

DW initial revisions #3

Conversation

dominikwelke
Copy link

@dominikwelke dominikwelke commented Feb 21, 2024

hi @CarinaFo

here my initial revisions that make it work (i think).
main changes:

  • the nanmean function had to be swapped somewhere else,
  • applying your method is now only allowed if data are preloaded (which makes things easier and i think is valid).
  • i added an initial test

it's just quick and dirty fixes.. e.g., the test could be much better.
also not sure if we should really change mean to nanmean in the global util function, or whether it makes more sense to allow nanmean as an additional separate option and call it based on a (to be implemented) flag, that epochs were rejected (_check_combine is only used in epochs.py and tfr.py, probably for a similar case, but who knows..).

@@ -1209,7 +1212,7 @@ def _compute_aggregate(self, picks, mode="mean"):
n_events += 1

if n_events > 0:
data = np.nanmean(data)
data /= n_events
Copy link
Owner

Choose a reason for hiding this comment

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

I am still a bit confused about this part of the function, to be honest, maybe a comment would be good at that point

Copy link
Author

Choose a reason for hiding this comment

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

this whole stuff only happens in the case of not-preloaded data, and thats why i guess it has to be somehow hacky and hard to follow ;)
in this case there is no numpy array of data in memory that we can simply access and change (probably only a view or so..)
so they create this mock data object, fill it up by some loop through the epochs object and then average that.

but that's also why it's not really relevant for us - i doubt that we could even set not-preloaded data to nan easily without larger changes (i assume this info would have to be stored in some meta data and then applied when finally loading at some later point?), so it doenst make sense to implement an averaging function for this case.

Copy link
Author

Choose a reason for hiding this comment

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

not super sure about the second part of my reply, maybe it is easier than i think. still, if we ask data to be preloaded, it doesnt apply

Copy link
Owner

Choose a reason for hiding this comment

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

okey, thank you for the explanation, now I finally understand what is going on.

Copy link
Owner

@CarinaFo CarinaFo 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 I would add a comment to the compute_aggregate function, it's rather confusing what is actually happening there. The test looks good, but again a few comments would be nice and help the reviewer :)

@CarinaFo CarinaFo closed this Feb 24, 2024
@CarinaFo CarinaFo reopened this Feb 26, 2024
@CarinaFo CarinaFo merged commit caac9f4 into CarinaFo:channel_specific_epoch_rejection Feb 26, 2024
11 of 20 checks passed
@dominikwelke
Copy link
Author

I think I would add a comment to the compute_aggregate function, it's rather confusing what is actually happening there. The test looks good, but again a few comments would be nice and help the reviewer :)

it's a private function, so this is why there isnt any. but i agree that a few hints would help ppl like us :)

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.

2 participants