# Can I use job_manager to get memories for 3 parts of the experiment?

Here's part of the code I'm working on:

all_circuits = []
for _ in range(100):
all_circuits.extend([quanc_z,quanc_x,quanc_y])
all_circuits = transpile(all_circuits, backend=backend)
MExperiments = job_manager.run(all_circuits, backend=backend, shots = 1024)
results = meas_filter.apply(MExperiments.results())
memory_z = results.get_memory()
memory_x = results.get_memory()
memory_y = results.get_memory()   # Question


I have a list of quantum circuits all_circuits composed of the repeating circuit sequence quanc_z(,x,y) and I'm trying to run them using qiskit job_manager. I applied the readout error mitigation to the results and I want to get the memories of each quantum circuit in all_circuits, and combine the memories with the same label z,x,y on their associated circuits. I wonder is there a way I can get the memory for each circuit that I submitted in a bundle using job manager? Thanks for the help!!

Yes, but it has more to do with extracting data from the result and not so much with job manager.

Method 1, use the circuit index. If your circuits are always in the z, x, y order, then you can do something like

memory_z = []
memory_x = []
memory_y = []

for i in range(len(all_circuits)):
mem = results.get_memory(i)
if i % 3 == 0:
memory_z.append(mem) # or however you want to combine them
elif i % 3 == 1:
memory_x.append(mem)
else:
memory_y.append(mem)


Method 2, assign metadata to each circuit and use that to differentiate individual result data, something like

quanc_z.metadata = {"tag": "z"}

combined = results.combine_results()
for i, r in enumerate(combined.results):
memory_z.append(results.get_memory(i))
...  # repeat for the other 2


1. You need a lower measurement level or memory=True in your job_manager.run() to get memory data. See the get_memory doc for more details.
2. Measurement correction fitters in qiskit-ignis, if that's what you're using, usually takes a Result object as an input. Job manager, on the other hand, returns a ManagedResults object. But you can use the combine_results() method to convert a ManagedResults to a Result:
managed_result = job_manager.run(...).results()

This combine_results() was needed in method 2 above because ManagedResults doesn't have the results attributes.