iqm-client 29.1.0__py3-none-any.whl → 29.3.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.
@@ -52,10 +52,10 @@ def get_qubit_order(circuit: cirq.Circuit) -> tuple[list[cirq.Qid], int]:
52
52
  qubit order, number of measured qubits
53
53
 
54
54
  """
55
- measurements = get_measurements(circuit)
55
+ measurements: list[tuple[int, cirq.GateOperation]] = get_measurements(circuit)
56
56
 
57
57
  # mapping from (key, index) to measured qubit, in lexical order
58
- m_qubits = {(op.gate.key, index): qubit for _, op in measurements for index, qubit in enumerate(op.qubits)}
58
+ m_qubits = {(op.gate.key, index): qubit for _, op in measurements for index, qubit in enumerate(op.qubits)} # type:ignore[attr-defined]
59
59
  m_qubits = dict(sorted(m_qubits.items()))
60
60
 
61
61
  qubit_order = list(m_qubits.values())
@@ -81,7 +81,7 @@ def simulate_measurement_probabilities(
81
81
  map from result to its probability, measurement keys
82
82
 
83
83
  """
84
- measurements = get_measurements(circuit)
84
+ measurements: list[tuple[int, cirq.GateOperation]] = get_measurements(circuit)
85
85
  if not measurements:
86
86
  raise ValueError("Circuit has no measurements.")
87
87
 
@@ -95,12 +95,12 @@ def simulate_measurement_probabilities(
95
95
  state = result.state_vector()
96
96
 
97
97
  # trace out non-measured qubits, compute the probabilities of the various measurement outcomes
98
- mixture = cirq.linalg.partial_trace_of_state_vector_as_mixture(state, keep_indices=range(n_measured_qubits))
98
+ mixture = cirq.linalg.partial_trace_of_state_vector_as_mixture(state, keep_indices=list(range(n_measured_qubits)))
99
99
  _temp = [p * np.abs(ket) ** 2 for p, ket in mixture]
100
100
  probs = np.sum(_temp, axis=0)
101
101
 
102
102
  # list the all the measurement outcomes in the matching order
103
- measurement_arities = {op.gate.key: len(op.qubits) for _, op in measurements}
103
+ measurement_arities = {op.gate.key: len(op.qubits) for _, op in measurements} # type:ignore[attr-defined]
104
104
  measurement_arities = dict(sorted(measurement_arities.items()))
105
105
 
106
106
  shape = np.array(2) ** list(measurement_arities.values())
@@ -60,7 +60,7 @@ def demo_run_circuit() -> None:
60
60
 
61
61
  # Sampler results can be accessed several ways
62
62
  # For instance, to see the histogram of results
63
- print(results.histogram(key="m", fold_func=fold_func))
63
+ print(results.histogram(key="m", fold_func=fold_func)) # type:ignore[arg-type]
64
64
 
65
65
  # Or the data itself
66
66
  print(results.data)
iqm/cirq_iqm/serialize.py CHANGED
@@ -195,7 +195,7 @@ def serialize_circuit(circuit: Circuit) -> iqm_client.Circuit:
195
195
  inst.args["feedback_qubit"] = measurement.qubits[0]
196
196
  measurement.args["feedback_key"] = feedback_key
197
197
 
198
- return iqm_client.Circuit(name="Serialized from Cirq", instructions=instructions)
198
+ return iqm_client.Circuit(name="Serialized from Cirq", instructions=instructions, metadata=None)
199
199
 
200
200
 
201
201
  def deserialize_circuit(circuit: iqm_client.Circuit) -> Circuit:
iqm/iqm_client/api.py CHANGED
@@ -86,5 +86,5 @@ class APIConfig:
86
86
  ValueError: If the endpoint is not supported.
87
87
 
88
88
  """
89
- url = self.urls.get(endpoint)
89
+ url = self.urls.get(endpoint, "")
90
90
  return join(self.station_control_url, url % args)
@@ -76,7 +76,9 @@ def login_request(url: str, realm: str, client_id: str, username: str, password:
76
76
  Tokens dictionary
77
77
 
78
78
  """
79
- data = AuthRequest(client_id=client_id, grant_type=GrantType.PASSWORD, username=username, password=password)
79
+ data = AuthRequest(
80
+ client_id=client_id, grant_type=GrantType.PASSWORD, username=username, password=password, refresh_token=None
81
+ )
80
82
 
81
83
  request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/token")
82
84
  result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
@@ -107,7 +109,9 @@ def refresh_request(url: str, realm: str, client_id: str, refresh_token: str) ->
107
109
  raise ClientAuthenticationError("Refresh token has expired")
108
110
 
109
111
  # Update tokens using existing refresh_token
110
- data = AuthRequest(client_id=client_id, grant_type=GrantType.REFRESH, refresh_token=refresh_token)
112
+ data = AuthRequest(
113
+ client_id=client_id, grant_type=GrantType.REFRESH, username=None, password=None, refresh_token=refresh_token
114
+ )
111
115
 
112
116
  request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/token")
113
117
  result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
@@ -130,7 +134,7 @@ def logout_request(url: str, realm: str, client_id: str, refresh_token: str) ->
130
134
  True if logout was successful
131
135
 
132
136
  """
133
- data = AuthRequest(client_id=client_id, refresh_token=refresh_token)
137
+ data = AuthRequest(client_id=client_id, grant_type=None, username=None, password=None, refresh_token=refresh_token)
134
138
  request_url = slash_join(url, f"realms/{realm}/protocol/openid-connect/logout")
135
139
  result = requests.post(request_url, data=data.model_dump(exclude_none=True), timeout=AUTH_REQUESTS_TIMEOUT)
136
140
 
iqm/iqm_client/models.py CHANGED
@@ -412,7 +412,7 @@ class Circuit(BaseModel):
412
412
 
413
413
  name: str = Field(..., examples=["test circuit"])
414
414
  """name of the circuit"""
415
- instructions: tuple[Instruction, ...] = Field(...)
415
+ instructions: list[Instruction] | tuple[Instruction, ...] = Field(...)
416
416
  """instructions comprising the circuit"""
417
417
  metadata: dict[str, Any] | None = Field(None)
418
418
  """arbitrary metadata associated with the circuit"""
@@ -1116,7 +1116,7 @@ class RunResult(BaseModel):
1116
1116
  status = Status(input_copy.pop("status"))
1117
1117
  except ValueError:
1118
1118
  status = Status.UNKNOWN
1119
- return RunResult(status=status, **input_copy)
1119
+ return RunResult(status=status, **input_copy) # type:ignore[arg-type]
1120
1120
 
1121
1121
 
1122
1122
  class RunStatus(BaseModel):
@@ -33,6 +33,7 @@ def validate_circuit(
33
33
  new_circuit = IQMClientCircuit(
34
34
  name="Validation circuit",
35
35
  instructions=tuple(serialize_instructions(circuit=circuit, qubit_index_to_name=qubit_mapping)),
36
+ metadata=None,
36
37
  )
37
38
  if validate_moves is None:
38
39
  validate_moves = MoveGateValidationMode.STRICT
@@ -72,7 +72,7 @@ class IQMNaiveResonatorMoving(TransformationPass):
72
72
  # TODO: Temporary hack to get the symbolic parameters to work: replace symbols with (inf, idx).
73
73
  # Replace symbolic parameters with indices and store the index to symbol mapping.
74
74
  symbolic_gates = {}
75
- symbolic_index = 0
75
+ symbolic_index = 0.0
76
76
  for node in dag.topological_op_nodes():
77
77
  # This only works for prx gates because that has two parameters
78
78
  # We use one to mark that it is a symbolic gate (np.inf) and the other to store the index.
@@ -99,6 +99,7 @@ class IQMNaiveResonatorMoving(TransformationPass):
99
99
  iqm_circuit = IQMClientCircuit(
100
100
  name="Transpiling Circuit",
101
101
  instructions=tuple(serialize_instructions(circuit, self.idx_to_component)),
102
+ metadata=None,
102
103
  )
103
104
  try:
104
105
  routed_iqm_circuit = transpile_insert_moves(
@@ -127,7 +128,7 @@ class IQMNaiveResonatorMoving(TransformationPass):
127
128
  # This only works for prx gates because that has two parameters
128
129
  # We use one to mark that it is a symbolic gate (np.inf) and the other to store the index.
129
130
  if node.name == "r" and not np.isfinite(node.op.params[0]):
130
- new_dag.substitute_node(node, RGate(*symbolic_gates[int(node.op.params[1])]))
131
+ new_dag.substitute_node(node, RGate(*symbolic_gates[int(np.round(node.op.params[1]))]))
131
132
 
132
133
  # Update the final_layout with the correct bits.
133
134
  if "final_layout" in self.property_set:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iqm-client
3
- Version: 29.1.0
3
+ Version: 29.3.0
4
4
  Summary: Client library for accessing an IQM quantum computer
5
5
  Author-email: IQM Finland Oy <developers@meetiqm.com>
6
6
  License: Apache License
@@ -4,7 +4,7 @@ iqm/cirq_iqm/iqm_gates.py,sha256=xnZex5ZfNOk_WSsFjVCRybc14FlGNbmwOs3mIfOE_F8,248
4
4
  iqm/cirq_iqm/iqm_sampler.py,sha256=KLz6j9JcN91GdCAW6fawK99Eyipml3zY89USMVFv2rc,11428
5
5
  iqm/cirq_iqm/optimizers.py,sha256=vJ7BzTLlfULJq-zt3tHQJGv0LzQAdMVlzQxpuw8JdH0,8550
6
6
  iqm/cirq_iqm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- iqm/cirq_iqm/serialize.py,sha256=Gu5DtkJt2sY2UhHzheu4M70lCaHNuu2peoNioX--G24,8126
7
+ iqm/cirq_iqm/serialize.py,sha256=tRkNrzef24va8UMq_Z-TKCsmP7xXtHm3R5qB2VyiIt4,8141
8
8
  iqm/cirq_iqm/transpiler.py,sha256=c3-KE4c-4WenbdOcBMnCS30Ynm4Wt35i-bl4iG8pKAs,2112
9
9
  iqm/cirq_iqm/devices/__init__.py,sha256=WxbvNAqmeoV4mNy9M9IpjwmyNDpAP7ec1XFdjN7w_YA,840
10
10
  iqm/cirq_iqm/devices/adonis.py,sha256=ZWaA4_OfO6fBcrLYHONTjtW8aSlVq2nwy9IiW529gQw,1390
@@ -14,21 +14,21 @@ iqm/cirq_iqm/devices/iqm_device.py,sha256=8cVCJhy0YFLArYvajI7o8E2DbLNpimlak3yVaB
14
14
  iqm/cirq_iqm/devices/iqm_device_metadata.py,sha256=J_mBU6gJx34tcmX_He0c7nSV5Sb9o0pH3LtpcIblT60,7112
15
15
  iqm/cirq_iqm/examples/demo_adonis.py,sha256=rbLEs_CPO-J4OGnYLrlWismzVB6jT026F_X8epNxt0s,1726
16
16
  iqm/cirq_iqm/examples/demo_apollo.py,sha256=S9HEE_TzSRlh0lfv57c9lFmrJZzAZtnRAkXjfgMSSGU,1749
17
- iqm/cirq_iqm/examples/demo_common.py,sha256=8Drw_GGpHoloCZ3etq-2T9Z2ZTaV2RrpxeowNPxmTnc,8480
18
- iqm/cirq_iqm/examples/demo_iqm_execution.py,sha256=Gy5evjrBj1P9-wH--MOLV1WLSuDtRir082Xtt8EH99Q,2481
17
+ iqm/cirq_iqm/examples/demo_common.py,sha256=9SUfl0vfbO_6NPOsYt3-OmBQ3jAuYWCLj6ASImD2bjM,8620
18
+ iqm/cirq_iqm/examples/demo_iqm_execution.py,sha256=8eSl0jsVdIsxZtpocd223jhJ-89C4p7zjlfBV3_6sYk,2506
19
19
  iqm/cirq_iqm/examples/usage.ipynb,sha256=Kyfyu_MwqzTavHVNjgrWJo1tZPeJwTw7ExcU0MFYNRk,34208
20
20
  iqm/iqm_client/__init__.py,sha256=D-8W54EcQIxk_1JZo_86GYlR1YitHhPIiFwwLJ2IfGE,1411
21
- iqm/iqm_client/api.py,sha256=07K_vRtKv1EGNNVhMLsEYn0FCEXaGTp0uNtfmKc_0mY,3079
21
+ iqm/iqm_client/api.py,sha256=_c6OVuv2dyzBF7J2XlK_qxisTSPyOiI4gYokZPsuaJY,3083
22
22
  iqm/iqm_client/authentication.py,sha256=kHFqPI6w3OAk9k5ioPxi-FrD2EP-vjn8Z_wZYccJVyE,12259
23
23
  iqm/iqm_client/errors.py,sha256=ty2P-sg80zlAoL3_kC3PlprgDUv4PI-KFhmmxaaapS0,1429
24
24
  iqm/iqm_client/iqm_client.py,sha256=blaTt4lBcgn8bpPkvS1-zCRxUWXBGIjGg5o5sUsynf8,39302
25
- iqm/iqm_client/models.py,sha256=X_RSjAcOC-ygALQYVQw0yPxXG5nv7-_oWMrW-thDwds,50850
25
+ iqm/iqm_client/models.py,sha256=PdqpI_6MVCRzQozl6-qGD2LaR-gTdW0at8Lw5KcTBnU,50895
26
26
  iqm/iqm_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  iqm/iqm_client/transpile.py,sha256=eEv9eY5QG94Lke7Xp6BkQapl1rvlmlVQ_IkQFopPNQ8,36981
28
28
  iqm/iqm_client/util.py,sha256=FLRUhhi0YDxomVtilCVPJLixyijFtU10PVefIx-eelw,1516
29
29
  iqm/iqm_client/validation.py,sha256=vIwRx9ZjMpR2lciWX0Dlexoozv_KRrZXbu0whvcxIq4,11772
30
30
  iqm/iqm_client/cli/__init__.py,sha256=zzLDDz5rc3lJke3OKU8zxR5zQyQoM9oI2bLJ2YKk_zQ,692
31
- iqm/iqm_client/cli/auth.py,sha256=-esyrltJ5E5MRmVdJcvL5Sanpfr6OzKG_66G1NfwFAA,6238
31
+ iqm/iqm_client/cli/auth.py,sha256=SCOZ6QHw9l8oE-A1QSYfAKYuqZxkZkYrwaNWzGFY1AU,6363
32
32
  iqm/iqm_client/cli/cli.py,sha256=YhTgOGrvNXPwCdCKHcwLHeE_6C3n91MxFhvgQYT78C4,28633
33
33
  iqm/iqm_client/cli/models.py,sha256=Hu-t6c_07Cth3AuQBo0CDTcWVQg1xbJCpy_94V0o64U,1199
34
34
  iqm/iqm_client/cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -36,10 +36,10 @@ iqm/iqm_client/cli/token_manager.py,sha256=e8M3UihnawxGlajAw5AP6x4TEH5PaCRQ4ADNn
36
36
  iqm/qiskit_iqm/__init__.py,sha256=Mv9V_r8ZcmGC8Ke5S8-7yLOx02vjZ1qiVx8mtbOpwnY,1420
37
37
  iqm/qiskit_iqm/iqm_backend.py,sha256=LhyhccB9u_Y4lyFTzAQkYfX7CI_hbBx3CQHwbwR3wlA,13975
38
38
  iqm/qiskit_iqm/iqm_circuit.py,sha256=fFQW8SRlgZjqZUOLfyuJhhXEDp5I1jopFWa1k4rb7ac,1384
39
- iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=5VSlgpS6sxZ4xYFxF8cJiFOrsC9FEW1vLqU77Ig55-w,1698
39
+ iqm/qiskit_iqm/iqm_circuit_validation.py,sha256=vE5CNyJOQ7OMRpQV-xsO1uf_NNFE8v6-TSzboFSrGYM,1721
40
40
  iqm/qiskit_iqm/iqm_job.py,sha256=_JF2DANalsRu4b0r-XxMmTNOqmaShjp1rmU7h44DKRo,11466
41
41
  iqm/qiskit_iqm/iqm_move_layout.py,sha256=pHqV1G4bri3rFEsMBN6FrtQ0FXVNQG-Ymm4v7zdnilQ,10787
42
- iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=zH2GHH85cRspRvWb8vPbweUo1e-FG8sMbDgEMqxmVJY,12359
42
+ iqm/qiskit_iqm/iqm_naive_move_pass.py,sha256=HoLPgkRK7X2g8KM2ML5-rggNE5HIfGEzq4vkthYSPyg,12398
43
43
  iqm/qiskit_iqm/iqm_provider.py,sha256=aZG3OfbG1YT9584p1EtIPuSvl6Z8Vdx_3GlHasRzmqg,15842
44
44
  iqm/qiskit_iqm/iqm_transpilation.py,sha256=2bwvVd8NwBRU6gwlPOsovhyAmUnm8thKokvkuCwfWC8,8915
45
45
  iqm/qiskit_iqm/move_gate.py,sha256=QU9RKKVvbGq33qcIi9AKLcvQVQMibkgW4ibjzk-oVy4,2808
@@ -57,10 +57,10 @@ iqm/qiskit_iqm/fake_backends/fake_apollo.py,sha256=eT2vd3kQBi1rrvxCpePymBCfFK84d
57
57
  iqm/qiskit_iqm/fake_backends/fake_deneb.py,sha256=RzQXmLXmBARDiMKVxk5Aw9fVbc6IYlW0A5jibk9iYD0,3156
58
58
  iqm/qiskit_iqm/fake_backends/fake_garnet.py,sha256=GI0xafTCj1Um09qVuccO6GPOGBm6ygul_O40Wu220Ys,5555
59
59
  iqm/qiskit_iqm/fake_backends/iqm_fake_backend.py,sha256=wJtfsxjPYbDKmzaz5R4AuaXvvPHa21WyPtRgNctL9eY,16785
60
- iqm_client-29.1.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
61
- iqm_client-29.1.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
62
- iqm_client-29.1.0.dist-info/METADATA,sha256=IMLhmpI7dEgOuw2XcUTGD6_v-z3pl2_IxzpcifpiYP0,17545
63
- iqm_client-29.1.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
64
- iqm_client-29.1.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
65
- iqm_client-29.1.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
66
- iqm_client-29.1.0.dist-info/RECORD,,
60
+ iqm_client-29.3.0.dist-info/AUTHORS.rst,sha256=qsxeK5A3-B_xK3hNbhFHEIkoHNpo7sdzYyRTs7Bdtm8,795
61
+ iqm_client-29.3.0.dist-info/LICENSE.txt,sha256=2DXrmQtVVUV9Fc9RBFJidMiTEaQlG2oAtlC9PMrEwTk,11333
62
+ iqm_client-29.3.0.dist-info/METADATA,sha256=AUHb_Wb7hc5_AXD27mtTyakTP1pdkVCIbW5oeKM335E,17545
63
+ iqm_client-29.3.0.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
64
+ iqm_client-29.3.0.dist-info/entry_points.txt,sha256=Kk2qfRwk8vbIJ7qCAvmaUogfRRn6t92_hBFhe6kqAE4,1317
65
+ iqm_client-29.3.0.dist-info/top_level.txt,sha256=NB4XRfyDS6_wG9gMsyX-9LTU7kWnTQxNvkbzIxGv3-c,4
66
+ iqm_client-29.3.0.dist-info/RECORD,,