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

Bring Tutorial and Example Notebooks Back Up-to-Date #317

Closed
9 of 11 tasks
coreyostrove opened this issue May 19, 2023 · 7 comments
Closed
9 of 11 tasks

Bring Tutorial and Example Notebooks Back Up-to-Date #317

coreyostrove opened this issue May 19, 2023 · 7 comments
Labels
enhancement Request for a new feature or a change to an existing feature
Milestone

Comments

@coreyostrove
Copy link
Contributor

coreyostrove commented May 19, 2023

A number of our tutorial notebooks have fallen out of date with respect to the most recent feature sets in pygsti and are in need of either a refresh, or in some cases the creation of new tutorial and example notebooks. Examples of subjects that might need some TLC:

  • Experiment design construction tutorials (for using/explaining new germ, fiducial and FPR tools). Maybe a new tutorial on using the fisher information to evaluate experiment designs.
  • Fitting error rates models to volumetric benchmarking data vis-a-vis this paper (https://arxiv.org/pdf/2305.08796.pdf)
  • New weak simulation capabilities, Kraus operator representations and Qibo integration(?).
  • Serialization using MongoDB
  • Single parameter wildcard models
  • Parity POVM example
  • Specifying reduced error generator models using new coefficient block interface.
  • etc.

We'll also want to keep on top of making new tutorial and example notebooks as we integrate new capabilities in preparation for the next release.


Editing to keep track of progress of subfixes. Checked boxes here means the fix is pushed up to the bugfix-example-updates branch.

I am specifically keeping the "New weak simulation capabilities, Kraus operator representations and Qibo integration(?)" out of Jupyter notebooks for now. I consider this an alpha feature and purposefully do not want to advertise this yet.

@nemill
Copy link

nemill commented Jun 6, 2023

A potential tutorial issue, very minor, in "01-Esssential-Objects"

The note above a given cell says:
Another thing to note is that DataSet objects are "sparse" in that 0-counts are not typically stored:

Cell code:
c = Circuit([('Gxpi2',0)], line_labels=(0,1))
print("No 01 or 11 outcomes here: ",ds_fake[c])
for outlbl, cnt in ds_fake[c].counts.items():
print("Item: ",outlbl, cnt) # Note: this loop never loops over 01 or 11!

Output:
No 01 or 11 outcomes here: {('00',): 45.0, ('01',): 0.0, ('10',): 55.0, ('11',): 0.0}
Item: ('00',) 45.0
Item: ('01',) 0.0
Item: ('10',) 55.0
Item: ('11',) 0.0

Issue/Expected Result:
It seems from the comment that the 01 and 11 outcomes should not be printing, yet they are. I'm unsure if this is an artifact of my specific environment, or of modifications made in recent pyGSTi versions.

Environment:
pyGSTi version 0.9.11.1
python version 3.10.9
OS - Windows 11

@nemill
Copy link

nemill commented Jun 6, 2023

Minor typos in tutorial 02-Using-Essential-Objects

(1) Randomized benchmarking section:
"More more details on using these protocols..."

(2) Data Comparison Tests section:
The output of the following code:
print("\nCompare two inconsistent DataSets (generated from different model)")
comparator_A1_B = pygsti.data.DataComparator([dsA1,dsB])
comparator_A1_B.run(significance=0.05)

produces the output lines:
Compare two inconsistent DataSets (generated from different model)
The data are INCONSISTENT at 5.00% significance.

  • Details:
    • The aggregate log-_likelihood ratio test is significant at 15.45 standard deviations.
    • The aggregate log-_likelihood ratio test standard deviations signficance threshold is 2.02

The "log-_likelihood" notation seems unintended - either "-" or "_". Presumably this extends to the data comparator output functions as a whole, not just to this tutorial.

@nemill
Copy link

nemill commented Jun 7, 2023

Typo and Deprecated Code Warnings in "00-Protocols" tutorial

Typo:
In Randomized Benchmarking text, missing parenthesis after the word tutorial in this sentence: "To create the experiment design, the user specifies a QubitProcessorSpec object that describes the quantum processor (see the ProcessorSpec tutorial, ..."

Various warnings from deprecated code:
Environment:
pyGSTi version 0.9.11.1
python version 3.10.9
OS - Windows 11

Gate Set Tomography:

from pygsti.modelpacks import smq1Q_XYI

# get experiment design
exp_design = smq1Q_XYI.create_gst_experiment_design(max_max_length=32)  

# write an empty data object (creates a template to fill in)
pygsti.io.write_empty_protocol_data('tutorial_files/test_gst_dir', exp_design, clobber_ok=True)

# fill in the template with simulated data (you would run the experiment and use actual data)
pygsti.io.fill_in_empty_dataset_with_fake_data(
    "tutorial_files/test_gst_dir/data/dataset.txt",
    smq1Q_XYI.target_model().depolarize(op_noise=0.01, spam_noise=0.001),
    num_samples=1000, seed=1234)

# load the data object back in, now with the experimental data
data = pygsti.io.read_data_from_dir('tutorial_files/test_gst_dir')

# run the GST protocol on the data 
results = pygsti.protocols.StandardGST().run(data)

# create a report
report = pygsti.report.construct_standard_report(
    results, title="GST Overview Tutorial Example Report")
report.write_html("tutorial_files/gettingStartedReport")

Warning Message
C:\Users\nemill\pyGSTi\pygsti\modelmembers\operations\lindbladerrorgen.py:1691: UserWarning: Using 'CPTP' as a Lindblad type is deprecated, and you should now use 'CPTPLND'
_warnings.warn("Using 'CPTP' as a Lindblad type is deprecated, and you should now use 'CPTPLND'")

RPE:
Code Block

# An experiment design
from pygsti.modelpacks import smq1Q_Xpi2_rpe, smq1Q_XYI
exp_design = smq1Q_Xpi2_rpe.create_rpe_experiment_design(max_max_length=64)

# write an empty data object (creates a template to fill in)
pygsti.io.write_empty_protocol_data(exp_design, 'tutorial_files/test_rpe_dir', clobber_ok=True)

# fill in the template with simulated data (you would run the experiment and use actual data)
pygsti.io.fill_in_empty_dataset_with_fake_data(
    "tutorial_files/test_rpe_dir/data/dataset.txt",
    smq1Q_XYI.target_model().depolarize(op_noise=0.01, spam_noise=0.1),
    num_samples=1000, seed=1234)

# read the data object back in, now with the experimental data
data = pygsti.io.read_data_from_dir('tutorial_files/test_rpe_dir/')

# Run the RPE Protocol
results = pygsti.protocols.rpe.RobustPhaseEstimation().run(data)

print(results.angle_estimate)

Warning Message
C:\Users\nemill\pyGSTi\pygsti\io\writers.py:508: UserWarning:
write_empty_protocol_data has recently changed its signature - it looks like you need to swap the first two arguments. Continuing using the old signature...

@nemill
Copy link

nemill commented Jul 1, 2023

In "Custom Operator" tutorial (Tutorials/objects/advanced/CustomOperator.ipynb):
Broken link in the cell:
"We'll add a MyXPi2Operator instance as the "Gx" gate in pyGSTi's standard {Idle,𝑋(𝜋/2),𝑌(𝜋/2)} model (see the standard modules tutorial for more information on standard models)."

The link attempts to direct to Tutorials/Objects/Advanced/StandardModules.ipynb which no longer exists or has been moved. This could have possibly been renamed as ModelPacks.ipynb in the same directory.

@kmrudin
Copy link
Contributor

kmrudin commented Jul 12, 2023

(H/T @nemill) In "Custom Operator" tutorial (Tutorials/objects/advanced/CustomOperator.ipynb), there is a sign error in the definition of the quantity c (In[1], line 25). We can also make both the b and c quantities easier to parse via trig identities. We should replace In[1], lines 25 and 26 (in the from_vector method definition) with

b = a*np.sin(2*theta)
c = a*np.cos(2*theta)

@sserita
Copy link
Contributor

sserita commented Aug 11, 2023

Hi all, thanks for the bug reports here!

Edit: This used to be a checklist but I moved to the original comment so that we can keep track of the subfixes at a glance from the Issues page.

@sserita sserita modified the milestones: 0.9.13, 0.9.12.1 Nov 29, 2023
@sserita sserita modified the milestones: 0.9.12.1, 0.9.13 Jan 30, 2024
@sserita sserita modified the milestones: 0.9.13, 0.9.12.2 Mar 26, 2024
@sserita
Copy link
Contributor

sserita commented Apr 4, 2024

I added wildcard and procedural error bar tutorials in 49fc6c6, and am deeming the other items as still experimental enough that we can handle them at a later time. Given the impending slew of changes to tutorials, I'm closing this issue and we will inevitably open another one of these in the future.

@sserita sserita closed this as completed Apr 4, 2024
@sserita sserita added the fixed-but-not-in-release-yet Bug has been fixed, but isn't in an official release yet (just exists on a development branch) label Apr 4, 2024
@sserita sserita removed the fixed-but-not-in-release-yet Bug has been fixed, but isn't in an official release yet (just exists on a development branch) label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for a new feature or a change to an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants