Skip to content

Commit fda5774

Browse files
committed
Fix lint error and missing doc for experiment options
1 parent effe196 commit fda5774

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

qiskit_experiments/library/characterization/analysis/t1_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def estimate_minmax_frequencies(
322322
amp = min(max_amp, max(inflection_points, key=abs), key=abs)
323323
polyfun = np.poly1d([coefficients[names[idx]] for idx in [*idxs, 6]])
324324
freqs.append(polyfun(amp))
325-
return freqs
325+
return tuple(freqs)
326326

327327
def _convert_axis(
328328
self,

qiskit_experiments/library/characterization/t1.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ def _default_experiment_options(cls) -> Options:
214214
If not set, then ``num_xvals`` parameters spaced according to
215215
the ``spacing`` policy between ``min_xval`` and ``max_xval`` are used.
216216
If ``xvals`` is set, these parameters are ignored.
217+
service (IBMExperimentService): A valid experiment service instance that can
218+
provide the Stark coefficients for the qubit to run experiment.
219+
This is required only when ``stark_coefficients`` is ``latest`` and
220+
``xval_type`` is ``frequency``. This value is automatically set when
221+
a backend is attached to this experiment instance.
222+
stark_coefficients (Union[Dict, str]): Dictionary of Stark shift coefficients to
223+
convert tone amplitudes into amount of Stark shift. This dictionary must include
224+
all keys defined in :attr:`.StarkP1SpectAnalysis.stark_coefficients_names`,
225+
which are calibrated with :class:`.StarkRamseyXYAmpScan`.
226+
Alternatively, it searches for these coefficients in the result database
227+
when "latest" is set. This requires having the experiment service set in
228+
the experiment data to analyze.
217229
"""
218230
options = super()._default_experiment_options()
219231
options.update_options(
@@ -328,7 +340,7 @@ def _frequencies_to_amplitudes(self, params: np.ndarray) -> np.ndarray:
328340
if np.isclose(stark_shift, 0):
329341
amplitudes[idx] = 0
330342
continue
331-
elif np.sign(stark_shift) > 0:
343+
if np.sign(stark_shift) > 0:
332344
fit_coeffs = [*positive, -stark_shift]
333345
else:
334346
fit_coeffs = [*negative, -stark_shift]
@@ -353,7 +365,7 @@ def _frequencies_to_amplitudes(self, params: np.ndarray) -> np.ndarray:
353365
f"Stark shift at frequency value of {tgt_freq} Hz is not available on "
354366
f"the backend {self._backend_data.name} qubit {self.physical_qubits}."
355367
)
356-
elif len(valid_amps) > 1:
368+
if len(valid_amps) > 1:
357369
# We assume a monotonic trend but sometimes a large third-order term causes
358370
# inflection point and inverts the trend in larger amplitudes.
359371
# In this case we would have more than one solutions, but we can

test/library/characterization/test_stark_p1_spect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from test.base import QiskitExperimentsTestCase
1616

17-
from ddt import ddt, data, named_data, unpack
17+
from ddt import ddt, named_data, unpack
1818
import numpy as np
1919
from qiskit import pulse
2020
from qiskit.circuit import QuantumCircuit, Gate
@@ -313,6 +313,7 @@ def test_estimating_minmax_frequency(self, po1, po2, po3, no1, no2, no3, ferr):
313313
analysis = StarkP1SpectAnalysis()
314314

315315
coeffs = analysis.retrieve_coefficients_from_service(service, 0, "fake_hanoi")
316+
# pylint: disable=unbalanced-tuple-unpacking
316317
minf, maxf = analysis.estimate_minmax_frequencies(coeffs, (-0.9, 0.9))
317318

318319
amps = np.linspace(-0.9, 0.9, 101)

0 commit comments

Comments
 (0)