Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Added simulated readout error routines #23

Closed
wants to merge 65 commits into from
Closed

Conversation

madagra
Copy link
Collaborator

@madagra madagra commented Oct 2, 2023

Deprecated. This will be closed soon.

jpmoutinho and others added 30 commits October 2, 2023 12:55
Digital decomposition, operations and Braket backend
* Add README.

* Remove useless heading.
Co-authored-by: Kaonan Micadei <[email protected]>
Co-authored-by: Vytautas Abramavicius <[email protected]>
* state preparation
* logging
* register
* execution helpers
* qubit support
* serialization
* typing
* wavefunction overlaps

Co-authored-by: Aleksander Wennersteen <[email protected]>
Co-authored-by: Mario Dagrada <[email protected]>
Co-authored-by: Vincent Elfving <[email protected]>
Co-authored-by: Dominik Seitz <[email protected]>
Co-authored-by: Joao Moutinho <[email protected]>
Co-authored-by: Vytautas Abramavicius <[email protected]>
Co-authored-by: Niklas Heim <[email protected]>
Co-authored-by: Roland Guichard <[email protected]>
* state preparation
* logging
* register
* execution helpers
* qubit support
* serialization
* typing
* wavefunction overlaps

Co-authored-by: Aleksander Wennersteen <[email protected]>
Co-authored-by: Mario Dagrada <[email protected]>
Co-authored-by: Vincent Elfving <[email protected]>
Co-authored-by: Dominik Seitz <[email protected]>
Co-authored-by: Joao Moutinho <[email protected]>
Co-authored-by: Vytautas Abramavicius <[email protected]>
Co-authored-by: Niklas Heim <[email protected]>
Co-authored-by: Roland Guichard <[email protected]>
Co-authored-by: Aleksander Wennersteen <[email protected]>
Co-authored-by: Mario Dagrada <[email protected]>
Co-authored-by: Vincent Elfving <[email protected]>
Co-authored-by: Gert-Jan Both <[email protected]>
@gvelikova gvelikova assigned gvelikova and unassigned madagra Oct 6, 2023
RolandMacDoland and others added 14 commits October 6, 2023 13:35
* Docs suggestions.

* Fix typo.

* Latest changes.

* Latest changes.

* Trigger docs tests on CI.

* More files to docs.

* fix circuit drawings

* quadance to qadance

* More docs improvements.

* fix docs build

* More suggestions and run test-docs again.

* update pulser examples

* remove mkdocs-jupyter

* update pulser example

* More improvements.

---------

Co-authored-by: jpmoutinho <[email protected]>
Co-authored-by: João P. Moutinho <[email protected]>
Co-authored-by: Vytautas Abramavicius <[email protected]>
* update readme

* remove admonition

* lint

---------

Co-authored-by: Roland Guichard <[email protected]>
* Improvements to the Pulser backend documents + change defaults

* Shorter names to the workflows

* Linting

* Improvements to the docs

* Added AnalogRZ operation to the enumeration

* Go back to idealized device

---------

Co-authored-by: Roland Guichard <[email protected]>
Co-authored-by: Aleksander Wennersteen <[email protected]>
Co-authored-by: Aleksander Wennersteen <[email protected]>
Co-authored-by: Mario Dagrada <[email protected]>
* Docs suggestions.

* Fix typo.

* Latest changes.

* Latest changes.

* Trigger docs tests on CI.

* More files to docs.

* fix circuit drawings

* quadance to qadance

* More docs improvements.

* fix docs build

* More suggestions and run test-docs again.

* update pulser examples

* remove mkdocs-jupyter

* update pulser example

* More improvements.

* Fix lint.

* More docs suggestions.

* More and more suggestions.

* More suggestions.

* More suggestions.

* Concatenate two doc files.

* Move to qml_tools.md

* More suggestions.

* update entanglement tests

* few fixes

* pulser-basic tutorial broken

* few fixes

* few fixes

* more fixes

* remove total_magnetization from docs

* remove emuc

* fix entanglement test

* fix entanglement test

* Update docs/advanced_tutorials/custom-models.md

* Update docs/advanced_tutorials/differentiability.md

* Update docs/digital_analog_qc/pulser-basic.md

* Update docs/tutorials/ml_tools.md

* Update docs/tutorials/qml_tools.md

* Update docs/tutorials/ml_tools.md

* Update docs/tutorials/qml_tools.md

* Update docs/tutorials/serializ_and_prep.md

* More suggestions.

* Fix conflicts.

---------

Co-authored-by: jpmoutinho <[email protected]>
Co-authored-by: João P. Moutinho <[email protected]>
Co-authored-by: Vytautas Abramavicius <[email protected]>
@RolandMacDoland RolandMacDoland changed the title Added simulated readout error routines [Feat] Added simulated readout error routines Oct 9, 2023
Copy link
Collaborator

@RolandMacDoland RolandMacDoland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @madagra. Here are some uncomplete suggestions. If you approve them, I'll take this work over.

@abstractmethod
def _overlap(bras: Tensor, kets: Tensor) -> Tensor:
def overlap(self, bra: QuantumCircuit, ket: Optional[QuantumCircuit] = None) -> Tensor:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def overlap(self, bra: QuantumCircuit, ket: Optional[QuantumCircuit] = None) -> Tensor:
def overlap(self, bra: QuantumCircuit, ket: QuantumCircuit | None = None) -> Tensor:

@@ -49,6 +50,7 @@ def __init__(
diff_mode: DiffMode = DiffMode.AD,
protocol: Measurements | None = None,
configuration: BackendConfiguration | dict | None = None,
noise_model: ErrorModel | None = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
noise_model: ErrorModel | None = None,
error_model: ErrorModel | None = None,

@@ -62,6 +64,7 @@ def __init__(
protocol: Optional measurement protocol. If None, use
exact expectation value with a statevector simulator.
configuration: Configuration for the backend.
noise_model: Whether or not and which noise model to use.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
noise_model: Whether or not and which noise model to use.
error_model: Whether or not and which noise model to use.

@@ -93,6 +95,8 @@ def __init__(
self._backend_name = backend
self._diff_mode = diff_mode
self._protocol = protocol
self._noise_model = noise_model
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self._noise_model = noise_model
self._error_model = error_model

if self._noise_model is None:
return output
# corrupt bitstrings with simple readout noise
elif self._noise_model.name == "ReadoutError":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point: readout errors aren't generated by noise. I think naming everything error_model makes it more generic.

qadence/noise.py Outdated
"""White noise distributions"""

UNIFORM = staticmethod(uniform.Uniform(low=0.0, high=1.0))
"uniform white noise"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"uniform white noise"
"""Uniform white noise."""

qadence/noise.py Outdated
"uniform white noise"

GAUSSIAN = staticmethod(normal.Normal(loc=0.0, scale=1.0))
"gaussian white noise"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"gaussian white noise"
"""Gaussian white noise."""

qadence/noise.py Outdated
"gaussian white noise"

POISSON = staticmethod(poisson.Poisson(rate=0.1))
"poisson white noise"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"poisson white noise"
"""Poisson white noise."""

qadence/noise.py Outdated
name = "ErrorModel"

@abstractmethod
def bit_flip(self, qbit: int) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def bit_flip(self, qbit: int) -> int:
def bit_flip(self, qubit: int) -> int:

qadence/noise.py Outdated
pass

@abstractmethod
def phase_flip(self, qbit: int) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def phase_flip(self, qbit: int) -> int:
def phase_flip(self, qubit: int) -> int:

@madagra madagra marked this pull request as draft October 10, 2023 20:52
@madagra
Copy link
Collaborator Author

madagra commented Oct 27, 2023

@Roland-djee please close this one.

@gvelikova gvelikova closed this Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request realistic-sim
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants