def test_T(): f1 = sf_T(20.) f2 = tdist(20.) V = np.linspace(-2, 3, 201) V1 = [float(f1(v)) for v in V] V2 = f2.sf(V) np.testing.assert_allclose(V1, V2) V = np.linspace(-2, 3, 11) V1 = [float(f1(u, v)) for u, v in zip(V[:-1], V[1:])] V2 = [f2.sf(u) - f2.sf(v) for u, v in zip(V[:-1], V[1:])] np.testing.assert_allclose(V1, V2)
def test_T(): f1 = sf_T(20.) f2 = tdist(20.) V = np.linspace(-2,3,201) V1 = [float(f1(v)) for v in V] V2 = f2.sf(V) np.testing.assert_allclose(V1, V2) V = np.linspace(-2,3,11) V1 = [float(f1(u,v)) for u,v in zip(V[:-1],V[1:])] V2 = [f2.sf(u)-f2.sf(v) for u,v in zip(V[:-1],V[1:])] np.testing.assert_allclose(V1, V2)
def __init__(self, intervals, df): self._T = tdist(df) self._Tsf = sf_T(df) truncated.__init__(self, intervals)