Example #1
0
def test_linear_inv():
    xs = np.arange(-10, 11)
    ys = np.array([
        -43,
        -39,
        -35,
        -31,
        -27,
        -23,
        -19,
        -15,
        -11,
        -7,
        -3,
        1,
        5,
        9,
        13,
        17,
        21,
        25,
        29,
        33,
        37,
    ])
    coeffs = dict()
    coeffs["a"] = 4
    coeffs["b"] = -3
    rf = functions.Linear(coeffs)
    assert np.array_equal(rf.physical_to_int(ys), xs)
Example #2
0
def test_linear_inv_scalar():
    x = -10
    y = -43
    coeffs = Value()
    coeffs.a = 4
    coeffs.b = -3
    rf = functions.Linear(coeffs)
    assert rf.inv(y) == x
Example #3
0
def test_linear_inv_scalar():
    x = -10
    y = -43
    coeffs = dict()
    coeffs["a"] = 4
    coeffs["b"] = -3
    rf = functions.Linear(coeffs)
    assert rf.physical_to_int(y) == x
Example #4
0
def test_linear_scalar():
    x = -10
    y = -43
    coeffs = dict()
    coeffs["a"] = 4
    coeffs["b"] = -3
    rf = functions.Linear(coeffs)
    assert rf.int_to_physical(x) == y
Example #5
0
def test_linear_inv():
    xs = np.arange(-10, 11)
    ys = np.array([-43, -39, -35, -31, -27, -23, -19, -15, -11, -7, -3, 1, 5, 9, 13, 17, 21, 25, 29, 33, 37
    ])
    coeffs = Value()
    coeffs.a = 4
    coeffs.b = -3
    rf = functions.Linear(coeffs)
    assert np.array_equal(rf.inv(ys), xs)