#!/usr/bin/env python # coding: utf-8 # # How to generate error bars for 2Q-GST # # In[1]: import pygsti import time #If we were using MPI # from mpi4py import MPI # comm = MPI.COMM_WORLD comm = None #Load the 2-qubit results (if you don't have this directory, run the 2Q-GST example) results = pygsti.io.load_results_from_dir("example_files/My2QExample", "StandardGST") #Set a memory limit print("Memory limit was = ", results.estimates['CPTP'].parameters.get('memLimit',"none given")) results.estimates['CPTP'].parameters['memLimit'] = 2.5*(1024.0)**3 # 2.5GB print("Memory limit is now = ", results.estimates['CPTP'].parameters['memLimit']) # In[2]: # error bars in reports require the presence of a fully-initialized # "confidence region factory" within the relevant Estimate object. # In most cases "fully-initialized" means that a Hessian has been # computed and projected onto the non-gauge space. start = time.time() # initialize a factory for the 'go0' gauge optimization within the 'default' estimate crfact = results.estimates['CPTP'].add_confidence_region_factory('stdgaugeopt', 'final') crfact.compute_hessian(comm=comm) #optionally use multiple processors crfact.project_hessian('intrinsic error') end = time.time() print("Total time=%f hours" % ((end - start) / 3600.0)) # Note above cell was executed for demonstration purposes, and was **keyboard-interrupted intentionally** since it would have taken forever on a single processor. # In[ ]: #write results back to disk results.write() # In[ ]: