MarcSerraPeralta / iq_readout

Classifiers for IQ readout data from superconducting qubits
https://iq-readout.readthedocs.io/en/latest/
MIT License
1 stars 0 forks source link

Add measurement crosstalk #12

Open MarcSerraPeralta opened 3 months ago

MarcSerraPeralta commented 3 months ago

image

Reference: DOI:10.1103/PhysRevApplied.10.034040

MarcSerraPeralta commented 1 month ago

I haven't still written this functionality because I don't seem to find the best input for this function. The input must include: 1) classifier for each qubit (e.g. dict(qubit_label=classifier_qubit)) 2) qubit order when preparing all the bistrings and the IQ data (i.e. the bitstrings do not need to be specified as one must include all of them) 3) IQ data for each bitstring (e.g. dict(bitstring=data) where data.shape = (num_shots, num_qubits, IQ) or dict(bitstring=dict(qubit_label=data) where data.shape = (num_shots, IQ) where IQ=2)

An option that does not use xarrays would be to assume that the order of the qubits is the same for all input variables, i.e.: 1) list of classifiers for each qubit: [clf_q1, clf_q2, ...] 2) IQ data for each bitstring: [[data_bitstring1_q1, data_bitstring2_q1,...], [data_bitstring1_q2, data_bitstring2_q2,...], ...] where data.shape = (num_shots, IQ). Note that here I am using lists instead of an array, this choice is because the number of shots per bitstring and/or qubit might be different due to post-selection (e.g. heralded initialization). Also the order of the bitstrings should be "standard one", e.g. 001, 010, 011, 100, ... .

Because of the possibility that the number of shots is not the same for all bitstrings and qubits, I believe it is not possible to store the data in a xarray.DataArray. Therefore, I will probably stick to the option described above. In the plotting functionality, a list of qubit labels can be provided to generate the x-axis and y-axis labels.

MarcSerraPeralta commented 3 weeks ago

As an extra comment, I could add a utils.dataarray functionality to deal with xarray objects. For example, in this case, the function could check if the input is an xarray object and if so, transform it to the correct input structure. The post-selection elements should be flagged with nan because xarray already has some functionality for masking them.

MarcSerraPeralta commented 3 weeks ago

Because of the possibility that the number of shots is not the same for all bitstrings and qubits

The number shots can only be different for different bitstrings, it cannot be different for a given bitstring and different qubits. The reason is that for a given shot, one needs to be able to compute the outcome bitstring, e.g. prepared=0101 outcome=0111. However, if the number of shots is not the same for all qubits given a bitstring, then it is not possible to build the outcome bitstrings.