Beispiel #1
0
def test_eval_amplitude2():
    """Test evaluating the entries of a shape when some vars are missing.

    """
    shape = SquareShape(amplitude='1*{b}')
    root_vars = {'a': 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set('b')
Beispiel #2
0
def test_eval_amplitude3():
    """Test evaluating the entries of a shape when some entries are incorrect.

    """
    shape = SquareShape(amplitude='1*{a}+-')
    root_vars = {'a': 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert '0_shape_amplitude' in errors
Beispiel #3
0
def test_eval_amplitude_too_large():
    """Test handling a too large amplitude.

    """
    shape = SquareShape(amplitude='2*{a}')
    root_vars = {'a': 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert '0_shape_amplitude' in errors
Beispiel #4
0
def test_eval_amplitude_too_large():
    """Test handling a too large amplitude.

    """
    shape = SquareShape(amplitude="2*{a}")
    root_vars = {"a": 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert "0_shape_amplitude" in errors
Beispiel #5
0
def test_eval_square_amplitude1():
    """Test evaluating the amplitude of a square shape.

    """
    shape = SquareShape(amplitude='1*{a}')
    root_vars = {'a': 1.0}
    missing = set()
    errors = {}

    assert shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert errors == {}
    assert_array_equal(shape.compute(np.ones(1), 'mus'), 1.0)
Beispiel #6
0
def test_eval_amplitude2():
    """Test evaluating the entries of an active modulation when some vars
    are missing.
    Issue on amplitude.

    """
    shape = SquareShape(amplitude="1*{b}")
    root_vars = {"a": 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set("b")
Beispiel #7
0
def test_eval_square_amplitude1():
    """Test evaluating the amplitude of a square shape.

    """
    shape = SquareShape(amplitude="1*{a}")
    root_vars = {"a": 1.0}
    missing = set()
    errors = {}

    assert shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert errors == {}
    assert_array_equal(shape.compute(np.ones(1), "mus"), 1.0)
Beispiel #8
0
def test_eval_amplitude3():
    """Test evaluating the entries of an active modulation when some entries
    are incorrect.
    Issue on frequency.

    """
    shape = SquareShape(amplitude="1*{a}+-")
    root_vars = {"a": 1.0}
    missing = set()
    errors = {}

    assert not shape.eval_entries({}, root_vars, missing, errors)
    assert missing == set()
    assert "0_shape_amplitude" in errors