@@ -98,23 +98,7 @@ def _clip_non_positives(a):
98
98
return a
99
99
100
100
101
- class LogScale (ScaleBase ):
102
- """
103
- A standard logarithmic scale. Care is taken so non-positive
104
- values are not plotted.
105
-
106
- For computational efficiency (to push as much as possible to Numpy
107
- C code in the common cases), this scale provides different
108
- transforms depending on the base of the logarithm:
109
-
110
- - base 10 (:class:`Log10Transform`)
111
- - base 2 (:class:`Log2Transform`)
112
- - base e (:class:`NaturalLogTransform`)
113
- - arbitrary base (:class:`LogTransform`)
114
- """
115
-
116
- name = 'log'
117
-
101
+ if True :
118
102
class LogTransformBase (Transform ):
119
103
input_dims = 1
120
104
output_dims = 1
@@ -138,7 +122,7 @@ def transform_non_affine(self, a):
138
122
return np .log10 (a )
139
123
140
124
def inverted (self ):
141
- return LogScale . InvertedLog10Transform ()
125
+ return InvertedLog10Transform ()
142
126
143
127
class InvertedLog10Transform (Transform ):
144
128
input_dims = 1
@@ -151,7 +135,7 @@ def transform_non_affine(self, a):
151
135
return ma .power (10.0 , a ) / 10.0
152
136
153
137
def inverted (self ):
154
- return LogScale . Log10Transform ()
138
+ return Log10Transform ()
155
139
156
140
class Log2Transform (LogTransformBase ):
157
141
base = 2.0
@@ -163,7 +147,7 @@ def transform_non_affine(self, a):
163
147
return np .log2 (a )
164
148
165
149
def inverted (self ):
166
- return LogScale . InvertedLog2Transform ()
150
+ return InvertedLog2Transform ()
167
151
168
152
class InvertedLog2Transform (Transform ):
169
153
input_dims = 1
@@ -176,7 +160,7 @@ def transform_non_affine(self, a):
176
160
return ma .power (2.0 , a ) / 2.0
177
161
178
162
def inverted (self ):
179
- return LogScale . Log2Transform ()
163
+ return Log2Transform ()
180
164
181
165
class NaturalLogTransform (LogTransformBase ):
182
166
base = np .e
@@ -188,7 +172,7 @@ def transform_non_affine(self, a):
188
172
return np .log (a )
189
173
190
174
def inverted (self ):
191
- return LogScale . InvertedNaturalLogTransform ()
175
+ return InvertedNaturalLogTransform ()
192
176
193
177
class InvertedNaturalLogTransform (Transform ):
194
178
input_dims = 1
@@ -201,7 +185,7 @@ def transform_non_affine(self, a):
201
185
return ma .power (np .e , a ) / np .e
202
186
203
187
def inverted (self ):
204
- return LogScale . NaturalLogTransform ()
188
+ return NaturalLogTransform ()
205
189
206
190
class LogTransform (Transform ):
207
191
input_dims = 1
@@ -224,7 +208,7 @@ def transform_non_affine(self, a):
224
208
return np .log (a ) / np .log (self .base )
225
209
226
210
def inverted (self ):
227
- return LogScale . InvertedLogTransform (self .base )
211
+ return InvertedLogTransform (self .base )
228
212
229
213
class InvertedLogTransform (Transform ):
230
214
input_dims = 1
@@ -240,7 +224,35 @@ def transform_non_affine(self, a):
240
224
return ma .power (self .base , a ) / self .base
241
225
242
226
def inverted (self ):
243
- return LogScale .LogTransform (self .base )
227
+ return LogTransform (self .base )
228
+
229
+
230
+ class LogScale (ScaleBase ):
231
+ """
232
+ A standard logarithmic scale. Care is taken so non-positive
233
+ values are not plotted.
234
+
235
+ For computational efficiency (to push as much as possible to Numpy
236
+ C code in the common cases), this scale provides different
237
+ transforms depending on the base of the logarithm:
238
+
239
+ - base 10 (:class:`Log10Transform`)
240
+ - base 2 (:class:`Log2Transform`)
241
+ - base e (:class:`NaturalLogTransform`)
242
+ - arbitrary base (:class:`LogTransform`)
243
+ """
244
+ name = 'log'
245
+
246
+ # compatibility shim
247
+ LogTransformBase = LogTransformBase
248
+ Log10Transform = Log10Transform
249
+ InvertedLog10Transform = InvertedLog10Transform
250
+ Log2Transform = Log2Transform
251
+ InvertedLog2Transform = InvertedLog2Transform
252
+ NaturalLogTransform = NaturalLogTransform
253
+ InvertedNaturalLogTransform = InvertedNaturalLogTransform
254
+ LogTransform = LogTransform
255
+ InvertedLogTransform = InvertedLogTransform
244
256
245
257
def __init__ (self , axis , ** kwargs ):
246
258
"""
@@ -308,18 +320,7 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
308
320
vmax <= 0.0 and minpos or vmax )
309
321
310
322
311
- class SymmetricalLogScale (ScaleBase ):
312
- """
313
- The symmetrical logarithmic scale is logarithmic in both the
314
- positive and negative directions from the origin.
315
-
316
- Since the values close to zero tend toward infinity, there is a
317
- need to have a range around zero that is linear. The parameter
318
- *linthresh* allows the user to specify the size of this range
319
- (-*linthresh*, *linthresh*).
320
- """
321
- name = 'symlog'
322
-
323
+ if True :
323
324
class SymmetricalLogTransform (Transform ):
324
325
input_dims = 1
325
326
output_dims = 1
@@ -349,8 +350,8 @@ def transform_non_affine(self, a):
349
350
return log
350
351
351
352
def inverted (self ):
352
- return SymmetricalLogScale . InvertedSymmetricalLogTransform (
353
- self . base , self . linthresh , self .linscale )
353
+ return InvertedSymmetricalLogTransform (self . base , self . linthresh ,
354
+ self .linscale )
354
355
355
356
class InvertedSymmetricalLogTransform (Transform ):
356
357
input_dims = 1
@@ -360,9 +361,7 @@ class InvertedSymmetricalLogTransform(Transform):
360
361
361
362
def __init__ (self , base , linthresh , linscale ):
362
363
Transform .__init__ (self )
363
- symlog = SymmetricalLogScale .SymmetricalLogTransform (base ,
364
- linthresh ,
365
- linscale )
364
+ symlog = SymmetricalLogTransform (base , linthresh , linscale )
366
365
self .base = base
367
366
self .linthresh = linthresh
368
367
self .invlinthresh = symlog .transform (linthresh )
@@ -382,8 +381,23 @@ def transform_non_affine(self, a):
382
381
return exp
383
382
384
383
def inverted (self ):
385
- return SymmetricalLogScale .SymmetricalLogTransform (
386
- self .base , self .linthresh , self .linscale )
384
+ return SymmetricalLogTransform (self .base ,
385
+ self .linthresh , self .linscale )
386
+
387
+ class SymmetricalLogScale (ScaleBase ):
388
+ """
389
+ The symmetrical logarithmic scale is logarithmic in both the
390
+ positive and negative directions from the origin.
391
+
392
+ Since the values close to zero tend toward infinity, there is a
393
+ need to have a range around zero that is linear. The parameter
394
+ *linthresh* allows the user to specify the size of this range
395
+ (-*linthresh*, *linthresh*).
396
+ """
397
+ name = 'symlog'
398
+ # compatibility shim
399
+ SymmetricalLogTransform = SymmetricalLogTransform
400
+ InvertedSymmetricalLogTransform = InvertedSymmetricalLogTransform
387
401
388
402
def __init__ (self , axis , ** kwargs ):
389
403
"""
0 commit comments