Skip to content

[WIP] refactor to prepare digitization#5986

Closed
massich wants to merge 15 commits intomne-tools:masterfrom
massich:refactor_digitation
Closed

[WIP] refactor to prepare digitization#5986
massich wants to merge 15 commits intomne-tools:masterfrom
massich:refactor_digitation

Conversation

@massich
Copy link
Copy Markdown
Contributor

@massich massich commented Feb 22, 2019

The idea of this PR was to move all the code that seems to be dealing with digitization in a single place before start changing code and factoring similar functions.

But I get in dependency hell.

Any help is wellcome. @agramfort @larsoner

@massich massich changed the title refactor to prepare digitization [WIP] refactor to prepare digitization Feb 22, 2019
@massich
Copy link
Copy Markdown
Contributor Author

massich commented Feb 22, 2019

Maybe I should propose a different refractor where io stays in io. And at some point we can get rid of having our structures inside io

@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 11 alerts when merging 32f17c8 into 3d12b2b - view on LGTM.com

new alerts:

  • 6 for Use of the return value of a procedure
  • 3 for Unused import
  • 1 for Wrong name for an argument in a call
  • 1 for Wrong number of arguments in a call

Comment posted by LGTM.com

@larsoner
Copy link
Copy Markdown
Member

That would probably be easier. Moving things out of io makes problems harder

@agramfort
Copy link
Copy Markdown
Member

I agree with @larsoner I would keep digitization.py in mne/io to avoid circular import mess

@massich massich force-pushed the refactor_digitation branch from 32f17c8 to 29c6c9f Compare March 4, 2019 10:03
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 4, 2019

Codecov Report

Merging #5986 into master will decrease coverage by 0.29%.
The diff coverage is 61.83%.

@@            Coverage Diff            @@
##           master    #5986     +/-   ##
=========================================
- Coverage   89.17%   88.87%   -0.3%     
=========================================
  Files         416      422      +6     
  Lines       74933    75149    +216     
  Branches    12352    12392     +40     
=========================================
- Hits        66823    66792     -31     
- Misses       5226     5462    +236     
- Partials     2884     2895     +11

@massich massich force-pushed the refactor_digitation branch from 29c6c9f to 6c4423e Compare March 4, 2019 10:20
@larsoner
Copy link
Copy Markdown
Member

larsoner commented Mar 4, 2019

This pull request introduces 4 alerts when merging 6c4423e into ce50c2b - view on LGTM.com

new alerts:

  • 4 for Unused import

Comment posted by LGTM.com

@massich massich force-pushed the refactor_digitation branch from 6c4423e to 5c64b68 Compare March 21, 2019 11:01
@massich massich force-pushed the refactor_digitation branch from d09c86b to b8218bb Compare April 15, 2019 14:10
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 1 alert when merging b8218bb into 4555011 - view on LGTM.com

new alerts:

  • 1 for Unused import

Comment posted by LGTM.com

@massich massich force-pushed the refactor_digitation branch from b8218bb to 50e46f0 Compare April 19, 2019 15:03
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 3 alerts when merging 50e46f0 into b3dfd7a - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unused import
  • 1 for Unreachable code

Comment posted by LGTM.com

@massich
Copy link
Copy Markdown
Contributor Author

massich commented Apr 19, 2019

At d1eaa8d, Digitization is a custom list of DigPoint all boilerplate.

@larsoner do you think that its worth to factor it out? I would like to be able to write something like (if I understand how Bunch works):

from ..utils import Bunch
from ..utils import MyListOfBunch

class DigPoint(Bunch):

    def __repr__(self):  # noqa: D105
        # maybe we need to write this one

    def __eq__(self, other):
        # this one should come for free


class Digitization(MyListOfBunch, Digpoint):
    """Represent a list of DigPoint objects.

    Parameters
    ----------
    elements : list
        A list of DigPoint objects.
    """
    pass # because everything comes for free

@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 3 alerts when merging 9fe020b into b3dfd7a - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unused import
  • 1 for Unreachable code

Comment posted by LGTM.com

@katarinaslama
Copy link
Copy Markdown
Contributor

The travis error seems to not be specific to this PR. (When I run make pep on the current mne dev branch, I get the same error.) Is there anything I could help with here?

@larsoner
Copy link
Copy Markdown
Member

I don't get errors with make pep on master. The tracebacks I see on travis have to do with mne/digitization which is new. @katarinaslama can you paste the master error here (or open a PR to fix it)?

It's possible one of the PEP checkers updated and got more strict

@katarinaslama
Copy link
Copy Markdown
Contributor

I don't get errors with make pep on master. The tracebacks I see on travis have to do with mne/digitization which is new. @katarinaslama can you paste the master error here (or open a PR to fix it)?

It's possible one of the PEP checkers updated and got more strict

It's also possible that I'm missing something. My read of the travis output suggests that lines 3386-3391 are the problem.

When I run make pep on master, I get the same output as line 3390:
make: *** [pep] Error 2

Am I misreading this? Thanks!

@larsoner
Copy link
Copy Markdown
Member

The failure it's much earlier in line 3324. make flake (which is called by make pep) fails on this PR, but it doesn't get reported until all pep targets are run, so you have to look father up to see it

@massich massich force-pushed the refactor_digitation branch from 9fe020b to ce3c3ef Compare April 23, 2019 10:26
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging ce3c3ef into 9cc5d14 - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging 890a232 into 92f61fa - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@massich massich force-pushed the refactor_digitation branch from 890a232 to ea07437 Compare April 24, 2019 12:13
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging ea07437 into 92f61fa - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@massich
Copy link
Copy Markdown
Contributor Author

massich commented Apr 24, 2019

  • Progress:

    • io/artemis123/artemis123.py
    • io/brainvision/brainvision.py
    • io/bti/bti.py
    • io/cnt/cnt.py
    • io/ctf/ctf.py
    • io/edf/edf.py
    • io/edf/edf.py (bdf)
    • io/edf/edf.py (gdf)
    • io/eeglab/eeglab.py
    • io/egi/egi.py
    • io/eximia/eximia.py
    • io/fieldtrip/fieldtrip.py
    • io/fiff/raw.py (fif)
    • io/kit/kit.py
    • io/nicolet/nicolet.py
  • Things that we found and we need to come back to (maybe new PRs):

    • General:

      • Epochs constructors have none homogeneous signature.
    • io/kit/kit.py:

      • Epochs and Raw init should be almost the same, and they are not.

@larsoner
Copy link
Copy Markdown
Member

Excellent, thanks for figuring this out

@massich massich force-pushed the refactor_digitation branch from ea07437 to b5c5504 Compare April 24, 2019 14:20
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging b5c5504 into 2dd7aa0 - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging 3fcf2b5 into c4a83c5 - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging 577900c into b9dcbe1 - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@massich massich force-pushed the refactor_digitation branch from 577900c to 3fcf2b5 Compare April 26, 2019 16:04
@larsoner
Copy link
Copy Markdown
Member

This pull request introduces 2 alerts when merging 3fcf2b5 into 03bc75e - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@massich massich force-pushed the refactor_digitation branch 3 times, most recently from be646e3 to 662dd13 Compare May 2, 2019 10:47
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented May 2, 2019

This pull request introduces 2 alerts when merging 662dd13 into 3cc76b9 - view on LGTM.com

new alerts:

  • 1 for Special method has incorrect signature
  • 1 for Unreachable code

Comment posted by LGTM.com

@codecov
Copy link
Copy Markdown

codecov bot commented May 2, 2019

Codecov Report

Merging #5986 into master will decrease coverage by 0.23%.
The diff coverage is 63.47%.

@@            Coverage Diff             @@
##           master    #5986      +/-   ##
==========================================
- Coverage   89.31%   89.07%   -0.24%     
==========================================
  Files         405      422      +17     
  Lines       74266    75143     +877     
  Branches    12297    12388      +91     
==========================================
+ Hits        66330    66933     +603     
- Misses       5072     5329     +257     
- Partials     2864     2881      +17

@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented May 2, 2019

This pull request introduces 2 alerts when merging e16c5af into 3cc76b9 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Unreachable code

Comment posted by LGTM.com

Joan Massich and others added 14 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>
@massich massich force-pushed the refactor_digitation branch from e16c5af to 51ea4dc Compare May 22, 2019 14:29
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented May 22, 2019

This pull request introduces 2 alerts when merging 51ea4dc into 5803738 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Unreachable code

Comment posted by LGTM.com

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