Skip to content

Commit

Permalink
modified annotated docstring for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
gluonhiggs committed Jan 30, 2025
1 parent 64f3d22 commit 00d62f1
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 37 deletions.
80 changes: 51 additions & 29 deletions mitiq/cdr/cdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,63 +34,81 @@
class ExecuteWithCdrKwargs(TypedDict):
method_select: Annotated[
str,
"Specifies the method used to select the \
non-Clifford gates to replace when constructing the near-Clifford \
training circuits. Can be 'uniform' or 'gaussian'.",
"""
Specifies the method used to select the
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.
""",
]
method_replace: Annotated[
str,
"Specifies the method used to replace the \
selected non-Clifford gates with a Clifford when constructing the \
near-Clifford training circuits. Can be 'uniform', 'gaussian', or \
'closest'.",
"""
Specifies the method used to replace the
selected non-Clifford gates with a Clifford when constructing the
near-Clifford training circuits. Can be 'uniform', 'gaussian', or
'closest'.
""",
]
sigma_select: Annotated[
float,
"Width of the Gaussian distribution used for \
method_select='gaussian'.",
"""
Width of the Gaussian distribution used for
``method_select='gaussian'``.
""",
]
sigma_replace: Annotated[
float,
"Width of the Gaussian distribution used for \
method_replace='gaussian'.",
"""
Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
""",
]
random_state: Annotated[int, "Seed for sampling."]


class MitigateExecutorKwargs(TypedDict):
method_select: Annotated[
str,
"Specifies the method used to select the \
non-Clifford gates to replace when constructing the near-Clifford \
training circuits. Can be 'uniform' or 'gaussian'.",
"""
Specifies the method used to select the
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.
""",
]
method_replace: Annotated[
str,
"Specifies the method used to replace the \
selected non-Clifford gates with a Clifford when constructing the \
near-Clifford training circuits. Can be 'uniform', 'gaussian', or \
'closest'.",
"""
Specifies the method used to replace the
selected non-Clifford gates with a Clifford when constructing the
near-Clifford training circuits. Can be 'uniform', 'gaussian', or
'closest'.
""",
]
sigma_select: Annotated[
float,
"Width of the Gaussian distribution used for \
method_select='gaussian'.",
"""
Width of the Gaussian distribution used for
method_select='gaussian'.
""",
]
sigma_replace: Annotated[
float,
"Width of the Gaussian distribution used for \
method_replace='gaussian'.",
"""
Width of the Gaussian distribution used for
method_replace='gaussian'.
""",
]
random_state: Annotated[int, "Seed for sampling."]


class CdrDecoratorKwargs(TypedDict):
method_select: Annotated[
str,
"Specifies the method used to select the \
non-Clifford gates to replace when constructing the near-Clifford \
training circuits. Can be 'uniform' or 'gaussian'.",
"""
Specifies the method used to select the
non-Clifford gates to replace when constructing the near-Clifford
training circuits. Can be 'uniform' or 'gaussian'.
""",
]
method_replace: Annotated[
str,
Expand All @@ -101,13 +119,17 @@ class CdrDecoratorKwargs(TypedDict):
]
sigma_select: Annotated[
float,
"Width of the Gaussian distribution used for \
method_select='gaussian'.",
"""
Width of the Gaussian distribution used for
``method_select='gaussian'``.
""",
]
sigma_replace: Annotated[
float,
"Width of the Gaussian distribution used for \
method_replace='gaussian'.",
"""
Width of the Gaussian distribution used
for ``method_replace='gaussian'``.
""",
]
random_state: Annotated[int, "Seed for sampling."]

Expand Down
24 changes: 16 additions & 8 deletions mitiq/cdr/clifford_training_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,34 @@
class GenerateTrainingCircuitsKwargs(TypedDict):
sigma_select: Annotated[
float,
"Width of the Gaussian distribution used for \
method_select='gaussian'",
"""
Width of the Gaussian distribution used for
method_select='gaussian'
""",
]
sigma_replace: Annotated[
float,
"Width of the Gaussian distribution used for \
method_replace='gaussian'",
"""
Width of the Gaussian distribution used for
method_replace='gaussian'
""",
]


class _MapToNearCliffordKwargs(TypedDict):
sigma_select: Annotated[
float,
"Width of the Gaussian distribution used for \
method_select='gaussian'",
"""
Width of the Gaussian distribution used for
method_select='gaussian'
""",
]
sigma_replace: Annotated[
float,
"Width of the Gaussian distribution used for \
method_replace='gaussian'",
"""
Width of the Gaussian distribution used for
method_replace='gaussian'
""",
]


Expand Down

0 comments on commit 00d62f1

Please sign in to comment.