1
1
import math
2
-
2
+ import numpy as np
3
3
4
4
import matplotlib .units as units
5
5
import matplotlib .ticker as ticker
6
- import matplotlib .numerix as nx
7
6
from matplotlib .axes import Axes
8
7
from matplotlib .cbook import iterable
9
8
@@ -122,7 +121,7 @@ def __init__(self, value, unit):
122
121
self .proxy_target = self .value
123
122
124
123
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 ()
126
125
return TaggedValue (compressed_value , self .unit )
127
126
128
127
def __getattribute__ (self , name ):
@@ -135,9 +134,9 @@ def __getattribute__(self, name):
135
134
136
135
def __array__ (self , t = None , context = None ):
137
136
if t is not None :
138
- return nx .asarray (self .value ).astype (t )
137
+ return np .asarray (self .value ).astype (t )
139
138
else :
140
- return nx .asarray (self .value , 'O' )
139
+ return np .asarray (self .value , 'O' )
141
140
142
141
def __array_wrap__ (self , array , context ):
143
142
return TaggedValue (array , self .unit )
@@ -159,7 +158,7 @@ def next(self):
159
158
return IteratorProxy (iter (self .value ), self .unit )
160
159
161
160
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 ()
163
162
return TaggedValue (new_value , self .unit )
164
163
165
164
def convert_to (self , unit ):
@@ -211,7 +210,7 @@ def __array_wrap__(self, array, context):
211
210
return TaggedValue (array , self )
212
211
213
212
def __array__ (self , t = None , context = None ):
214
- ret = nx .array ([1 ])
213
+ ret = np .array ([1 ])
215
214
if t is not None :
216
215
return ret .astype (t )
217
216
else :
@@ -275,8 +274,8 @@ def __call__(self, operation, units):
275
274
276
275
radians = BasicUnit ('rad' , 'radians' )
277
276
degrees = 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 )
280
279
281
280
secs = BasicUnit ('s' , 'seconds' )
282
281
hertz = BasicUnit ('Hz' , 'Hertz' )
@@ -287,7 +286,7 @@ def __call__(self, operation, units):
287
286
288
287
# radians formatting
289
288
def 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 )
291
290
if n == 0 :
292
291
return '0'
293
292
elif n == 1 :
@@ -307,7 +306,7 @@ def axisinfo(unit):
307
306
308
307
if unit == radians :
309
308
return units .AxisInfo (
310
- majloc = ticker .MultipleLocator (base = nx .pi / 2 ),
309
+ majloc = ticker .MultipleLocator (base = np .pi / 2 ),
311
310
majfmt = ticker .FuncFormatter (rad_fn ),
312
311
label = unit .fullname ,
313
312
)
0 commit comments