Draft - Photon error mitigation - #771
Conversation
Aubaert
left a comment
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]): |
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) |
There was a problem hiding this comment.
This seems very inefficient
|
|
||
| samples = self._split_integer( | ||
| computation.parameters.get(KEY_MAX_SAMPLES), | ||
| ratios, |
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] = ( |
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}", |
There was a problem hiding this comment.
Abbreviation ? Start at 0 ?
There was a problem hiding this comment.
The abbreviation just stands for Photon Error Mitigation. Feel free to change.
| 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: |
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) |
There was a problem hiding this comment.
Ok, I have no idea why this ratio
|
This was added in #778 |
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