Skip to content

MAINT: Refactor digitation for KIT, artemis123, bti#6368

Merged
massich merged 22 commits intomne-tools:masterfrom
massich:refactor_digitation
May 29, 2019
Merged

MAINT: Refactor digitation for KIT, artemis123, bti#6368
massich merged 22 commits intomne-tools:masterfrom
massich:refactor_digitation

Conversation

@massich
Copy link
Copy Markdown
Contributor

@massich massich commented May 23, 2019

This PR:

Joan Massich and others added 19 commits May 22, 2019 16:28
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
@agramfort
Copy link
Copy Markdown
Member

looking good so far 👍

massich pushed a commit to massich/mne-python that referenced this pull request May 23, 2019
@codecov
Copy link
Copy Markdown

codecov bot commented May 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@b9b2c68). Click here to learn what that means.
The diff coverage is 93.25%.

@@            Coverage Diff            @@
##             master    #6368   +/-   ##
=========================================
  Coverage          ?   89.32%           
=========================================
  Files             ?      408           
  Lines             ?    74300           
  Branches          ?    12292           
=========================================
  Hits              ?    66371           
  Misses            ?     5072           
  Partials          ?     2857

@larsoner
Copy link
Copy Markdown
Member

Let me know when CIs are green and I should look

@massich
Copy link
Copy Markdown
Contributor Author

massich commented May 23, 2019

@larsoner I'm AFK but Travis is green

@massich
Copy link
Copy Markdown
Contributor Author

massich commented May 23, 2019

But coverage went off. I'll check

@massich
Copy link
Copy Markdown
Contributor Author

massich commented May 23, 2019

Oh yes, I did not update the doc so it searches mne.io.DigPoint rather than mne.digitization.DigPoint

@massich
Copy link
Copy Markdown
Contributor Author

massich commented May 27, 2019

Can I get feedback for this PR?

cc: @mne-tools/contributors

Copy link
Copy Markdown
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

just a few nitpicks. nice work @massich



def _read_dig_points(fname, comments='%', unit='auto'):
"""Read digitizer data from a text file.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

apparently you can read more than from a .txt file


Returns
-------
dig : Digitization
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

list ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe you can already put a doc template for a parameter of type dig?


Parameters
----------
mrk : None | str | array_like, shape = (5, 3)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you remove the = after shape in this docstring?


Returns
-------
dig_points : list
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use a standard docstring

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

what is not standard? in this return?

dig_points : list
List of digitizer points for info['dig'].
dev_head_t : dict
A dictionary describe the device-head transformation.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we have a template docstring for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No I'll make a PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll push them in #6385

mrk = read_mrk(mrk)

# hsp = apply_trans(als_ras_trans, hsp)
# elp = apply_trans(als_ras_trans, elp)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cleanup?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it was there before? is this expected?

# From bti
def _make_bti_dig_points(nasion, lpa, rpa, hpi, extra,
convert=False, use_hpi=False,
bti_dev_t=False, dev_ctf_t=False):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

docstring?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think is necessary this function should die in the next PR.

ident : int
Identifier.
r : ndarray, shape (3,)
Position.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

position in meters?

@massich
Copy link
Copy Markdown
Contributor Author

massich commented May 27, 2019

I did not touch the docstrings much. (Just a find and replace of dig: list of dicts to Digitization and did not revert). I'll push a pass.

@agramfort
Copy link
Copy Markdown
Member

ok to merge then when you're happy and CIs are green. I agree to do one thing at a time

@larsoner
Copy link
Copy Markdown
Member

I probably can't really look until Friday so don't wait for me.

Copy link
Copy Markdown
Contributor

@GuillaumeFavelier GuillaumeFavelier left a comment

Choose a reason for hiding this comment

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

I have only small suggestions, thank you for your work @massich

from ..transforms import Transform
from ..transforms import combine_transforms
from ..transforms import invert_transform
from ..transforms import _to_const
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You prefer one import at a time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't have a strict policy that I'm aware of, and its easier like this when I'm moving code around. I'll do a clean up on the last PR.

elp = elp[3:]

dig_points = _make_dig_points(nasion, lpa, rpa, elp, hsp)
dev_head_t = Transform('meg', 'head', trans)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be consistent with previous call:
dev_head_t = Transform(fro='meg', to='head', trans=trans)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed. I'll at them on the next PR.

'meg', 'ctf_head')
dev_head_t = combine_transforms(t, ctf_head_t, 'meg', 'head')
else:
dev_head_t = Transform('meg', 'head', trans=None)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dev_head_t = Transform(fro='meg', to='head', trans=None)

@massich massich changed the title Refactor digitation for KIT, artemis123, bti MAINT: Refactor digitation for KIT, artemis123, bti May 29, 2019
@massich massich merged commit 087a88e into mne-tools:master May 29, 2019
massich added a commit that referenced this pull request May 29, 2019
Co-authored-by: Teon Brooks <teon.brooks@gmail.com>
@massich massich deleted the refactor_digitation branch May 29, 2019 13:24
@massich massich mentioned this pull request Jun 17, 2019
19 tasks
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.

4 participants