emu-base 2.5.1__py3-none-any.whl → 2.6.0__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.
emu_base/__init__.py CHANGED
@@ -22,4 +22,4 @@ __all__ = [
22
22
  "init_logging",
23
23
  ]
24
24
 
25
- __version__ = "2.5.1"
25
+ __version__ = "2.6.0"
@@ -90,6 +90,7 @@ def _extract_omega_delta_phi(
90
90
  locals_a_d_p = sequence_dict["XY"]
91
91
  else:
92
92
  raise ValueError("Only `ground-rydberg` and `mw_global` channels are supported.")
93
+ qubit_ids_filtered = [qid for qid in qubit_ids if qid in locals_a_d_p]
93
94
  for i in range(nsamples):
94
95
  t = (target_times[i] + target_times[i + 1]) / 2
95
96
  # The sampled values correspond to the start of each interval
@@ -100,7 +101,7 @@ def _extract_omega_delta_phi(
100
101
  # Note that for dt even, t1=t2
101
102
  t1 = math.floor(t)
102
103
  t2 = math.ceil(t)
103
- for q_pos, q_id in enumerate(qubit_ids):
104
+ for q_pos, q_id in enumerate(qubit_ids_filtered):
104
105
  omega[i, q_pos] = (
105
106
  locals_a_d_p[q_id]["amp"][t1] + locals_a_d_p[q_id]["amp"][t2]
106
107
  ) / 2.0
@@ -110,10 +111,11 @@ def _extract_omega_delta_phi(
110
111
  phi[i, q_pos] = (
111
112
  locals_a_d_p[q_id]["phase"][t1] + locals_a_d_p[q_id]["phase"][t2]
112
113
  ) / 2.0
114
+
113
115
  else:
114
116
  # We're in the final step and dt=1, approximate this using linear extrapolation
115
117
  # we can reuse omega_1 and omega_2 from before
116
- for q_pos, q_id in enumerate(qubit_ids):
118
+ for q_pos, q_id in enumerate(qubit_ids_filtered):
117
119
  delta[i, q_pos] = (
118
120
  3.0 * locals_a_d_p[q_id]["det"][t2] - locals_a_d_p[q_id]["det"][t1]
119
121
  ) / 2.0
@@ -126,6 +128,7 @@ def _extract_omega_delta_phi(
126
128
  / 2.0,
127
129
  0.0,
128
130
  )
131
+
129
132
  return omega, delta, phi
130
133
 
131
134
 
emu_base/utils.py CHANGED
@@ -12,6 +12,26 @@ if unix_like:
12
12
 
13
13
 
14
14
  def init_logging(log_level: int, log_file: Path | None) -> logging.Logger:
15
+ """Create and return a configured logger for the emulators package.
16
+
17
+ This configures a logger named "emulators" and ensures it does not
18
+ propagate messages to ancestor loggers. Any existing handlers attached to
19
+ this logger are removed before the new handler is added.
20
+
21
+ Behavior
22
+ - If `log_file` is None, a StreamHandler writing to stdout is used.
23
+ - If `log_file` is a Path, a FileHandler is created (mode='w'), which
24
+ overwrites the file on each call.
25
+ - The handler's level is set to `log_level` and uses a simple
26
+ "%(message)s" formatter.
27
+
28
+ Args:
29
+ log_level (int): Logging level (e.g. logging.INFO).
30
+ log_file (Path | None): Path to a log file, or None to log to stdout.
31
+
32
+ Returns:
33
+ logging.Logger: The configured logger instance named "emulators".
34
+ """
15
35
  logger = logging.getLogger("emulators")
16
36
  logger.propagate = False
17
37
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emu-base
3
- Version: 2.5.1
3
+ Version: 2.6.0
4
4
  Summary: Pasqal base classes for emulators
5
5
  Project-URL: Documentation, https://pasqal-io.github.io/emulators/
6
6
  Project-URL: Repository, https://github.com/pasqal-io/emulators
@@ -1,14 +1,14 @@
1
- emu_base/__init__.py,sha256=gzORtin5IjJa4eHKvMS8lpoFOkqnyg6gjK2I7Ro1lII,759
1
+ emu_base/__init__.py,sha256=5JI5rxeebOrPm_PXO9VJS945rBSgP7x3fb1pM5VZGJw,759
2
2
  emu_base/constants.py,sha256=41LYkKLUCz-oxPbd-j7nUDZuhIbUrnez6prT0uR0jcE,56
3
3
  emu_base/jump_lindblad_operators.py,sha256=F_C-1aruXY_SLzw0m_HD5loqRGdjgsLHEzttlMzWNEw,3015
4
- emu_base/pulser_adapter.py,sha256=o30fm2soOXr7y2hvoZKLC24oi-FW0_6RmSgrsSWu_y4,7274
5
- emu_base/utils.py,sha256=kXfRFq31r_dfLbBC0SHiPpvf7Wll4behd2vqQJsTrVo,3553
4
+ emu_base/pulser_adapter.py,sha256=QyvJVWmAQDpFBc68-cnndNBkY1rvdDeEXXPse-afQ68,7369
5
+ emu_base/utils.py,sha256=b1MjdzkHUejUsC6W125MppMw7ALrUhS0ugS2u_DOod8,4378
6
6
  emu_base/math/__init__.py,sha256=6BbIytYV5uC-e5jLMtIErkcUl_PvfSNnhmVFY9Il8uQ,97
7
7
  emu_base/math/brents_root_finding.py,sha256=AVx6L1Il6rpPJWrLJ7cn6oNmJyZOPRgEaaZaubC9lsU,3711
8
8
  emu_base/math/double_krylov.py,sha256=X16dyCbyzdP7fFK-hmKS03Q-DJtC6TZ8sJrGTJ6akIc,3708
9
9
  emu_base/math/krylov_energy_min.py,sha256=iR4hmE0eXptbAg3opikd5d4Zv7dhnDrawH-n_4KG-cc,4009
10
10
  emu_base/math/krylov_exp.py,sha256=mGFddVQ8mEbwypbZtnlRPFpi4Nf8JZT6OKLHloIwCDQ,3934
11
11
  emu_base/math/matmul.py,sha256=lEAnV0b5z_f1xEA-9p-WXxA8bM3QbShiHdXQ3ZkZFcQ,877
12
- emu_base-2.5.1.dist-info/METADATA,sha256=x9PuTCLmGou-o1mkLRjOldScvaAX9uj4-e7xXViefbs,3604
13
- emu_base-2.5.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- emu_base-2.5.1.dist-info/RECORD,,
12
+ emu_base-2.6.0.dist-info/METADATA,sha256=WiKgVyQECbJhXRy-DFgMvzn9GGvBvNS5HROaARcztyk,3604
13
+ emu_base-2.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ emu_base-2.6.0.dist-info/RECORD,,