def test_eval_issue_on_stop(): """Test handling a too large value for stop. """ shape = SlopeShape(mode='Start/Stop', def1='1.0', def2='{a}') root_vars = {'a': 1.5} missing = set() errors = {} assert not shape.eval_entries({}, root_vars, missing, errors) assert missing == set() assert '0_shape_stop' in errors
def test_eval_issue_on_slope_stop(): """Test handling an issue on slope in Slope/Stop mode. """ shape = SlopeShape(mode='Slope/Stop', def1='{a}', def2='0.5', index=1) root_vars = {'a': -0.5, '1_duration': 2} missing = set() errors = {} assert not shape.eval_entries({}, root_vars, missing, errors) assert missing == set() assert '1_shape_slope' in errors
def test_eval_start_slope(): """Test evaluating the slope shape in start/slope mode. """ shape = SlopeShape(mode='Start/Slope', def1='{a}', def2='-0.5', index=1) root_vars = {'a': 0, '1_duration': 1} missing = set() errors = {} assert shape.eval_entries({}, root_vars, missing, errors) assert missing == set() assert errors == {} assert_array_equal(shape.compute(np.ones(11), 'mus'), np.linspace(0.0, -0.5, 11))
def test_eval_start_stop(): """Test evaluating the slope shape in start/stop mode. """ shape = SlopeShape(mode='Start/Stop', def1='0.5', def2='{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.linspace(0, 1, 11), 'mus'), np.linspace(0.5, -1.0, 11))
def test_eval_slope_stop(): """Test evaluating the entries of an active modulation when some vars are missing. Issue on amplitude. """ """Test evaluating the slope shape in start/slope mode. """ shape = SlopeShape(mode='Slope/Stop', def1='{a}', def2='-1', index=1) root_vars = {'a': -0.5, '1_duration': 1} missing = set() errors = {} assert shape.eval_entries({}, root_vars, missing, errors) assert missing == set() assert errors == {} assert_array_equal(shape.compute(np.ones(11), 'mus'), np.linspace(-0.5, -1.0, 11))