當前位置: 首頁>>代碼示例>>Python>>正文


Python TablePulseTemplate.get_entries_instantiated方法代碼示例

本文整理匯總了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})
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:11,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:16,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:16,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:18,代碼來源:table_pulse_template_tests.py

示例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())
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:21,代碼來源:table_pulse_template_tests.py

示例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({}))
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:5,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:8,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:7,代碼來源:table_pulse_template_tests.py

示例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)
開發者ID:carriercomm,項目名稱:qc-toolkit,代碼行數:7,代碼來源:table_pulse_template_tests.py


注:本文中的qctoolkit.pulses.table_pulse_template.TablePulseTemplate.get_entries_instantiated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。