Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,17 @@ def _default_options(cls):
"""Default analysis options."""
default_options = super()._default_options()
default_options.result_parameters = ["alpha", "alpha_c"]
default_options.bounds = {
"a": (0.0, 1.0),
"alpha": (0.0, 1.0),
"alpha_c": (0.0, 1.0),
"b": (0.0, 1.0),
}
return default_options

def _setup_fitting(self, **extra_options) -> Union[Dict[str, Any], List[Dict[str, Any]]]:
"""Fitter options."""
user_p0 = self._get_option("p0")
user_bounds = self._get_option("bounds")

user_p0_full = {}
for key in ["a", "alpha", "alpha_c", "b"]:
Expand All @@ -154,12 +159,7 @@ def _setup_fitting(self, **extra_options) -> Union[Dict[str, Any], List[Dict[str
"alpha_c": user_p0_full["alpha_c"] or min(p0_int["alpha"] / p0_std["alpha"], 1),
"b": user_p0_full["b"] or np.mean([p0_std["b"], p0_int["b"]]),
},
"bounds": {
"a": user_bounds["a"] or (0.0, 1.0),
"alpha": user_bounds["alpha"] or (0.0, 1.0),
"alpha_c": user_bounds["alpha_c"] or (0.0, 1.0),
"b": user_bounds["b"] or (0.0, 1.0),
},
"bounds": self._get_option("bounds"),
}
# p0 and bounds are defined in the default options, therefore updating
# with the extra options only adds options and doesn't override p0 or bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,18 @@ def _default_options(cls):
default_options.error_dict = None
default_options.epg_1_qubit = None
default_options.gate_error_ratio = None
default_options.bounds = {"a": (0.0, 1.0), "alpha": (0.0, 1.0), "b": (0.0, 1.0)}

return default_options

def _setup_fitting(self, **extra_options) -> Union[Dict[str, Any], List[Dict[str, Any]]]:
"""Fitter options."""
user_p0 = self._get_option("p0")
user_bounds = self._get_option("bounds")

curve_data = self._data()

initial_guess = self._initial_guess(curve_data.x, curve_data.y, self._num_qubits, user_p0)
fit_options = {
"p0": initial_guess,
"bounds": {
"a": user_bounds["a"] or (0.0, 1.0),
"alpha": user_bounds["alpha"] or (0.0, 1.0),
"b": user_bounds["b"] or (0.0, 1.0),
},
}
fit_options = {"p0": initial_guess, "bounds": self._get_option("bounds")}
# p0 and bounds are defined in the default options, therefore updating
# with the extra options only adds options and doesn't override p0 or bounds
fit_options.update(extra_options)
Expand Down