Utils
ShotRemappingException
Bases: Exception
flowchart TD
bloqade.gemini.device.logical.utils.ShotRemappingException[ShotRemappingException]
click bloqade.gemini.device.logical.utils.ShotRemappingException href "" "bloqade.gemini.device.logical.utils.ShotRemappingException"
Exception if we failed to produce a shot remapping.
aligned_detected_and_sorted_shots_for_subtasks
aligned_detected_and_sorted_shots_for_subtasks(
storage, shot_filter, subtasks: Sequence[dict]
) -> tuple[list[np.ndarray], list[np.ndarray]]
Return DETECTED and SORTED frames aligned shot-for-shot per subtask.
Each frame is ordered by the complete storage identity. A mismatch means that the two frames cannot safely be compared by array position.
Source code in .venv/lib/python3.12/site-packages/bloqade/gemini/device/logical/utils.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
get_slm_mapping_postprocessing
get_slm_mapping_postprocessing(
sim_kernel: Method[..., RetType],
) -> tuple[
Callable[..., Any], atom.PostProcessing[RetType]
]
Create a result postprocessor for full Zone-0 SLM shots.
Result post-processing is two steps, and this returns both::
physical_bitstring = [frame_data[i] for i in shot_remapping]
user_output = post_processing.emit_return([physical_bitstring])
The returned post-processing object comes from
:func:~bloqade.gemini.post_processing.build_post_processing, which
abstract-interprets the user's kernel once to reconstruct its return
value and every detector and observable annotation.
Warning
This reconstructs the physical measurement mapping by compiling the stored logical kernel with the locally installed Bloqade Lanes compiler and Gemini architecture. The result is valid only when they match the compiler and architecture used to execute the remote task. The exact remote physical compilation artifact is not currently stored with the result.
Source code in .venv/lib/python3.12/site-packages/bloqade/gemini/device/logical/utils.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 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 177 178 179 180 181 182 183 184 185 186 | |
shot_results_for_subtasks
shot_results_for_subtasks(
storage,
shot_filter,
subtasks: Sequence[dict],
*,
frame_type: str | None = None
) -> list[np.ndarray]
Return selected shot bitstrings grouped and sorted by subtask.
StorageBackend.get_shots does not promise an ordering. This helper
preserves the caller-provided subtask order and sorts each subtask by its
full storage identity. frame_type optionally overrides the frame type
already present in shot_filter.
Source code in .venv/lib/python3.12/site-packages/bloqade/gemini/device/logical/utils.py
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 67 | |