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:
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.
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.
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 anbraket.ir.ahs.Program
object into abraket.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:
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 callbraket.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.We start from an ahs_program.json file, which we created previously when we serialized by
braket.ahs.AnalogHamiltonianSimulation
object withmy_ahs_program.to_ir().json()
, and written to a file. At a later point, we read the json file to a dictjson_dict
and recreate the AHS object withmy_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 representationbraket.ahs.AnalogHamiltonianSimulation
.