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

[Refactoring] [Testing] [Feature] NoiseHandler #591

Merged
merged 58 commits into from
Oct 30, 2024
Merged

Conversation

chMoussa
Copy link
Collaborator

@chMoussa chMoussa commented Oct 25, 2024

Supersedes #584 and solves #583 (besides plotting). We introduce a NoiseHandler class containing information about the noise. For digital noise, this means now that we can do a conversion in convert_ops to the right class in Pyq. @jpmoutinho also proposed to separate noise protocol types into Analog, Digital, and Readout (given that a same protocol name may be available in different settings such as depolarizing).

Note that a substantial harmonisation of naming may be needed between different backend (Readout is basically called SPAM in Pulser).

Todos:

  • Redesign the previous Noise class into the NoiseHandler class to allow multiple combination of noise protocols.
  • Change typings and replace DigitalNoise in blocks.
  • Add conversion function for Pyq backend.
  • Serialize noise in blocks
  • Add Tests
  • Elaborate the docs.

@chMoussa
Copy link
Collaborator Author

Thanks @chMoussa more comments from me as I think we can simplify further. Another point is about testing for composed noise models. Have you tried it out ?

Yes, I just added a parameterized test for this in qadence/tests/qadence/test_noise/test_digital_noise.py

qadence/noise/protocols.py Outdated Show resolved Hide resolved
docs/tutorials/realistic_sims/noise.md Outdated Show resolved Hide resolved
docs/tutorials/realistic_sims/noise.md Show resolved Hide resolved
qadence/mitigations/analog_zne.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jpmoutinho jpmoutinho left a comment

Choose a reason for hiding this comment

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

Very nice @chMoussa, this looks much cleaner :)

I did not go into the full details of the code, let me know if there is something specific that you would like to discuss. But in general, this interface has my approval.

@RolandMacDoland RolandMacDoland self-requested a review October 29, 2024 14:13
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 @chMoussa. Sorry for being a pain but I think we still have too many types that makes the whole implementation difficult to follow. Ideally, I think we can get away with max two types. Also, would it make sense to turn the NoiseHandler into a pydantic model for all the checking ? It might also help in serialization. Just a suggestion.

docs/tutorials/realistic_sims/noise.md Outdated Show resolved Hide resolved
qadence/backends/pulser/backend.py Show resolved Hide resolved
qadence/noise/protocols.py Outdated Show resolved Hide resolved
qadence/noise/protocols.py Outdated Show resolved Hide resolved
qadence/noise/protocols.py Outdated Show resolved Hide resolved
@chMoussa
Copy link
Collaborator Author

chMoussa commented Oct 29, 2024

Thanks @chMoussa. Sorry for being a pain but I think we still have too many types that makes the whole implementation difficult to follow. Ideally, I think we can get away with max two types. Also, would it make sense to turn the NoiseHandler into a pydantic model for all the checking ? It might also help in serialization. Just a suggestion.

@RolandMacDoland, I followed your suggestions. Now we only have the NoiseHandler and the classmethods are becoming mutation methods. Also for pydantic, I think I would try it in future MRs since this one is getting quite consequent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or request refactoring Refactoring of legacy code testing Everything related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants