Draft - Photon error mitigation - #771
Draft
anthonyrtw wants to merge 4 commits into
Draft
Conversation
Aubaert
reviewed
Jul 21, 2026
Aubaert
left a comment
Contributor
There was a problem hiding this comment.
Hello, thanks for the draft PR, we'll do the modifications on our side
| If a callable is given, it is evaluated on the input photon number. | ||
| """ | ||
|
|
||
| def __init__(self, order: int | Callable[[int], int]): |
Contributor
There was a problem hiding this comment.
dict at best (Callable is not serializable)
| """ | ||
| states = set() | ||
| for current_order in range(order + 1): | ||
| partition = _generate_obb_partition(input_state, current_order) |
Contributor
There was a problem hiding this comment.
This seems very inefficient
|
|
||
| samples = self._split_integer( | ||
| computation.parameters.get(KEY_MAX_SAMPLES), | ||
| ratios, |
Contributor
There was a problem hiding this comment.
The ratios might benefit to be different for samples and shots
| sub_computations.append(comp) | ||
|
|
||
| # Save some settings for _parse_results | ||
| self._settings[computation] = ( |
Contributor
There was a problem hiding this comment.
This class should be const
| input_state=state, | ||
| samples=samples[i], | ||
| shots=shots[i], | ||
| job_name=f"{computation.job_name} pem {i + 1}", |
Contributor
There was a problem hiding this comment.
Abbreviation ? Start at 0 ?
| raise ValueError("order must be an integer greater than 0.") | ||
|
|
||
| if order > 4: | ||
| warnings.warn( |
| for _ in range(partition_counts[i]) | ||
| ] | ||
|
|
||
| if len(corrections) != len(weights_hom): |
|
|
||
| # 1 * dist makes a copy to avoid in-place mutation | ||
| convolved = BSDistribution.list_tensor_product([ | ||
| sum((1 * dist for dist in signal_dists), BSDistribution()), |
| noise = noise or NoiseModel() | ||
| g2 = noise.g2 | ||
|
|
||
| if g2 > .5: |
Contributor
There was a problem hiding this comment.
This should be done earlier, at job duplication
| transmittance = noise.transmittance | ||
| assert transmittance > 0, "Improper calibration has led to zero transmittance." | ||
|
|
||
| norm = sum(transmittance ** (-state.n / 2) for state in states) |
Contributor
There was a problem hiding this comment.
Ok, I have no idea why this ratio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Photon Error Mitigation
Description
Adds
PhotonErrorMitigation, a new mitigation layer for correcting statistics for photon distinguishability and g2.Extra features
orderparameter - which indicates the level of noise considered under 'Orthogonal Bad Bits' partial distinguishability model.ordermay be defined asintor also aCallable- so that it may be specified more abstractly in plannedErrorMitigationFactory.PhotonErrorMitigation.overhead(input_state: FockState)method so that one may determine how many extra jobs are required to perform mitigation based on the specifiedorder.Notes
PhotonErrorMitigation._parse_resultsexpects that the input results reflects the compiled Experiment with the full QPU mode count.PhotonErrorMitigation._parse_resultsalso expects that input results are lossy & contain vacuum counts irrespective of themin_detected_photon_filter.To do