Skip to content

Commit

Permalink
current working FOGI
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonzalez De Mendoza committed Sep 6, 2023
1 parent f63f706 commit 2346391
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions pygsti/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ def collect_parameters(self, params_to_collect, new_param_label=None):

def uncollect_parameters(self, param_to_uncollect):
"""
Updates this model's parameters so that a common paramter becomes independent parameters.
Updates this model's parameters so that a common parameter becomes independent parameters.
The model's parameterization is modified so that each usage of the given parameter
in the model's parameterized operations is promoted to being a new independent
Expand Down Expand Up @@ -961,7 +961,6 @@ def _rebuild_paramvec(self):
newly_added_indices = None
#if M >= 0: # M == -1 signifies this object has no parameters, so we'll just leave `off` alone
# off = M + 1

#Update max_index_processed_so_far
max_gpindex = (obj.gpindices.stop - 1) if isinstance(obj.gpindices, slice) else max(obj.gpindices)
max_index_processed_so_far = max(max_index_processed_so_far, max_gpindex)
Expand Down Expand Up @@ -1023,19 +1022,13 @@ def _get_shift(j): return _bisect.bisect_left(indices_to_remove, j)
new_inds.append(i - _get_shift(i))
new_inds = _np.array(new_inds, _np.int64)
obj.set_gpindices(new_inds, self, memo)

wl = []
for obj_label, obj in self._iter_parameterized_objs():

print('labels: ', obj.parameter_labels)
for param_label in obj.parameter_labels:

print('label:', param_label)
wl.append(obj_label.__str__ ()+ ': ' + param_label)
print(obj_label.__str__ ()+ ': ' + param_label)
#wl.extend(zip(_itertools.repeat(obj_label.__str__(), len(obj.parameter_labels)), obj.parameter_labels))
wl = _np.asarray(wl, dtype=object)

wl.append((obj_label.__str__ (), param_label))
wl = _np.fromiter(wl, dtype=object,)
self._paramvec = self._ops_paramvec_to_model_paramvec(w)
self._paramlbls = self._ops_paramlbls_to_model_paramlbls(wl)
self._param_bounds = wb if _param_bounds_are_nontrivial(wb) else None
Expand Down
2 changes: 1 addition & 1 deletion pygsti/models/modelparaminterposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def ops_paramlbls_to_model_paramlbls(self, wl):

ret = []
for irow in range(self.inv_transform_matrix.shape[0]):
lbl = ' + '.join(["%g %s" % (coeff, str(lbl)) for coeff, lbl in zip(self.inv_transform_matrix[irow, :], wl) if _np.abs(coeff) > 1e-10])
lbl = ' + '.join(["%g %s" % (coeff, str(lbl[0]) +':' + str(lbl[1])) for coeff, lbl in zip(self.inv_transform_matrix[irow, :], wl) if _np.abs(coeff) > 1e-10])
ret.append(lbl)
return ret

Expand Down

0 comments on commit 2346391

Please sign in to comment.