MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_symlog_mask_nan

Function test_symlog_mask_nan

lib/matplotlib/tests/test_scale.py:79–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78
79def test_symlog_mask_nan():
80 # Use a transform round-trip to verify that the forward and inverse
81 # transforms work, and that they respect nans and/or masking.
82 slt = SymmetricalLogTransform(10, 2, 1)
83 slti = slt.inverted()
84
85 x = np.arange(-1.5, 5, 0.5)
86 out = slti.transform_non_affine(slt.transform_non_affine(x))
87 assert_allclose(out, x)
88 assert type(out) is type(x)
89
90 x[4] = np.nan
91 out = slti.transform_non_affine(slt.transform_non_affine(x))
92 assert_allclose(out, x)
93 assert type(out) is type(x)
94
95 x = np.ma.array(x)
96 out = slti.transform_non_affine(slt.transform_non_affine(x))
97 assert_allclose(out, x)
98 assert type(out) is type(x)
99
100 x[3] = np.ma.masked
101 out = slti.transform_non_affine(slt.transform_non_affine(x))
102 assert_allclose(out, x)
103 assert type(out) is type(x)
104
105
106@image_comparison(['logit_scales.png'], remove_text=True, style='_classic_test')

Callers

nothing calls this directly

Calls 4

invertedMethod · 0.95
transform_non_affineMethod · 0.95
transform_non_affineMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…