def test_eval_modulation1(self): # Test evaluating the entries of an inactive modulation. modulation = Modulation() root_vars = {'a': 1.0} missing = set() errors = {} assert_true(modulation.eval_entries(root_vars, missing, errors, 0)) assert_equal(missing, set()) assert_equal(errors, {}) assert_array_equal(modulation.compute(np.zeros(1), 'mus'), 1.0)
def test_eval_modulation6(self): # Test evaluating the entries of an active modulation when some entries # are incorrect. # Issue on phase. modulation = Modulation(activated=True) modulation.frequency = '1.0' modulation.phase = '0.0*' root_vars = {} missing = set() errors = {} assert_false(modulation.eval_entries(root_vars, missing, errors, 0)) assert_equal(missing, set()) assert_in('0_mod_phase', errors)
def test_eval_modulation3(self): # Test evaluating the entries of an active modulation when some vars # are missing. # Issue on frequency. modulation = Modulation(activated=True) modulation.frequency = '1.0*{a}' modulation.phase = '0.0' root_vars = {} missing = set() errors = {} assert_false(modulation.eval_entries(root_vars, missing, errors, 0)) assert_equal(missing, set('a')) assert_in('0_mod_frequency', errors)
def test_eval_modulation2(self): # Test evaluating the entries of an active modulation. modulation = Modulation(activated=True) modulation.frequency = '1.0*{a}' modulation.phase = '0.0' root_vars = {'a': 1.0} missing = set() errors = {} assert_true(modulation.eval_entries(root_vars, missing, errors, 0)) assert_equal(missing, set()) assert_equal(errors, {}) assert_array_equal(modulation.compute(np.array([0, 0.25]), 'mus'), np.array([0, 1]))