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
[MRG] ENH: add average_dipoles function to Dipole #156
[MRG] ENH: add average_dipoles function to Dipole #156
Conversation
6aea515
to
dfb315a
Compare
what do you think of adding an attribute |
dfb315a
to
68343f4
Compare
Codecov Report
@@ Coverage Diff @@
## master #156 +/- ##
==========================================
- Coverage 70.31% 70.04% -0.27%
==========================================
Files 19 19
Lines 1984 1993 +9
==========================================
+ Hits 1395 1396 +1
- Misses 589 597 +8
Continue to review full report at Codecov.
|
hnn_core/dipole.py
Outdated
@@ -69,6 +69,40 @@ def read_dipole(fname, units='nAm'): | |||
return dpl | |||
|
|||
|
|||
def average_dipoles(dpls): | |||
"""Compute dipole averages over a list of Dipole objects. 'L2', 'L5' and 'agg' | |||
components are averaged separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, should be single line
hnn_core/dipole.py
Outdated
average over the same components in the input list | ||
""" | ||
# need at least one Dipole to get times | ||
if (len(dpls) < 2): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, paranthesis not needed.
Otherwise looks good. Let me know what you think of the |
Does it get incremented by |
If you averaged 5 dipoles, I would set |
Prevents accidentally reaveraging trials with an inconsistent basis
I think it's a good addition. Although I didn't add it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for merge from my end
don't know if @rythorpe wants to look, otherwise I can merge once CIs come green
@@ -47,6 +47,8 @@ API | |||
|
|||
- Make a context manager for parallel backends (JoblibBackend, MPIBackend), by `Blake Caldwell`_ in `#79 <https://github.com/jonescompneurolab/hnn-core/pull/79>`_ | |||
|
|||
- Add average_dipoles function to `hnn_core.dipole`, by `Blake Caldwell`_ in `#156 <https://github.com/jonescompneurolab/hnn-core/pull/156>`_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make the function clickable here by doing :func:hnn_core.average_dipoles
.
Looks good to me. Thanks @blakecaldwell! |
I'm going to merge this. The |
Split from #83 for a fast merge