Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom samplers, better collection, and better plotting to sinter #804

Merged
merged 27 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5813470
Rearrange sinter's pieces into sub packages
Strilanc Jul 27, 2024
7ad07b9
- Add sinter.Sampler and sinter.CompiledSampler
Strilanc Jul 27, 2024
b8703b9
- `sinter collect --processes` now defaults to `auto` if not specified
Strilanc Jul 27, 2024
f103255
- Add `sinter plot --point_label_func`
Strilanc Jul 27, 2024
44206e2
- Added 'perfectionist' sampler
Strilanc Jul 27, 2024
c2557a9
regen api docs
Strilanc Jul 27, 2024
be49478
fix gen
Strilanc Jul 27, 2024
07a56f7
Merge branch 'main' of github.com:quantumlib/Stim into sinter2
Strilanc Jul 27, 2024
1802b72
Show traditional error bars when only one data point is present
Strilanc Jul 30, 2024
1325e6b
- Add `sinter plot --preprocess_stats_func`
Strilanc Jul 30, 2024
da00d11
Add safety error when adding ambiguous strong id stats
Strilanc Jul 30, 2024
9cb172e
Add `sinter.TaskStats.with_edits`
Strilanc Jul 30, 2024
d524e60
Merge branch 'main' into sinter2
Strilanc Jul 30, 2024
0fdc850
Merge branch 'main' into sinter2
Strilanc Jul 31, 2024
c90d62d
Merge branch 'main' of github.com:quantumlib/Stim into sinter2
Strilanc Aug 3, 2024
a215126
Allow oversampling, fix json equality being tuple-vs-array sensitive
Strilanc Aug 6, 2024
351752d
Merge branch 'sinter2' of github.com:quantumlib/Stim into sinter2
Strilanc Aug 6, 2024
3283161
More fixes of comparisons when sorting
Strilanc Aug 6, 2024
a4574fb
soft error threshold, hopeful fixing
Strilanc Aug 7, 2024
4269062
Iter
Strilanc Aug 7, 2024
88c1e4e
test fix
Strilanc Aug 7, 2024
98b47e8
Believe the force
Strilanc Aug 7, 2024
7390e70
docstring for sinter plot group_func dict api, add curve sorting, fix…
m-mcewen Aug 13, 2024
eb837ce
Merge branch 'main' of github.com:quantumlib/Stim into sinter2
Strilanc Sep 3, 2024
842a378
regen docs
Strilanc Sep 10, 2024
94976e7
Merge branch 'main' of github.com:quantumlib/Stim into sinter2
Strilanc Sep 10, 2024
2938daa
Merge branch 'main' into sinter2
Strilanc Sep 10, 2024
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
24 changes: 23 additions & 1 deletion dev/gen_sinter_api_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ def main():
```
'''.strip())

replace_rules = []
for package in ['stim', 'sinter']:
p = __import__(package)
for name in dir(p):
x = getattr(p, name)
if isinstance(x, type) and 'class' in str(x):
desired_name = f'{package}.{name}'
if '._' in str(x):
bad_name = str(x).split("'")[1]
replace_rules.append((bad_name, desired_name))
lonely_name = desired_name.split(".")[-1]
for q in ['"', "'"]:
replace_rules.append(('ForwardRef(' + q + lonely_name + q + ')', desired_name))
replace_rules.append(('ForwardRef(' + q + desired_name + q + ')', desired_name))
replace_rules.append((q + desired_name + q, desired_name))
replace_rules.append((q + lonely_name + q, desired_name))
replace_rules.append(('ForwardRef(' + desired_name + ')', desired_name))
replace_rules.append(('ForwardRef(' + lonely_name + ')', desired_name))

for obj in objects:
print()
print(f'<a name="{obj.full_name}"></a>')
Expand All @@ -58,7 +77,10 @@ def main():
print(f'# (in class {".".join(obj.full_name.split(".")[:-1])})')
else:
print(f'# (at top-level in the sinter module)')
print('\n'.join(obj.lines))
for line in obj.lines:
for a, b in replace_rules:
line = line.replace(a, b)
print(line)
print("```")


Expand Down
13 changes: 1 addition & 12 deletions dev/util_gen_stub_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dataclasses
import sys
import types
from typing import Any
from typing import Optional, Iterator, List
Expand All @@ -9,6 +8,7 @@

keep = {
"__add__",
"__radd__",
"__eq__",
"__call__",
"__ge__",
Expand Down Expand Up @@ -224,17 +224,6 @@ def print_doc(*, full_name: str, parent: object, obj: object, level: int) -> Opt
text += '@abc.abstractmethod\n'
sig_name = f'{term_name}{inspect.signature(obj)}'
text += "\n".join(splay_signature(f"def {sig_name}:"))
text = text.replace('''ForwardRef('sinter.TaskStats')''', 'sinter.TaskStats')
text = text.replace('''ForwardRef('sinter.Task')''', 'sinter.Task')
text = text.replace('''ForwardRef('sinter.Progress')''', 'sinter.Progress')
text = text.replace('''ForwardRef('sinter.Decoder')''', 'sinter.Decoder')
text = text.replace("'AnonTaskStats'", "sinter.AnonTaskStats")
text = text.replace('sinter._decoding_decoder_class.CompiledDecoder', 'sinter.CompiledDecoder')
text = text.replace("'AnonTaskStats'", "sinter.AnonTaskStats")
text = text.replace("'stim.Circuit'", "stim.Circuit")
text = text.replace("'stim.DetectorErrorModel'", "stim.DetectorErrorModel")
text = text.replace("'sinter.CollectionOptions'", "sinter.CollectionOptions")
text = text.replace("'sinter.Fit'", 'sinter.Fit')

# Replace default value lambdas with their source.
if 'lambda' in str(text):
Expand Down
1 change: 1 addition & 0 deletions doc/python_api_reference_vDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,7 @@ def diagram(
*,
tick: Union[None, int, range] = None,
filter_coords: Iterable[Union[Iterable[float], stim.DemTarget]] = ((),),
rows: int | None = None,
) -> 'stim._DiagramHelper':
"""Returns a diagram of the circuit, from a variety of options.

Expand Down
Loading
Loading