@@ -30,7 +30,7 @@ def test_pruneOutsideBox():
30
30
(l ,) = ax .plot (x , y )
31
31
ax .set_ylim ([20 , 80 ])
32
32
ax .set_xlim ([20 , 80 ])
33
- cleanfigure .pruneOutsideBox (fig , ax , l )
33
+ cleanfigure ._pruneOutsideBox (fig , ax , l )
34
34
assert l .get_xdata ().shape == (14 ,)
35
35
36
36
@@ -58,7 +58,7 @@ def test_replaceDataWithNaN():
58
58
fig , ax = plt .subplots (1 , 1 , figsize = (5 , 5 ))
59
59
l , = ax .plot (xData , yData )
60
60
61
- cleanfigure .replaceDataWithNaN (l , id_replace )
61
+ cleanfigure ._replaceDataWithNan (l , id_replace )
62
62
63
63
newdata = np .stack (l .get_data (), axis = 1 )
64
64
assert newdata .shape == data .shape
@@ -89,7 +89,7 @@ def test_removeData():
89
89
fig , ax = plt .subplots (1 , 1 , figsize = (5 , 5 ))
90
90
l , = ax .plot (xData , yData )
91
91
92
- cleanfigure .removeData (l , id_remove )
92
+ cleanfigure ._removeData (l , id_remove )
93
93
newdata = np .stack (l .get_data (), axis = 1 )
94
94
assert newdata .shape == (14 , 2 )
95
95
@@ -118,9 +118,9 @@ def test_removeNaNs():
118
118
with plt .rc_context (rc = RC_PARAMS ):
119
119
fig , ax = plt .subplots (1 , 1 , figsize = (5 , 5 ))
120
120
l , = ax .plot (xData , yData )
121
- cleanfigure .replaceDataWithNaN (l , id_replace )
122
- cleanfigure .removeData (l , id_remove )
123
- cleanfigure .removeNaNs (l )
121
+ cleanfigure ._replaceDataWithNan (l , id_replace )
122
+ cleanfigure ._removeData (l , id_remove )
123
+ cleanfigure ._removeNaNs (l )
124
124
newdata = np .stack (l .get_data (), axis = 1 )
125
125
assert not np .any (np .isnan (newdata ))
126
126
assert newdata .shape == (12 , 2 )
@@ -147,7 +147,7 @@ def test_isInBox():
147
147
tol = 1.0e-10
148
148
relaxedXLim = xLim + np .array ([- tol , tol ])
149
149
relaxedYLim = yLim + np .array ([- tol , tol ])
150
- mask = cleanfigure .isInBox (data , relaxedXLim , relaxedYLim )
150
+ mask = cleanfigure ._isInBox (data , relaxedXLim , relaxedYLim )
151
151
assert int (np .sum (mask )) == 12
152
152
153
153
@@ -177,7 +177,7 @@ def test_getVisualLimits():
177
177
(l ,) = ax .plot (x , y )
178
178
ax .set_xlim ([20 , 80 ])
179
179
ax .set_ylim ([20 , 80 ])
180
- xLim , yLim = cleanfigure .getVisualLimits (fig , ax )
180
+ xLim , yLim = cleanfigure ._getVisualLimits (fig , ax )
181
181
assert np .allclose (xLim , np .array ([20 , 80 ]))
182
182
assert np .allclose (yLim , np .array ([20 , 80 ]))
183
183
@@ -208,8 +208,8 @@ def test_movePointsCloser():
208
208
(l ,) = ax .plot (x , y )
209
209
ax .set_ylim ([20 , 80 ])
210
210
ax .set_xlim ([20 , 80 ])
211
- cleanfigure .pruneOutsideBox (fig , ax , l )
212
- cleanfigure .movePointscloser (fig , ax , l )
211
+ cleanfigure ._pruneOutsideBox (fig , ax , l )
212
+ cleanfigure ._movePointscloser (fig , ax , l )
213
213
assert l .get_xdata ().shape == (14 ,)
214
214
215
215
@@ -239,9 +239,9 @@ def test_simplifyLine():
239
239
(l ,) = ax .plot (x , y )
240
240
ax .set_ylim ([20 , 80 ])
241
241
ax .set_xlim ([20 , 80 ])
242
- cleanfigure .pruneOutsideBox (fig , ax , l )
243
- cleanfigure .movePointscloser (fig , ax , l )
244
- cleanfigure .simplifyLine (fig , ax , l , 600 )
242
+ cleanfigure ._pruneOutsideBox (fig , ax , l )
243
+ cleanfigure ._movePointscloser (fig , ax , l )
244
+ cleanfigure ._simplifyLine (fig , ax , l , 600 )
245
245
assert l .get_xdata ().shape == (2 ,)
246
246
assert l .get_ydata ().shape == (2 ,)
247
247
@@ -272,10 +272,10 @@ def test_limitPrecision():
272
272
(l ,) = ax .plot (x , y )
273
273
ax .set_ylim ([20 , 80 ])
274
274
ax .set_xlim ([20 , 80 ])
275
- cleanfigure .pruneOutsideBox (fig , ax , l )
276
- cleanfigure .movePointscloser (fig , ax , l )
277
- cleanfigure .simplifyLine (fig , ax , l , 600 )
278
- cleanfigure .limitPrecision (fig , ax , l , 1 )
275
+ cleanfigure ._pruneOutsideBox (fig , ax , l )
276
+ cleanfigure ._movePointscloser (fig , ax , l )
277
+ cleanfigure ._simplifyLine (fig , ax , l , 600 )
278
+ cleanfigure ._limitPrecision (fig , ax , l , 1 )
279
279
assert l .get_xdata ().shape == (2 ,)
280
280
assert l .get_ydata ().shape == (2 ,)
281
281
@@ -317,7 +317,7 @@ def test_opheimSimplify():
317
317
)
318
318
y = x .copy ()
319
319
tol = 0.02
320
- mask = cleanfigure .opheimSimplify (x , y , tol )
320
+ mask = cleanfigure ._opheimSimplify (x , y , tol )
321
321
assert mask .shape == (12 ,)
322
322
assert np .allclose (mask * 1 , np .array ([1 ,] + [0 ,] * 10 + [1 ,]))
323
323
@@ -335,7 +335,7 @@ def test_is_step(function, result):
335
335
(l ,) = ax .plot (x , y )
336
336
elif function == "step" :
337
337
(l ,) = ax .step (x , y )
338
- assert cleanfigure .isStep (l ) == result
338
+ assert cleanfigure ._isStep (l ) == result
339
339
340
340
341
341
class Test_plottypes :
@@ -849,7 +849,7 @@ def test_segmentVisible():
849
849
dataIsInBox = np .array ([0 ,] * 4 + [1 ,] * 12 + [0 ,] * 4 ) == 1
850
850
xLim = np .array ([20 , 80 ])
851
851
yLim = np .array ([20 , 80 ])
852
- mask = cleanfigure .segmentVisible (data , dataIsInBox , xLim , yLim )
852
+ mask = cleanfigure ._segmentVisible (data , dataIsInBox , xLim , yLim )
853
853
assert np .allclose (mask * 1 , np .array ([0 ,] * 3 + [1 ,] * 13 + [0 ,] * 3 ))
854
854
855
855
@@ -863,7 +863,7 @@ def test_crossLines():
863
863
X2 = data [1 :, :]
864
864
X3 = np .array ([80 , 20 ])
865
865
X4 = np .array ([80 , 80 ])
866
- Lambda = cleanfigure .crossLines (X1 , X2 , X3 , X4 )
866
+ Lambda = cleanfigure ._crossLines (X1 , X2 , X3 , X4 )
867
867
868
868
expected_result = np .array (
869
869
[
@@ -901,7 +901,7 @@ def test_segmentsIntersect():
901
901
X2 = data [1 :, :]
902
902
X3 = np .array ([80 , 20 ])
903
903
X4 = np .array ([80 , 80 ])
904
- mask = cleanfigure .segmentsIntersect (X1 , X2 , X3 , X4 )
904
+ mask = cleanfigure ._segmentsIntersect (X1 , X2 , X3 , X4 )
905
905
assert np .allclose (mask * 1 , np .zeros_like (mask ))
906
906
907
907
@@ -925,14 +925,14 @@ def test_pixelate():
925
925
]
926
926
)
927
927
yData = xData .copy ()
928
- mask = cleanfigure .pixelate (xData , yData , xToPix , yToPix )
928
+ mask = cleanfigure ._pixelate (xData , yData , xToPix , yToPix )
929
929
assert mask .shape == (12 ,)
930
930
assert np .all (mask )
931
931
932
932
933
933
def test_corners3D ():
934
934
xlim = ylim = zlim = np .array ([- 5 , 5 ])
935
- corners = cleanfigure .corners3D (xlim , ylim , zlim )
935
+ corners = cleanfigure ._corners3D (xlim , ylim , zlim )
936
936
937
937
assert corners .shape == (8 , 3 )
938
938
assert np .sum (corners ) == 0
0 commit comments