()
| 77 | |
| 78 | |
| 79 | def 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') |
nothing calls this directly
no test coverage detected
searching dependent graphs…