iqm-pulse 12.7.3__py3-none-any.whl → 12.7.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
iqm/pulse/builder.py CHANGED
@@ -1455,7 +1455,7 @@ class ScheduleBuilder:
1455
1455
  if not schedule[ch]:
1456
1456
  schedule.append(ch, Block(T))
1457
1457
 
1458
- def build_playlist( # noqa: PLR0915
1458
+ def build_playlist( # noqa: PLR0915, PLR0912
1459
1459
  self, schedules: Sequence[Schedule], finish_schedules: bool = True
1460
1460
  ) -> tuple[Playlist, ReadoutMetrics]:
1461
1461
  """Build a playlist from a number of instruction schedules.
@@ -1595,26 +1595,56 @@ class ScheduleBuilder:
1595
1595
  continue
1596
1596
  pl.add_channel(channel)
1597
1597
  prev_wait = None
1598
+ prev_vz = None
1598
1599
  for instruction in segment:
1599
1600
  if isinstance(instruction, ReadoutTrigger):
1600
1601
  readout_metrics.extend(instruction, seg_idx)
1602
+
1603
+ if not finish_schedules:
1604
+ _append_to_schedule(sc_schedule, channel_name, instruction)
1605
+ continue
1606
+
1607
+ # convert 0-angle virtual rotation instructions to Wait
1608
+ is_wait = isinstance(instruction, (NONSOLID, Wait)) or (
1609
+ isinstance(instruction, VirtualRZ) and instruction.phase_increment == 0.0
1610
+ )
1611
+
1601
1612
  # convert all NONSOLID instructions into Waits
1602
- if finish_schedules and (isinstance(instruction, NONSOLID) or isinstance(instruction, Wait)):
1613
+ if is_wait:
1603
1614
  if instruction.duration > 0:
1604
1615
  if prev_wait: # if the previous instruction was a Wait, combine durations
1605
1616
  prev_wait = Wait(prev_wait.duration + instruction.duration)
1606
1617
  else:
1607
1618
  prev_wait = Wait(instruction.duration)
1608
- else:
1609
- if prev_wait: # if there's a prev_wait not yet added to schedule, place it before instruction
1610
- instructions_to_add = [prev_wait, instruction]
1611
- prev_wait = None
1619
+ continue
1620
+
1621
+ if isinstance(instruction, VirtualRZ):
1622
+ if prev_vz: # merge successive VirtualRZ instructions
1623
+ prev_vz = VirtualRZ(
1624
+ duration=prev_vz.duration + instruction.duration,
1625
+ phase_increment=prev_vz.phase_increment + instruction.phase_increment,
1626
+ )
1612
1627
  else:
1613
- instructions_to_add = [instruction]
1614
- for instr in instructions_to_add:
1615
- _append_to_schedule(sc_schedule, channel_name, instr)
1628
+ prev_vz = VirtualRZ(instruction.duration, instruction.phase_increment)
1629
+ continue
1630
+
1631
+ # handle instructions that are neither Wait nor VirtualRZ
1632
+ if prev_wait: # flush accumulated Wait instructions
1633
+ _append_to_schedule(sc_schedule, channel_name, prev_wait)
1634
+ prev_wait = None
1635
+ if prev_vz: # flush accumulated VirtualRZ instructions
1636
+ _append_to_schedule(sc_schedule, channel_name, prev_vz)
1637
+ prev_vz = None
1638
+ # finally, add instruction
1639
+ _append_to_schedule(sc_schedule, channel_name, instruction)
1640
+ continue
1641
+
1642
+ # if segment ends with VirtualRZ or Wait, flush to schedule
1616
1643
  if prev_wait:
1617
1644
  _append_to_schedule(sc_schedule, channel_name, prev_wait)
1645
+ if prev_vz:
1646
+ _append_to_schedule(sc_schedule, channel_name, prev_vz)
1647
+
1618
1648
  pl.segments.append(sc_schedule)
1619
1649
  return pl, readout_metrics
1620
1650
 
@@ -35,9 +35,21 @@ class Instruction:
35
35
  """Time duration of the instruction. In samples at the channel sample rate."""
36
36
 
37
37
  def __post_init__(self):
38
- """Add a unique id for caching purposes, which can be used if the instruction is not hashable."""
38
+ """Add a unique id for caching purposes, which can be used if the instruction is not hashable.
39
+
40
+ Rounds ``phase`` and ``phase_increment`` to a fixed precision.
41
+ """
39
42
  object.__setattr__(self, "id", random.getrandbits(64))
40
43
 
44
+ # HACK round phases to 8th decimal place to prevent essentially identical instructions bloating
45
+ # the ZI command table, caused by phase differences beyond machine precision.
46
+ # Phase precision for ZI is in the order of 10**-5 radians (19-bit resolution).
47
+ # In the future this should be done on the station-control side for all instruments that benefit from it.
48
+ if hasattr(self, "phase_increment"):
49
+ object.__setattr__(self, "phase_increment", round(self.phase_increment, 8))
50
+ if hasattr(self, "phase"):
51
+ object.__setattr__(self, "phase", round(self.phase, 8))
52
+
41
53
  def validate(self) -> None:
42
54
  """Validate the instruction attributes.
43
55
 
@@ -291,7 +303,7 @@ class ReadoutMetrics:
291
303
  """Map each time trace label (of the format ``"<component>__<readout key>"``) to its number of time trace samples.
292
304
  """
293
305
  implementations: dict[str, set[str]] = field(default_factory=dict)
294
- """Map each integration or time trace readout label to its implementations (of the format
306
+ """Map each integration or time trace readout label to its implementations (of the format
295
307
  ``"<measure gate name>.<implementation name>"``)."""
296
308
 
297
309
  def extend(self, trigger: ReadoutTrigger, seg_idx: int) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-pulse
3
- Version: 12.7.3
3
+ Version: 12.7.4
4
4
  Summary: A Python-based project for providing interface and implementations for control pulses.
5
5
  Author-email: IQM Finland Oy <info@meetiqm.com>
6
6
  License: Apache License
@@ -1,6 +1,6 @@
1
1
  iqm/pulse/__init__.py,sha256=aQhtfbLQgr_1IvbZLH1MCuf0aFomokeu7DSjxuDWZC4,978
2
2
  iqm/pulse/base_utils.py,sha256=ll3k8wbVxjHi6XcVo3PEWIjHx5QjG1C-yH218zTG8jU,2657
3
- iqm/pulse/builder.py,sha256=TByM0GSq13eim2vL3I1uBMU7otzheHAIzsVYxyZXSUc,78179
3
+ iqm/pulse/builder.py,sha256=KkO4s5tLNIHNxPFuJywcXIx628Sy45cVrKxa625Vknc,79482
4
4
  iqm/pulse/circuit_operations.py,sha256=P83gevhGcaY4DaopGKO3CHN_CnWAPfEu-MHoLkqhu5Y,24847
5
5
  iqm/pulse/gate_implementation.py,sha256=LuQuzv45X1iAOAe2UGegu--oFdrudVPCAwvXGgt7sAE,39857
6
6
  iqm/pulse/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -28,7 +28,7 @@ iqm/pulse/playlist/__init__.py,sha256=XW-7Po_vCzhkk1Js06K8P-5srPpBuPHkqpc1yhL_Zx
28
28
  iqm/pulse/playlist/channel.py,sha256=RKFaLfdL436LOw-sNvcNVhNEQrQDoCWJsN8k2p479OQ,17180
29
29
  iqm/pulse/playlist/fast_drag.py,sha256=80Knv0Q9IaGiVdc0TrHlxNi1zJtTUZvWIVO38reYcA0,19600
30
30
  iqm/pulse/playlist/hd_drag.py,sha256=JYRy3aPu0LD9y0H3UncOiWI39eV9-TARvgLonNUsaO0,13562
31
- iqm/pulse/playlist/instructions.py,sha256=uCZX5uKO5XV8fnQQO-_GwMXKcRFsHCu7hdL3YQwBI_4,15559
31
+ iqm/pulse/playlist/instructions.py,sha256=2cnRTPhDDLUPjpObjH3Ih2nlOn08EuqjN2vTcvDjTR4,16268
32
32
  iqm/pulse/playlist/playlist.py,sha256=7MIX4iRfh2Nit8AnpNyqv5A5ZmK7JR-v201DXVL6kUk,685
33
33
  iqm/pulse/playlist/schedule.py,sha256=ToaHKgDxNxLUQalI2TAMMld-EH5Im9rZNktQkXhOyBk,18037
34
34
  iqm/pulse/playlist/waveforms.py,sha256=w5Kgpo7VJwsaCUUKOu3rf5pNmN7Jw2jVLTn3hH-k0R4,23973
@@ -39,8 +39,8 @@ iqm/pulse/playlist/visualisation/templates/static/logo.png,sha256=rbfQZ6_UEaztpY
39
39
  iqm/pulse/playlist/visualisation/templates/static/moment.min.js,sha256=4iQZ6BVL4qNKlQ27TExEhBN1HFPvAvAMbFavKKosSWQ,53324
40
40
  iqm/pulse/playlist/visualisation/templates/static/vis-timeline-graph2d.min.css,sha256=svzNasPg1yR5gvEaRei2jg-n4Pc3sVyMUWeS6xRAh6U,19837
41
41
  iqm/pulse/playlist/visualisation/templates/static/vis-timeline-graph2d.min.js,sha256=OqCqCyA6JnxPz3PGXq_P_9VuSqWptgNt5Ev3T-xjefQ,570288
42
- iqm_pulse-12.7.3.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
43
- iqm_pulse-12.7.3.dist-info/METADATA,sha256=gaQFokYQ0AN460elDwo9_D319pHqiM5Rx2BHRDaVaTM,14492
44
- iqm_pulse-12.7.3.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
45
- iqm_pulse-12.7.3.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
46
- iqm_pulse-12.7.3.dist-info/RECORD,,
42
+ iqm_pulse-12.7.4.dist-info/LICENSE.txt,sha256=R6Q7eUrLyoCQgWYorQ8WJmVmWKYU3dxA3jYUp0wwQAw,11332
43
+ iqm_pulse-12.7.4.dist-info/METADATA,sha256=gY3XGD8X-_km4x4-kuR9-SulZQVjFM49SB7gYioMrV0,14492
44
+ iqm_pulse-12.7.4.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
45
+ iqm_pulse-12.7.4.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
46
+ iqm_pulse-12.7.4.dist-info/RECORD,,