bloqade.gemini.post_processing.generate_post_processing
functiongenerate_post_processing¶source
bloqade.gemini.post_processing.generate_post_processing
Signature
def generate_post_processing(mt: ir.Method[Params, ReturnType]) -> None | typing.Callable[[np.ndarray], typing.Iterator[ReturnType]]Generate a post-processing function to extract user-level values from the raw measurement results.
Parameters
| Name | Type | Description |
|---|---|---|
mt | ir.Method[Params, ReturnType] | The entry point of the program |
Returns
(typing.Callable[[ndarray], ReturnType] | None, None | typing.Callable[[np.ndarray], typing.Iterator[ReturnType]], None | typing.Callable[[np.ndarray], typing.Iterator[ReturnType]], None | typing.Callable[[np.ndarray], typing.Iterator[ReturnType]], None | typing.Callable[[np.ndarray], typing.Iterator[ReturnType]])A function that takes in a 2D numpy array of raw measurement results and yields user-level results. The input array shape is (n_shots, n_measurements), where each row corresponds to a measurement result and each column corresponds to a shot. The output is an iterator over user-level results for each shot. If the user-level results cannot be determined, returns None.
Note
This returns the return-value emitter only. Prefer
build_post_processing, which reconstructs detectors and
observables from the same analysis in one pass and reports why a
value could not be inferred instead of collapsing it to None.