Data
inspeqtor.data
inspeqtor.data.QubitInformation
dataclass
Dataclass to store qubit information
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
str
|
The string representation of unit, currently support "GHz", "2piGHz", "2piHz", or "Hz". |
required |
qubit_idx
|
int
|
the index of the qubit. |
required |
anharmonicity
|
float
|
Anhamonicity of the qubit, kept for the sake of completeness. |
required |
frequency
|
float
|
Qubit frequency. |
required |
drive_strength
|
float
|
Drive strength of qubit, might be specific for IBMQ platform. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
Fail to convert unit to GHz |
Source code in src/inspeqtor/v1/data.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
convert_unit_to_ghz
convert_unit_to_ghz()
Convert the unit of data stored in self to unit of GHz
Raises:
| Type | Description |
|---|---|
ValueError
|
Data stored in the unsupported unit |
Source code in src/inspeqtor/v1/data.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
inspeqtor.data.DataBundled
dataclass
Source code in src/inspeqtor/v1/data.py
16 17 18 19 20 21 22 | |
inspeqtor.data.ExpectationValue
dataclass
Class representing a single experimental setting of state initialization and observable measurement.
Supports both single-qubit and multi-qubit configurations using string representation: - Observable: "XYZ" (instead of ["X", "Y", "Z"]) - Initial state: "+0r" (instead of ["+", "0", "r"])
Source code in src/inspeqtor/v2/data.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
inspeqtor.data.ExperimentalData
dataclass
Dataclass for processing of the characterization dataset. A difference between preprocess and postprocess dataset is that postprocess group expectation values same control parameter id within single row instead of multiple rows.
Source code in src/inspeqtor/v2/data.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
inspeqtor.data.ExperimentConfiguration
dataclass
Experiment configuration dataclass
Source code in src/inspeqtor/v2/data.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
inspeqtor.data.get_observable_operator
get_observable_operator(observable: str) -> ndarray
Get the full observable operator as a tensor product
Source code in src/inspeqtor/v2/data.py
109 110 111 112 113 114 | |
inspeqtor.data.get_initial_state
get_initial_state(
initial_state: str, dm: bool = True
) -> ndarray
Get the initial state as state vector or density matrix
Source code in src/inspeqtor/v2/data.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
inspeqtor.data.get_complete_expectation_values
get_complete_expectation_values(
num_qubits: int,
observables: Iterable[Literal["I", "X", "Y", "Z"]] = [
"I",
"X",
"Y",
"Z",
],
states: Iterable[
Literal["+", "-", "r", "l", "0", "1"]
] = ["+", "-", "r", "l", "0", "1"],
exclude_all_identities: bool = True,
) -> list[ExpectationValue]
Generate a complete set of expectation values for characterizing a multi-qubit system
Source code in src/inspeqtor/v2/data.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
inspeqtor.data.load_data_from_path
load_data_from_path(
path: str | Path,
hamiltonian_spec: HamiltonianSpec,
control_reader=default_control_reader,
) -> LoadedData
Load and prepare the experimental data from given path and hamiltonian spec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
The path to the folder that contain experimental data. |
required |
hamiltonian_spec
|
HamiltonianSpec
|
The specification of the Hamiltonian |
required |
control_reader
|
Any
|
description. Defaults to default_control_reader. |
default_control_reader
|
Returns:
| Name | Type | Description |
|---|---|---|
LoadedData |
LoadedData
|
The object contatin necessary information for device characterization. |
Source code in src/inspeqtor/v2/predefined.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | |
inspeqtor.data.save_data_to_path
save_data_to_path(
path: str | Path,
experiment_data: ExperimentalData,
control_sequence: ControlSequence,
)
Save the experimental data to the path
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
The path to folder to save the experimental data |
required |
experiment_data
|
ExperimentData
|
The experimental data object |
required |
control_sequence
|
ControlSequence
|
The control sequence that used to create the experimental data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
|
Source code in src/inspeqtor/v2/predefined.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
inspeqtor.data.LoadedData
dataclass
A utility dataclass holding objects necessary for device characterization.
Source code in src/inspeqtor/v2/utils.py
23 24 25 26 27 28 29 30 31 32 33 34 | |
inspeqtor.data.prepare_data
prepare_data(
exp_data: ExperimentalData,
control_sequence: ControlSequence,
whitebox: Callable,
) -> LoadedData
Prepare the data for easy accessing from experiment data, control sequence, and Whitebox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp_data
|
ExperimentData
|
|
required |
control_sequence
|
ControlSequence
|
Control sequence of the experiment |
required |
whitebox
|
Callable
|
Ideal unitary solver. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
LoadedData |
LoadedData
|
|
Source code in src/inspeqtor/v2/utils.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
Library
inspeqtor.data.library
inspeqtor.data.library.get_predefined_data_model_m1
get_predefined_data_model_m1(
detune: float = 0.0001,
get_envelope_transformer=get_envelope_transformer,
trotterization: bool = True,
trotter_steps: int = 10000,
)
Source code in src/inspeqtor/v2/predefined.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | |
inspeqtor.data.library.generate_single_qubit_experimental_data
generate_single_qubit_experimental_data(
key: ndarray,
hamiltonian: Callable[..., ndarray],
sample_size: int = 10,
shots: int = 1000,
strategy: SimulationStrategy = SHOT,
qubit_inforamtion: QubitInformation = get_mock_qubit_information(),
control_sequence: ControlSequence = get_drag_pulse_v2_sequence(
drive_strength
),
max_steps: int = int(2**16),
method: WhiteboxStrategy = ODE,
trotter_steps: int = 1000,
expectation_value_receipt: list[
ExpectationValue
] = get_complete_expectation_values(1),
) -> tuple[
ExperimentalData,
ControlSequence,
ndarray,
Callable[[ndarray], ndarray],
]
Generate simulated dataset
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
ndarray
|
Random key |
required |
hamiltonian
|
Callable[..., ndarray]
|
Total Hamiltonian of the device |
required |
sample_size
|
int
|
Sample size of the control parameters. Defaults to 10. |
10
|
shots
|
int
|
Number of shots used to estimate expectation value, will be used if |
1000
|
strategy
|
SimulationStrategy
|
Simulation strategy. Defaults to SimulationStrategy.RANDOM. |
SHOT
|
get_qubit_information_fn
|
Callable[[], QubitInformation]
|
Function that return qubit information. Defaults to get_mock_qubit_information. |
required |
get_control_sequence_fn
|
Callable[[], ControlSequence]
|
Function that return control sequence. Defaults to get_multi_drag_control_sequence_v3. |
required |
max_steps
|
int
|
Maximum step of solver. Defaults to int(2**16). |
int(2 ** 16)
|
method
|
WhiteboxStrategy
|
Unitary solver method. Defaults to WhiteboxStrategy.ODE. |
ODE
|
trotter_steps
|
int
|
Trotterization step. Defualts to 1000 |
1000
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Not support strategy |
Returns:
| Type | Description |
|---|---|
tuple[ExperimentalData, ControlSequence, ndarray, Callable[[ndarray], ndarray]]
|
tuple[ExperimentData, ControlSequence, jnp.ndarray, typing.Callable[[jnp.ndarray], jnp.ndarray]]: tuple of (1) Experiment data, (2) Pulse sequence, (3) Noisy unitary, (4) Noisy solver |
Source code in src/inspeqtor/v2/predefined.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | |
inspeqtor.data.library.get_mock_qubit_information
get_mock_qubit_information() -> QubitInformation
Source code in src/inspeqtor/v1/predefined.py
544 545 546 547 548 549 550 551 | |