Unverified Commit 25cd124b authored by Mccaskey, Alex's avatar Mccaskey, Alex Committed by GitHub
Browse files

Merge pull request #148 from kharazity/aer_fix

fixed bug preventing number of shots from updating properly when usin…
parents 44e63c95 2dc7d2c0
......@@ -24,6 +24,7 @@ class AerAccelerator(xacc.Accelerator):
if 'shots' in options:
self.shots = options['shots']
if 'backend' in options:
self.backend = options['backend']
import json
......@@ -32,6 +33,7 @@ class AerAccelerator(xacc.Accelerator):
self.modeled_qpu = xacc.getAccelerator('ibm:'+self.backend)
props = self.modeled_qpu.getProperties()
jsonStr = props['total-json']
#print("jsonStr: \n", jsonStr)
properties = BackendProperties.from_dict(json.loads(jsonStr))
ro_error = True if 'readout_error' in options and options['readout_error'] else False
rel = True if 'thermal_relaxation' in options and options['thermal_relaxation'] else False
......@@ -43,22 +45,28 @@ class AerAccelerator(xacc.Accelerator):
return []
else:
return self.modeled_qpu.getConnectivity()
def name(self):
return 'aer'
def execute_one_qasm(self, buffer, program):
print(program.toString())
qobjStr = self.qobj_compiler.translate(program)
import json
from qiskit import Aer
from qiskit.qobj.qobj import QasmQobjSchema
from qiskit.qobj import (QasmQobj, QobjHeader,
QasmQobjInstruction,
QasmQobjExperiment, QasmQobjExperimentConfig, QobjExperimentHeader, QasmQobjConfig)
QasmQobjInstruction,
QasmQobjExperiment, QasmQobjExperimentConfig,
QobjExperimentHeader, QasmQobjConfig)
qobj_json = json.loads(qobjStr)
qobj_json['qObject']['config']['shots']=self.shots
print(qobj_json['qObject']['config'])
qobj = QasmQobjSchema().load(qobj_json['qObject'])
exps = qobj.experiments
measures = {}
qobj.experiments[0].config.n_qubits = 8
for i in exps[0].instructions:
if i.name == "measure":
measures[i.memory[0]] =i.qubits[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment