Skip to content

Units examples broken #4802

Closed
Closed

Description

@dopplershift

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?

Activity

  1. dopplershift commented on Jul 27, 2015

    @dopplershift
    ContributorAuthor

    This is on OSX with Python 3.4 and Numpy 1.9.2

  2. jenshnielsen commented on Jul 27, 2015

    @jenshnielsen
    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

  3. added this to the milestone on Jul 27, 2015
  4. jenshnielsen commented on Nov 11, 2015

    @jenshnielsen
    Member

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

  5. dopplershift commented on Aug 16, 2017

    @dopplershift
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions