def test_getters(self): comparator = dc.DataComparator([self.DS_0, self.DS_1]) comparator.run(significance=0.05) # XXX do these need unit tests? EGN: maybe not - could ask Kenny mdl = list(self.DS_0.keys())[10] comparator.jsd(mdl) comparator.jsd_pseudothreshold comparator.llr(mdl) comparator.llr_pseudothreshold comparator.ssjsd(mdl) comparator.sstvd(mdl) comparator.tvd(mdl) comparator.aggregate_llr comparator.aggregate_llr_threshold comparator.aggregate_nsigma comparator.aggregate_pvalue comparator.aggregate_pvalue_threshold comparator.maximum_sstvd comparator.pvalue(mdl) comparator.pvalue_pseudothreshold comparator.worst_circuits(10)
def test_pass_stability(self, formatdata=False, verbosity=1): assert(self.multids is not None), \ "Can only run the stability analysis if a MultiDataSet is contained in this Benchmarker!" if not formatdata: assert ('success-fail' in self.multids.keys( )), "Must have generated/imported a success-fail format DataSet!" else: if 'success-fail' not in self.multids.keys(): if verbosity > 0: print( "No success/fail dataset found, so first creating this dataset from the full data...", end='') self.generate_success_or_fail_dataset() if verbosity > 0: print("complete.") if len(self.multids['success-fail']) > 1: self.dscomparator = _dcomp.DataComparator( self.multids['success-fail'], allow_bad_circuits=True) self.dscomparator.run(verbosity=verbosity)
def test_construction_raises_on_op_sequence_mismatch(self): DS_bad = DataSet(outcome_labels=['0', '1']) # order ok... DS_bad.add_count_dict(('Gx',), {'0': 10, '1': 90}) DS_bad.done_adding_data() with self.assertRaises(ValueError): dc.DataComparator([self.DS_0, DS_bad])
def test_construction_raises_on_bad_ds_names(self): with self.assertRaises(ValueError): dc.DataComparator([self.DS_0, self.DS_1], ds_names=["foobar"])
def test_implement_multidataset(self): mds = MultiDataSet(outcome_labels=[('0',),('1',)]) mds.add_dataset('D0', self.DS_0) mds.add_dataset('D1', self.DS_1) comparator = dc.DataComparator(mds) comparator.run(significance=0.05)
def test_implement_inclusive(self): comparator = dc.DataComparator([self.DS_0, self.DS_1], op_inclusions=['Gi'], ds_names=['D0', 'D1']) comparator.run(significance=0.05)
def test_implement(self): comparator = dc.DataComparator([self.DS_0, self.DS_1]) comparator.run(significance=0.05)