jwoehr / qisjob

Qiskit Job Control
Other
32 stars 4 forks source link

add simple kwarg for noise in simulation #20

Closed omarcostahamido closed 1 year ago

omarcostahamido commented 3 years ago

Something my team had done back in the day, was to add a simple interface to add noise when running a job on a full qiskit simulator. I believe this would go something like:

from qiskit.providers.aer import noise  # import Aer noise models

RealDeviceName='ibmq_rome'
device = IBMQ.get_provider(hub='ibm-q', group='open', project='main').get_backend(RealDeviceName)
properties = device.properties()
coupling_map = device.configuration().coupling_map

# Generate an Aer noise model for device
noise_model = noise.device.basic_device_noise_model(properties)
basis_gates = noise_model.basis_gates

# Perform noisy simulation
backend = Aer.get_backend('qasm_simulator')
job_sim = execute(quantumCircuit, backend,
      coupling_map=coupling_map,
      noise_model=noise_model,
      basis_gates=basis_gates)
result = job_sim.result()

needless to say, I don't want to have to do all of this. It would be nice to just turn it on with a simple argument --noise

jwoehr commented 3 years ago

Interesting, let me wrestle with that a bit. Thanks for the suggestion.

jwoehr commented 3 years ago

Try the latest in main branch and use the argument --noisy_sim. qisjob will interpret your --backend argument as the model backend for the Aer sim.

jwoehr commented 3 years ago

Don't use any other simulator arguments when using --noisy_sim Example session:

$ qisjob --backend ibmq_16_melbourne --noisy_sim share/qasm_examples/yiqing.qasm share/qasm_examples/yiqing_5.qasm 
ibmq_16_melbourne 2021-04-11T11:39:02.502258
000;001;010;011;100;101;110;111;
138;148;139;135;126;123;100;115;
ibmq_16_melbourne 2021-04-11T11:39:04.575387
00000;00001;00010;00011;00100;00101;00110;00111;
136;131;137;122;135;114;124;125;