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

Skip to content

Fixed critical typo in mlab.cohere #10004

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

Merged
merged 1 commit into from
Dec 14, 2017

Conversation

duncanmmacleod
Copy link
Contributor

@duncanmmacleod duncanmmacleod commented Dec 14, 2017

PR Summary

This commit fixes #10003 with a single-character change.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak
Copy link
Member

jklymak commented Dec 14, 2017

This is at least a relatively new typo: #7547

@jklymak
Copy link
Member

jklymak commented Dec 14, 2017

BTW, this is pretty bad, so any back porting that is possible would be great.

@jklymak jklymak added this to the v2.2 milestone Dec 14, 2017
@jklymak jklymak added status: confirmed bug status: needs review Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels Dec 14, 2017
@jklymak
Copy link
Member

jklymak commented Dec 14, 2017

While we don't like mlab if we are going to keep offering it, we should probably have a test to check that it gives sensible results. @duncanmmacleod if you wanted to add a test to this PR, that'd be great (something like compute the coherence and then assert that its equal to a hard-coded coherence values). If you aren't up to it, I can easily do a second test PR.

@tacaswell tacaswell modified the milestones: v2.2, v2.1.2 Dec 14, 2017
@duncanmmacleod
Copy link
Contributor Author

@jklymak, I would be happy to add simple tests, at least cohere(x, x) gives an ones. But, when I try to execute the test suite from my git clone I get:

$ py.test-2.7
============================= test session starts ==============================
platform darwin -- Python 2.7.14, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /Users/duncan/git/matplotlib-cohere-typo, inifile: pytest.ini
plugins: xdist-1.20.0, forked-0.2, cov-2.5.1
collected 0 items / 1 errors

==================================== ERRORS ====================================
______________________________ ERROR collecting  _______________________________
...
lib/matplotlib/testing/conftest.py:12: in pytest_configure
    matplotlib._init_tests()
lib/matplotlib/__init__.py:1462: in _init_tests
    from matplotlib import ft2font
E   ImportError: cannot import name ft2font

Is there something special I need to do to get the tests going (macOS 10.13.2, macports pytest).

@jklymak
Copy link
Member

jklymak commented Dec 14, 2017

OK, you may not have a development environment set up? http://matplotlib.org/devel/contributing.html
If you did, you'd have freetype I think.

I do everything via conda.

If you want to post what you think is a working test, I could test for you.

My only problem w/ cohere(x,x) is I don't think it'd have caught this bug because Pxy = Pxx. OTOH hand I think cohere(x, x.roll(2)) or something else to introduce a phase shift should make Pxy neq Pxx. That won't come out to exactly one coherence for a short time series, however, so you'd need to get the values. If you want to use random numbers, note that we use a specific seed: np.random.seed(19680801).

http://matplotlib.org/devel/testing.html
http://matplotlib.org/devel/contributing.html

@duncanmmacleod
Copy link
Contributor Author

thanks @jklymak, the problem with the install was that I hadn't installed mpl in developer mode, the prompt to the instructions was what I needed.

However, I don't think I'm going to be much help any time soon on a unit test, since the setup for test_mlab.py is ... complicated. I could probably write a test without using any of the cls data, but it might not site well with the parametrize loop etc. I'm probably best placed to hand off to someone else for testing.

@jklymak
Copy link
Member

jklymak commented Dec 14, 2017

Suggest we merge, and then prevail upon @QuLogic to give us a hand writing a test.

ping @anntzer (ahem, #7547)

@anntzer
Copy link
Contributor

anntzer commented Dec 14, 2017

oops.

@anntzer anntzer merged commit 8f3f7ac into matplotlib:master Dec 14, 2017
dstansby added a commit that referenced this pull request Dec 15, 2017
@jklymak jklymak mentioned this pull request Dec 15, 2017
2 tasks
@duncanmmacleod duncanmmacleod deleted the cohere-typo branch January 3, 2018 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typo in mlab.cohere
5 participants