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

from_ir method for AnalogHamiltonianSimulation #971

Closed
peterkomar-aws opened this issue May 8, 2024 · 2 comments
Closed

from_ir method for AnalogHamiltonianSimulation #971

peterkomar-aws opened this issue May 8, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@peterkomar-aws
Copy link
Contributor

Describe the feature you'd like
The braket.ahs.AnalogHamiltonianSimulation object has a to_ir method to export its content in the format of braket.ir.ahs.Program, but no from_ir method, which would load the content of an braket.ir.ahs.Program object into a braket.ahs.AnalogHamiltonianSimulation object. Let's create this method so AHS programs can be worked with similarly to circuits (See braket.circuits.Circuit.from_ir)

How would this feature be used? Please describe.
There are two common use cases:

  1. We start from a results.json file, which is created by the Braket service after successfully running an AHS program. The metadata content of such a file contains the ahs program that was run and it can be loaded as a braket.ir.ahs.Program object, after which we can call braket.ahs.AnalogHamiltonianSimulation.from_ir() to create the AHS program in the Braket SDK's abstractions. This allows us to modify and inspect it using the utilities in the Braket SDK.

  2. We start from an ahs_program.json file, which we created previously when we serialized by braket.ahs.AnalogHamiltonianSimulation object with my_ahs_program.to_ir().json(), and written to a file. At a later point, we read the json file to a dict json_dict and recreate the AHS object with my_ahs_prgram = AnalogHamiltonianSimulation.from_ir(Program(json_dict)).

Describe alternatives you've considered
The alternative is to develop utilities to edit and inspect a braket.ir.ahs.Program object, instead of the already established standard representation braket.ahs.AnalogHamiltonianSimulation.

@peterkomar-aws peterkomar-aws added the enhancement New feature or request label May 8, 2024
@rmshaffer rmshaffer added the good first issue Good for newcomers label May 14, 2024
@king-p3nguin
Copy link
Contributor

Hi, I would like to work on this issue for unitaryhack.

@peterkomar-aws
Copy link
Contributor Author

#983 resolves this issue. Thank you, @king-p3nguin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants