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

Units examples broken #4802

Closed
dopplershift opened this issue Jul 27, 2015 · 4 comments
Closed

Units examples broken #4802

dopplershift opened this issue Jul 27, 2015 · 4 comments

Comments

@dopplershift
Copy link
Contributor

So far when running examples out of the units/ subdirectories, I see:

radian_demo.py:

Traceback (most recent call last):
  File "radian_demo.py", line 10, in <module>
    x = [val*radians for val in np.arange(0, 15, 0.01)]
  File "radian_demo.py", line 10, in <listcomp>
    x = [val*radians for val in np.arange(0, 15, 0.01)]
TypeError: __array_wrap__() missing 1 required positional argument: 'context'

artist_tests.py:

Traceback (most recent call last):
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 126, in __new__
    return object.__new__(subcls, value, unit)
TypeError: object.__new__(TaggedValue_of_int) is not safe, use int.__new__()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "artist_tests.py", line 34, in <module>
    line = lines.Line2D([0*cm, 1.5*cm], [0*cm, 2.5*cm], lw=2, color='black', axes=ax)
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 224, in __rmul__
    return self*lhs
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 221, in __mul__
    return TaggedValue(value, unit)
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 130, in __new__
    return object.__new__(cls, value, unit)
TypeError: object() takes no parameters

units_scatter.py:

Traceback (most recent call last):
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 126, in __new__
    return object.__new__(subcls, value, unit)
TypeError: object.__new__(TaggedValue_of_MaskedArray) is not safe, use numpy.ndarray.__new__()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "units_scatter.py", line 18, in <module>
    xsecs = secs*np.ma.MaskedArray((1, 2, 3, 4, 5, 6, 7, 8), (1, 0, 1, 0, 0, 0, 1, 0), np.float)
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 221, in __mul__
    return TaggedValue(value, unit)
  File "/Users/rmay/repos/matplotlib/examples/units/basic_units.py", line 130, in __new__
    return object.__new__(cls, value, unit)
TypeError: object() takes no parameters

Anyone have any clues?

@dopplershift
Copy link
Contributor Author

This is on OSX with Python 3.4 and Numpy 1.9.2

@jenshnielsen
Copy link
Member

They have not been ported to python 3. I have an old stalled pr to fix that in #3838 However I don't think that is the right solution and haven't had the chance to more about it

@tacaswell tacaswell added this to the proposed next point release milestone Jul 27, 2015
@jenshnielsen
Copy link
Member

This is mostly fixed by the merge of #3838 however we should probably rework how the meta classes are done

@dopplershift
Copy link
Contributor Author

The examples all work on Python 3.6 with Numpy 1.13 on master. I'm closing this since the original problem is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants