11import math
2-
2+ import numpy as np
33
44import matplotlib .units as units
55import matplotlib .ticker as ticker
6- import matplotlib .numerix as nx
76from matplotlib .axes import Axes
87from matplotlib .cbook import iterable
98
@@ -122,7 +121,7 @@ def __init__(self, value, unit):
122121 self .proxy_target = self .value
123122
124123 def get_compressed_copy (self , mask ):
125- compressed_value = nx .ma .masked_array (self .value , mask = mask ).compressed ()
124+ compressed_value = np .ma .masked_array (self .value , mask = mask ).compressed ()
126125 return TaggedValue (compressed_value , self .unit )
127126
128127 def __getattribute__ (self , name ):
@@ -135,9 +134,9 @@ def __getattribute__(self, name):
135134
136135 def __array__ (self , t = None , context = None ):
137136 if t is not None :
138- return nx .asarray (self .value ).astype (t )
137+ return np .asarray (self .value ).astype (t )
139138 else :
140- return nx .asarray (self .value , 'O' )
139+ return np .asarray (self .value , 'O' )
141140
142141 def __array_wrap__ (self , array , context ):
143142 return TaggedValue (array , self .unit )
@@ -159,7 +158,7 @@ def next(self):
159158 return IteratorProxy (iter (self .value ), self .unit )
160159
161160 def get_compressed_copy (self , mask ):
162- new_value = nx .ma .masked_array (self .value , mask = mask ).compressed ()
161+ new_value = np .ma .masked_array (self .value , mask = mask ).compressed ()
163162 return TaggedValue (new_value , self .unit )
164163
165164 def convert_to (self , unit ):
@@ -211,7 +210,7 @@ def __array_wrap__(self, array, context):
211210 return TaggedValue (array , self )
212211
213212 def __array__ (self , t = None , context = None ):
214- ret = nx .array ([1 ])
213+ ret = np .array ([1 ])
215214 if t is not None :
216215 return ret .astype (t )
217216 else :
@@ -275,8 +274,8 @@ def __call__(self, operation, units):
275274
276275radians = BasicUnit ('rad' , 'radians' )
277276degrees = BasicUnit ('deg' , 'degrees' )
278- radians .add_conversion_factor (degrees , 180.0 / nx .pi )
279- degrees .add_conversion_factor (radians , nx .pi / 180.0 )
277+ radians .add_conversion_factor (degrees , 180.0 / np .pi )
278+ degrees .add_conversion_factor (radians , np .pi / 180.0 )
280279
281280secs = BasicUnit ('s' , 'seconds' )
282281hertz = BasicUnit ('Hz' , 'Hertz' )
@@ -287,7 +286,7 @@ def __call__(self, operation, units):
287286
288287# radians formatting
289288def rad_fn (x ,pos = None ):
290- n = int ((x / nx .pi ) * 2.0 + 0.25 )
289+ n = int ((x / np .pi ) * 2.0 + 0.25 )
291290 if n == 0 :
292291 return '0'
293292 elif n == 1 :
@@ -307,7 +306,7 @@ def axisinfo(unit):
307306
308307 if unit == radians :
309308 return units .AxisInfo (
310- majloc = ticker .MultipleLocator (base = nx .pi / 2 ),
309+ majloc = ticker .MultipleLocator (base = np .pi / 2 ),
311310 majfmt = ticker .FuncFormatter (rad_fn ),
312311 label = unit .fullname ,
313312 )
0 commit comments