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

Allow NoiseModel.as_dict() to return a serializable dict #165

Merged
merged 4 commits into from
Apr 24, 2019
Merged

Allow NoiseModel.as_dict() to return a serializable dict #165

merged 4 commits into from
Apr 24, 2019

Conversation

diego-plan9
Copy link
Member

Summary

This PR adds an optional parameter to NoiseModel.as_dict() for returning a "dict composed only of types that can be serialized directly using json.dumps() without the need for a custom encoder". It is mostly for the needs of IBMQProvider - since online simulators can also accept noise models, it allows the serialization to be contained within Aer without requiring extra imports or duplication in the other provider.

I went with an approach that hopefully minimizes the impact of this change - by default, the parameter is set to False for preserving current behaviour, and relies on the existing AerJSONEncoder` doing a dummy "dump -> load" cycle.

Details and comments

Add an additional `serializable` keyword to `NoiseModel.as_dict()` that
returns a dictionary containing types that can be serialized directly
by stdlib's json.
@chriseclectic chriseclectic merged commit 7b906a1 into Qiskit:master Apr 24, 2019
@diego-plan9 diego-plan9 deleted the feature/serializable-noise branch April 25, 2019 08:05
dcmckayibm pushed a commit to dcmckayibm/qiskit-aer that referenced this pull request Nov 3, 2019
* Add optional serialization to NoiseModel.as_dict

Add an additional `serializable` keyword to `NoiseModel.as_dict()` that
returns a dictionary containing types that can be serialized directly
by stdlib's json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants