sandialabs / pyGSTi

A python implementation of Gate Set Tomography
http://www.pygsti.info
Apache License 2.0
132 stars 55 forks source link

Reparameterizing model doesn't propagate to model members dictionaries #367

Closed coreyostrove closed 7 months ago

coreyostrove commented 8 months ago

A BOGO special on the bugs uncovered by unit test refactors (I stumbled onto this when working through some problems related to #366 ). When reparameterizing a model using set_all_parameterizations this change in parameterization doesn't propagate to the default_param attribute of the model's various contained OrderedMemberDict objects (i.e. the values of model.preps, model.operations etc.). This attribute controls the casting behavior that is invoked when directly setting the value of an entry in an OrderedMemberDict when setting this value to a numpy array. E.g. if the value of default_param for this OrderedMemberDict is 'full TP' then directly setting the value of model.operations with an array will cast this array to a FullTPOp.

Here is a minimal working demonstration.

from pygsti.modelpacks import smq1Q_XY
test_model = smq1Q_XY.target_model('full TP')
print(test_model.preps.default_param)
test_model.set_all_parameterizations('full')
print(test_model.preps.default_param)

The above prints 'full TP' both times.

This feels like unexpected behavior to me, and I'd expect this change in parameterizations to propagate through but I'd be interested in hearing if the other devs have thoughts on this (e.g. are there any places where I might break things by changing this behavior).

Environment (please complete the following information):

sserita commented 8 months ago

I suspect that this is actually the reason for #365 also. So a BOGO on bug fixes when I fix that!

sserita commented 7 months ago

Closed with release of 0.9.12.