def test_crash(self) -> None: table = TablePulseTemplate({'default': [('ta', 'va', 'hold'), ('tb', 'vb', 'linear'), ('tend', 0, 'jump')]}, identifier='foo') expected_parameters = {'ta', 'tb', 'tc', 'td', 'va', 'vb', 'tend'} first_mapping = { 'ta': 'ta', 'tb': 'tb', 'va': 'va', 'vb': 'vb', 'tend': 'tend' } second_mapping = { 'ta': 'tc', 'tb': 'td', 'va': 'vb', 'vb': 'va + vb', 'tend': '2 * tend' } sequence = SequencePulseTemplate((table, first_mapping, {}), (table, second_mapping, {})) self.assertEqual(expected_parameters, sequence.parameter_names) parameters = { 'ta': ConstantParameter(2), 'va': ConstantParameter(2), 'tb': ConstantParameter(4), 'vb': ConstantParameter(3), 'tc': ConstantParameter(5), 'td': ConstantParameter(11), 'tend': ConstantParameter(6)} sequencer = DummySequencer() block = DummyInstructionBlock() self.assertFalse(sequence.requires_stop(parameters, {})) sequence.build_sequence(sequencer, parameters=parameters, conditions={}, measurement_mapping={}, channel_mapping={'default': 'default'}, instruction_block=block) from qupulse.pulses.sequencing import Sequencer s = Sequencer() s.push(sequence, parameters, channel_mapping={'default': 'EXAMPLE_A'})
def test_build_sequence(self) -> None: sub1 = DummyPulseTemplate(requires_stop=False) sub2 = DummyPulseTemplate(requires_stop=True, parameter_names={'foo'}) parameters = {'foo': DummyNoValueParameter()} sequencer = DummySequencer() block = DummyInstructionBlock() seq = SequencePulseTemplate(sub1, (sub2, {'foo': 'foo'}), measurements=[('a', 0, 1)]) seq.build_sequence(sequencer, parameters, conditions=dict(), channel_mapping={'default': 'a'}, measurement_mapping={'a': 'b'}, instruction_block=block) self.assertEqual(2, len(sequencer.sequencing_stacks[block])) self.assertEqual(block.instructions[0], MEASInstruction([('b', 0, 1)])) sequencer = DummySequencer() block = DummyInstructionBlock() seq = SequencePulseTemplate((sub2, {'foo': 'foo'}), sub1) seq.build_sequence(sequencer, parameters, {}, {}, {}, block) self.assertEqual(2, len(sequencer.sequencing_stacks[block]))