Example #1
0
 def test_no_gatestrings(self):
     ds = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset")
     L1 = pygsti.logl(std.gs_target, ds,
                      probClipInterval=(-1e6,1e6), countVecMx=None,
                      poissonPicture=True, check=False)
     self.assertAlmostEqual(L1, -4531934.43735, 2)
     L2 = pygsti.logl_max(ds)
     self.assertAlmostEqual(L2, -1329179.7675, 5)
Example #2
0
 def test_no_gatestrings(self):
     ds = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset")
     gateset = std.gs_target #could use pygsti.io.load_gateset(compare_files + "/analysis.gateset"), but then change hardcoded #'s
     L1 = pygsti.logl(gateset, ds,
                      probClipInterval=(-1e6,1e6), countVecMx=None,
                      poissonPicture=True, check=False)
     self.assertAlmostEqual(L1, -4531934.43735, 2)
     L2 = pygsti.logl_max(ds)
     self.assertAlmostEqual(L2, -1329179.7675, 5)
Example #3
0
    def test_logl_fn(self):
        ds          = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset")
        gatestrings = pygsti.construction.gatestring_list( [ ('Gx',), ('Gy',), ('Gx','Gx') ] )
        spam_labels = std.gs_target.get_spam_labels()
        pygsti.create_count_vec_dict( spam_labels, ds, gatestrings )
        gateset = pygsti.io.load_gateset(compare_files + "/analysis.gateset")

        L1 = pygsti.logl(gateset, ds, gatestrings,
                         probClipInterval=(-1e6,1e6), countVecMx=None,
                         poissonPicture=True, check=False)
        L2 = pygsti.logl(gateset, ds, gatestrings,
                         probClipInterval=(-1e6,1e6), countVecMx=None,
                         poissonPicture=False, check=False) #Non-poisson-picture

        dL1 = pygsti.logl_jacobian(gateset, ds, gatestrings,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=True, check=False)
        dL2 = pygsti.logl_jacobian(gateset, ds, gatestrings,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False)
        dL2b = pygsti.logl_jacobian(gateset, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as gs list


        hL1 = pygsti.logl_hessian(gateset, ds, gatestrings,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=True, check=False)

        hL2 = pygsti.logl_hessian(gateset, ds, gatestrings,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=False, check=False)
        hL2b = pygsti.logl_hessian(gateset, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as gs list


        maxL1 = pygsti.logl_max(ds, gatestrings, poissonPicture=True, check=True)
        maxL2 = pygsti.logl_max(ds, gatestrings, poissonPicture=False, check=True)

        pygsti.cptp_penalty(gateset, include_spam_penalty=True)
        twoDelta1 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=True)
        twoDelta2 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=False)
Example #4
0
    def test_logl_fn(self):
        ds          = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset%s" % self.versionsuffix)
        circuits = pygsti.construction.circuit_list( [ ('Gx',), ('Gy',), ('Gx','Gx') ] )
        #OLD spam_labels = std.target_model().get_spam_labels()
        #OLD pygsti.create_count_vec_dict( spam_labels, ds, circuits )
        model = pygsti.io.load_model(compare_files + "/analysis.model")

        L1 = pygsti.logl(model, ds, circuits,
                         probClipInterval=(-1e6,1e6),
                         poissonPicture=True, check=False)
        L2 = pygsti.logl(model, ds, circuits,
                         probClipInterval=(-1e6,1e6),
                         poissonPicture=False, check=False) #Non-poisson-picture

        dL1 = pygsti.logl_jacobian(model, ds, circuits,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=True, check=False)
        dL2 = pygsti.logl_jacobian(model, ds, circuits,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False)
        dL2b = pygsti.logl_jacobian(model, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as mdl list


        hL1 = pygsti.logl_hessian(model, ds, circuits,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=True, check=False)

        hL2 = pygsti.logl_hessian(model, ds, circuits,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=False, check=False)
        hL2b = pygsti.logl_hessian(model, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as mdl list


        maxL1 = pygsti.logl_max(model, ds, circuits, poissonPicture=True, check=True)
        maxL2 = pygsti.logl_max(model, ds, circuits, poissonPicture=False, check=True)

        pygsti.cptp_penalty(model, include_spam_penalty=True)
        twoDelta1 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=True)
        twoDelta2 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=False)
Example #5
0
    def test_logl_fn(self):
        ds          = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset")
        gatestrings = pygsti.construction.gatestring_list( [ ('Gx',), ('Gy',), ('Gx','Gx') ] )
        spam_labels = std.gs_target.get_spam_labels()
        pygsti.create_count_vec_dict( spam_labels, ds, gatestrings )

        L1 = pygsti.logl(std.gs_target, ds, gatestrings,
                         probClipInterval=(-1e6,1e6), countVecMx=None,
                         poissonPicture=True, check=False)
        L2 = pygsti.logl(std.gs_target, ds, gatestrings,
                         probClipInterval=(-1e6,1e6), countVecMx=None,
                         poissonPicture=False, check=False) #Non-poisson-picture

        dL1 = pygsti.logl_jacobian(std.gs_target, ds, gatestrings,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=True, check=False)
        dL2 = pygsti.logl_jacobian(std.gs_target, ds, gatestrings,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False)
        dL2b = pygsti.logl_jacobian(std.gs_target, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as gs list


        hL1 = pygsti.logl_hessian(std.gs_target, ds, gatestrings,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=True, check=False)

        hL2 = pygsti.logl_hessian(std.gs_target, ds, gatestrings,
                                  probClipInterval=(-1e6,1e6), radius=1e-4,
                                  poissonPicture=False, check=False)
        hL2b = pygsti.logl_hessian(std.gs_target, ds, None,
                                   probClipInterval=(-1e6,1e6), radius=1e-4,
                                   poissonPicture=False, check=False) #test None as gs list


        maxL1 = pygsti.logl_max(ds, gatestrings, poissonPicture=True, check=True)
        maxL2 = pygsti.logl_max(ds, gatestrings, poissonPicture=False, check=True)

        pygsti.cptp_penalty(std.gs_target, include_spam_penalty=True)
        twoDelta1 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=True)
        twoDelta2 = pygsti.two_delta_loglfn(N=100, p=0.5, f=0.6, minProbClip=1e-6, poissonPicture=False)
Example #6
0
 def test_no_gatestrings(self):
     ds = pygsti.objects.DataSet(fileToLoadFrom=compare_files + "/analysis.dataset%s" % self.versionsuffix)
     gateset = std.gs_target #could use pygsti.io.load_gateset(compare_files + "/analysis.gateset"), but then change hardcoded #'s
     L1 = pygsti.logl(gateset, ds,
                      probClipInterval=(-1e6,1e6),
                      poissonPicture=True, check=False)
     self.assertAlmostEqual(L1,-21393568.52986, 2)
     #self.assertAlmostEqual(L1,-21579292.1837, 2) #OLD2
     #self.assertAlmostEqual(L1, -4531934.43735, 2) #OLD
     
     L2 = pygsti.logl_max(gateset, ds)
     
     self.assertAlmostEqual(L2, -14028782.1039, 2)