pygsti.data.freedataset

Defines the FreeformDataSet class and supporting classes and functions

Module Contents

Classes

FreeformDataSet

An association between Circuits and arbitrary data.

class pygsti.data.freedataset.FreeformDataSet(circuits=None, circuit_indices=None)

Bases: object

An association between Circuits and arbitrary data.

Parameters
  • circuits (list of (tuples or Circuits), optional) – Each element is a tuple of operation labels or a Circuit object. Indices for these strings are assumed to ascend from 0. These indices must correspond to the time series of spam-label indices (above). Only specify this argument OR circuit_indices, not both.

  • circuit_indices (ordered dictionary, optional) – An OrderedDict with keys equal to circuits (tuples of operation labels) and values equal to integer indices associating a row/element of counts with the circuit. Only specify this argument OR circuits, not both.

to_dataframe(self, pivot_valuename=None, pivot_value='Value', drop_columns=False)

Create a Pandas dataframe with the data from this free-form dataset.

Parameters
  • pivot_valuename (str, optional) – If not None, the resulting dataframe is pivoted using pivot_valuename as the column whose values name the pivoted table’s column names. If None and pivot_value is not None,`”ValueName”` is used.

  • pivot_value (str, optional) – If not None, the resulting dataframe is pivoted such that values of the pivot_value column are rearranged into new columns whose names are given by the values of the pivot_valuename column. If None and pivot_valuename is not None,`”Value”` is used.

  • drop_columns (bool or list, optional) – A list of column names to drop (prior to performing any pivot). If True appears in this list or is given directly, then all constant-valued columns are dropped as well. No columns are dropped when drop_columns == False.

Returns

pandas.DataFrame

__iter__(self)
__len__(self)
__contains__(self, circuit)

Test whether data set contains a given circuit.

Parameters

circuit (tuple or Circuit) – A tuple of operation labels or a Circuit instance which specifies the the circuit to check for.

Returns

bool – whether circuit was found.

__hash__(self)

Return hash(self).

__getitem__(self, circuit)
__setitem__(self, circuit, info_dict)
__delitem__(self, circuit)
keys(self)

Returns the circuits used as keys of this DataSet.

Returns

list – A list of Circuit objects which index the data counts within this data set.

items(self)

Iterator over (circuit, info_dict) pairs.

Returns

Iterator

values(self)

Iterator over info-dicts for each circuit.

Returns

Iterator

copy(self)

Make a copy of this FreeformDataSet.

Returns

DataSet