本文整理汇总了Python中qctoolkit.pulses.table_pulse_template.TablePulseTemplate.get_entries_instantiated方法的典型用法代码示例。如果您正苦于以下问题:Python TablePulseTemplate.get_entries_instantiated方法的具体用法?Python TablePulseTemplate.get_entries_instantiated怎么用?Python TablePulseTemplate.get_entries_instantiated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qctoolkit.pulses.table_pulse_template.TablePulseTemplate
的用法示例。
在下文中一共展示了TablePulseTemplate.get_entries_instantiated方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_entries_instantiated_unlinked_time_declarations
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_unlinked_time_declarations(self) -> None:
table = TablePulseTemplate()
foo_decl = ParameterDeclaration('foo', min=1, max=2)
bar_decl = ParameterDeclaration('bar', min=1.5, max=4)
table.add_entry(foo_decl, 'v', 'linear')
table.add_entry(bar_decl, 0, 'jump')
instantiated_entries = table.get_entries_instantiated({'v': 2.3, 'foo': 1, 'bar': 4})
self.assertEqual([(0, 0, HoldInterpolationStrategy()), (1, 2.3, LinearInterpolationStrategy()), (4, 0, JumpInterpolationStrategy())], instantiated_entries)
self.assertRaises(Exception, table.get_entries_instantiated, {'v': 2.3, 'foo': 2, 'bar': 1.5})
示例2: test_get_entries_instantiated_removal_for_three_subsequent_equal_entries
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_removal_for_three_subsequent_equal_entries(self) -> None:
table = TablePulseTemplate()
table.add_entry(1, 5)
table.add_entry(1.5, 5)
table.add_entry(2, 5)
table.add_entry(3, 0)
entries = table.get_entries_instantiated({})
expected = [
TableEntry(0, 0, HoldInterpolationStrategy()),
TableEntry(1, 5, HoldInterpolationStrategy()),
TableEntry(2, 5, HoldInterpolationStrategy()),
TableEntry(3, 0, HoldInterpolationStrategy())
]
self.assertEqual(expected, entries)
示例3: test_get_entries_instantiated_two_equal_entries
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_two_equal_entries(self) -> None:
table = TablePulseTemplate()
table.add_entry(0, 0)
table.add_entry(1, 5)
table.add_entry(3, 5)
table.add_entry(5, 1)
entries = table.get_entries_instantiated({})
expected = [
TableEntry(0, 0, HoldInterpolationStrategy()),
TableEntry(1, 5, HoldInterpolationStrategy()),
TableEntry(3, 5, HoldInterpolationStrategy()),
TableEntry(5, 1, HoldInterpolationStrategy())
]
self.assertEqual(expected, entries)
示例4: test_build_sequence
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_build_sequence(self) -> None:
table = TablePulseTemplate()
foo_decl = ParameterDeclaration('foo', min=1)
bar_decl = ParameterDeclaration('bar')
table.add_entry(foo_decl, 'v', 'linear')
table.add_entry(bar_decl, 0, 'jump')
parameters = {'v': 2.3, 'foo': 1, 'bar': 4}
instantiated_entries = tuple(table.get_entries_instantiated(parameters))
sequencer = DummySequencer()
instruction_block = DummyInstructionBlock()
table.build_sequence(sequencer, parameters, {}, instruction_block)
waveform = TableWaveform(instantiated_entries)
self.assertEqual(1, len(instruction_block.instructions))
instruction = instruction_block.instructions[0]
self.assertIsInstance(instruction, EXECInstruction)
self.assertEqual(waveform, instruction.waveform)
示例5: TablePulseTemplate
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_removal_for_three_subsequent_equal_entries_does_not_destroy_linear_interpolation(self) -> None:
table = TablePulseTemplate()
table.add_entry(0, 5)
table.add_entry(2, 5, 'linear')
table.add_entry(5, 5)
table.add_entry(10, 0, 'linear')
entries = table.get_entries_instantiated({})
expected = [
TableEntry(0, 5, HoldInterpolationStrategy()),
TableEntry(5, 5, HoldInterpolationStrategy()),
TableEntry(10, 0, LinearInterpolationStrategy())
]
self.assertEqual(expected, entries)
result_sampled = TableWaveform(entries).sample(numpy.linspace(0, 10, 11), 0)
self.assertEqual([5, 5, 5, 5, 5, 5, 4, 3, 2, 1, 0], result_sampled.tolist())
示例6: test_get_entries_instantiated_empty
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_empty(self) -> None:
table = TablePulseTemplate()
self.assertFalse(table.get_entries_instantiated({}))
示例7: test_get_entries_instantiated_two_entries_float_declaraton_declaration_declaration
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_two_entries_float_declaraton_declaration_declaration(self) -> None:
table = TablePulseTemplate()
table.add_entry(0, 'v1')
table.add_entry('t', 'v2')
instantiated_entries = table.get_entries_instantiated({'v1': -5, 'v2': 5, 't': 3})
self.assertEqual([(0, -5, HoldInterpolationStrategy()), (3, 5, HoldInterpolationStrategy())], instantiated_entries)
示例8: test_get_entries_instantiated_two_entries_float_float_declaration_float
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_two_entries_float_float_declaration_float(self) -> None:
table = TablePulseTemplate()
table.add_entry('foo', -3.1415)
instantiated_entries = table.get_entries_instantiated({'foo': 2})
self.assertEqual([(0, 0, HoldInterpolationStrategy()), (2, -3.1415, HoldInterpolationStrategy())], instantiated_entries)
示例9: test_get_entries_instantiated_one_entry_float_declaration
# 需要导入模块: from qctoolkit.pulses.table_pulse_template import TablePulseTemplate [as 别名]
# 或者: from qctoolkit.pulses.table_pulse_template.TablePulseTemplate import get_entries_instantiated [as 别名]
def test_get_entries_instantiated_one_entry_float_declaration(self) -> None:
table = TablePulseTemplate()
table.add_entry(0, 'foo')
instantiated_entries = table.get_entries_instantiated({'foo': 2})
self.assertEqual([(0, 2, HoldInterpolationStrategy())], instantiated_entries)