def test_sampler_name(self): """Test that sampler setting of pulse name works.""" m = 0.1 b = 0.1 duration = 2 left_linear_pulse_fun = samplers.left(linear) pulse = left_linear_pulse_fun(duration, m=m, b=b, name="test") self.assertIsInstance(pulse, library.Waveform) self.assertEqual(pulse.name, "test")
def test_default_arg_sampler(self): """Test that default arguments work with sampler.""" m = 0.1 duration = 2 left_linear_pulse_fun = samplers.left(linear) reference = np.array([0.1, 0.2], dtype=complex) pulse = left_linear_pulse_fun(duration, m=m) self.assertIsInstance(pulse, library.Waveform) np.testing.assert_array_almost_equal(pulse.samples, reference)
def test_left_sampler(self): """Test left sampler.""" m = 0.1 b = 0.1 duration = 2 left_linear_pulse_fun = samplers.left(linear) reference = np.array([0.1, 0.2], dtype=complex) pulse = left_linear_pulse_fun(duration, m=m, b=b) self.assertIsInstance(pulse, library.Waveform) np.testing.assert_array_almost_equal(pulse.samples, reference)