def test_initialize_with_pulses(self): pulse = DCPulse(name='dc', amplitude=1.5, duration=10, t_start=0) pulse2 = DCPulse(name='dc', amplitude=1.5, duration=10) pulse_sequence = PulseSequence(pulses=[pulse, pulse2]) self.assertEqual(len(pulse_sequence), 2) self.assertEqual(pulse_sequence.pulses[0], pulse) self.assertNotEqual(pulse_sequence.pulses[1], pulse2) #t_start differs pulse2.t_start = 10 self.assertEqual(pulse_sequence.pulses[1], pulse2)
def test_add_multiple_pulses(self): pulse = DCPulse(name='dc', amplitude=1.5, duration=10, t_start=0) pulse2 = DCPulse(name='dc', amplitude=1.5, duration=10, t_start=10) pulse_sequence = PulseSequence() pulse_sequence.add(pulse, pulse2) self.assertEqual(len(pulse_sequence), 2) self.assertEqual(pulse_sequence.pulses[0], pulse) self.assertEqual(pulse_sequence.pulses[1], pulse2) pulse3 = DCPulse(name='dc', amplitude=1.5, duration=10) pulse3_added, = pulse_sequence.add(pulse3) # This one shouldn't be equal since t_stop was not set self.assertNotEqual(pulse_sequence.pulses[2], pulse3) pulse3.t_start = pulse3_added.t_start self.assertEqual(pulse_sequence.pulses[2], pulse3)
def test_no_logging(self): pulse = DCPulse(t_start=1, amplitude=42) pulse.t_start = 2 self.assertEqual(len(self.log_list), 0)