Skip to content

Conversation

coreyostrove
Copy link
Contributor

@coreyostrove coreyostrove commented Aug 18, 2025

This PR consists of miscellaneous bug fixes and patches in preparation of the 0.9.14 release which were being caught by tests within the test_packages submodule (which are run against pushes to beta and master). Here is a brief summary:

  • Fixed bug in new logic for conversion of state preparation and POVMs to an error generator parameterization when using the 'statevec' evotype.
  • Added documentation to convert_members_inplace and set_default_gauge_group_for_member_type methods of the ExplicitModel class.
  • Updated default behavior of set_default_gauge_group_for_member_type for error generator parameterized models. Previously this was configured to set the default gauge group for such models to the TrivialGaugeGroup. Now we set this to be the UnitaryGaugeGroup, as one would more likely expect.
  • Fixed deserialization of older models from before the addition of serialized FOGI stores.
  • Fixed bug in the half diamond norm in pygsti.report.reportables related to a recent change in the return signature for the diamonddist function in optools.
  • Minor bugfixes for edge cases introduced in recent report generation changes (unbound variable names for a code branch, and whatnot).
  • Expired deprecations for legacy json and msgpack serialization interfaces. Some of the recent changes on develop broke some of the legacy serialization codepaths using json (note I am not referring to the newer json serialization support natively provided through the NicelySerializable interface) and msgpack. We formally deprecated this functionality just over two years and had these marked for removal, so any users who might've been using this have been getting warnings for some time. Rather than invest any time fixing this, it makes more sense to finally expire these deprecations.
  • New kwargs for controlling gauge optimization settings have been added to the GST driver functions run_long_sequence_gst and run_long_sequence_gst_base. At the same time the default gauge optimization suite used for these functions has been switched to 'stdgaugeopt'. This brings these functions in line with their OOP-based counterpart GateSetTomography which has used this gauge optimization suite as the default for a while.
  • Fixed a bug in the set_errorgen_coefficients method of ComposedOp to add handling for the cases where the update dictionary is empty, or has keys which do not match the ElementaryErrorgenLabel type of the modelmember.
  • Remove license field from pyproject.toml. See related commit message for more details, but TLDR not all versions of setuptools support properly this at the moment, which caused builds to fail on some versions of python we test against.
  • Test file artifacts for test_packages have been regenerated to account for recent default setting changes.
  • A bunch of unit tests have been updated to account for default setting changes.

With these updates we have the tests on beta now passing (at least when run locally on my system, TBD on runners).

Corey Ostrove added 18 commits August 15, 2025 18:24
Fix a bug in the conversion from unitary model members to error generator ones present in the new SPAM conversion logic. All that was needed here was to change the space for the to_dense calls so they were consistent. Additionally adds a docstring to convert_members_inplace and set_default_gauge_group for the explicit model class.
For set_default_gauge_group I have also changed the default behavior for the set_default_gauge_group function. Previously this would default to the TrivialGaugeGroup for all or most of the valid lindblad types. But in this case the unitary group is a better (though imperfect for edge cases) choice.
Partial patch for gauge optimization when using the statevec evotype that arises from difference in minimal reps for gauge group elements and operations.
There is an incompatibility between the statevec evotype and the representations used in gauge optimization. For now turn off gauge optimization on the GST tests which use the term forward simulator. Doing this most straightforwardly required adding a new option for the GST driver function.
Fix a bug in deserializing models saved before the recent changes to allow saving fogi stores.
Patch the diamond distance reportable function to account for a change to the return call signature for the diamond distance when returning the value of the SDP solution.
Some recent changes resulted in serialization using legacy json and msgpack serialization protocols breaking. This functionality has been deprecated for over two years, and so spending energy patching this doesn't make sense. Rather, this is as good a time as any to finally expire this deprecation.
Cleans up additional reference to the now expired legacy json and msgpack serialization protocols.
Add in casting logic to set_errorgen_coefficients when the input lindblad dictionary has label types which do not match the object being updated. Also add handling for edge case where the update dictionary is empty.
Change the default for run_long_sequence_gst's gauge optimization to use stdgaugeopt
Update the default gauge optimization settings of run_long_sequence_gst_base to match the non base counterpart.
Fix a small logic bug that meant certain dictionary values weren't be retained properly.
Minor patches to address some unbound variable name and related errors in color box plots, and some of type mismatches in the workspace tables.
Regenerate reference files for test_packages module to account for recent changes.
Update gauge optimization labels to account for recent default gauge optimization suite change. Turn off gauge optimization for model types which do not properly support it.
We're encountering CI issues with this field, and some googling indicates this is because there have been some changes to the conventions for this and not all versions of the build utilities (like setuptools) support these changes across all versions yet.
@coreyostrove coreyostrove self-assigned this Aug 18, 2025
@coreyostrove coreyostrove marked this pull request as ready for review August 18, 2025 21:02
@coreyostrove coreyostrove added this to the 0.9.14 milestone Aug 18, 2025
@rileyjmurray
Copy link
Contributor

rileyjmurray commented Aug 18, 2025

@coreyostrove I've triggered a CI build that runs the tests for beta and master, changed to target this branch:

https://github.com/sandialabs/pyGSTi/actions/runs/17054858542

If those tests pass then I'll approve. Makes more sense to go this route than have me review the individual changes.

Smx = s.transform_matrix; Si = s.transform_matrix_inverse
Tinv = _np.linalg.inv(self.factorops[0].to_dense("minimal"))
trans_eLT = _np.dot(Si, _np.dot(self.to_dense("minimal"), Smx))
Tinv = _np.linalg.inv(self.factorops[0].to_dense("HilbertSchmidt"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we limiting this hack for state_space.dim <= 16?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably just because it is expensive to perform the dense operations required with 3 or more qubits, but is faster than whatever other code path is used for 2Q and 3Q. This is incidentally not the biggest problem with this function at the moment, though. See #620 for more on that.

Corey Ostrove added 4 commits August 18, 2025 17:49
Revert changes from when I was debugging.
Something changed in some package which is producing np float objects which didn't have serialization logic in nameddict. Add a cast to standard python float.
Numpy 2.3 expired this deprecation for tostring.
@coreyostrove
Copy link
Contributor Author

The beta tests on the runners caught a couple extra issues that I didn't get locally. One was an expired deprecation of the tostring method in numpy 2.3. The other was related to serializing numpy float objects. I'm not sure what package/code changed that started producing numpy floats in some places, but this was just a single extra line in the serialization code to cast them to python floats.

@coreyostrove
Copy link
Contributor Author

Relaunched the beta tests with those extra patches (still need to fix the cython environment variable).

Corey Ostrove and others added 3 commits August 18, 2025 18:53
See if we can figure out why it is that the workflow is triggering the ubuntu and macos branch on windows.
Copy link
Contributor

@rileyjmurray rileyjmurray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI tests that still fail are due to how we're executing a command on Windows. I'm fine with merging as-is.

@coreyostrove
Copy link
Contributor Author

The CI tests that still fail are due to how we're executing a command on Windows. I'm fine with merging as-is.

Awesome, thanks! I'm going to keep plugging away at getting the workflow corrected for the no cython build on this branch and will merge it in once those are running correctly.

Corey Ostrove added 10 commits August 18, 2025 23:55
Realistically we probably don't need to run against all OS combinations to achieve the coverage goals of this particular build. Save on some resources.
Previous attempt was still running partial workflows on windows and macos.
And remove a couple unused imports from fogistore.py
Strip newlines and carriage returns from output before doing error checking.
Lower the maximum depth of the fisher information computation with instruments in unit test.

Also a miscellaneous workflow change.
Fix a bug related to a mismatch between current behavior of DataSet.gate_labels and target model labels.
@coreyostrove coreyostrove merged commit 05f3ab1 into develop Aug 21, 2025
24 of 28 checks passed
@coreyostrove coreyostrove deleted the bugfixes-914 branch August 21, 2025 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants