def test_samples_to_seconds(self): """Test samples to time""" config = self.backend.configuration() config.dt = 0.1 with pulse.build(self.backend): time = pulse.samples_to_seconds(100) self.assertTrue(isinstance(time, float)) self.assertEqual(pulse.samples_to_seconds(100), 10)
def test_samples_to_seconds_array(self): """Test samples to time (array format).""" config = self.backend.configuration() config.dt = 0.1 with pulse.build(self.backend): samples = np.array([100, 200, 300]) times = pulse.samples_to_seconds(samples) self.assertTrue(np.issubdtype(times.dtype, np.floating)) np.testing.assert_allclose(times, np.array([10, 20, 30]))