def test_constant(self): """Test discrete sampled constant pulse.""" amp = 0.5j duration = 10 times = np.arange(0, duration) constant_ref = continuous.constant(times, amp=amp) constant_pulse = pulse_lib.constant(duration, amp=amp) self.assertIsInstance(constant_pulse, SamplePulse) np.testing.assert_array_almost_equal(constant_pulse.samples, constant_ref)
def test_constant(self): """Test constant pulse.""" amp = 0.5j samples = 50 times = np.linspace(0, 10, samples) constant_arr = continuous.constant(times, amp=amp) self.assertEqual(constant_arr.dtype, np.complex_) np.testing.assert_equal(constant_arr, amp) self.assertEqual(len(constant_arr), samples)