Ejemplo n.º 1
0
 def test_stdpractice_gst_gaugeOptTarget_warns_on_target_override(self):
     myGaugeOptSuiteDict = {
         'MyGaugeOpt': {
             'item_weights': {
                 'gates': 1,
                 'spam': 0.0001
             },
             'target_model': self.
             pspec  # to test overriding internal target model (prints a warning)
         }
     }
     with self.assertWarns(Warning):
         target_model = create_explicit_model(self.pspec,
                                              ideal_gate_type='static')
         result = ls.run_stdpractice_gst(self.ds,
                                         target_model,
                                         self.fiducials,
                                         self.fiducials,
                                         self.germs,
                                         self.maxLens,
                                         modes="full TP",
                                         gaugeopt_suite=myGaugeOptSuiteDict,
                                         gaugeopt_target=self.mdl_guess,
                                         comm=None,
                                         mem_limit=None,
                                         verbosity=5)
Ejemplo n.º 2
0
 def test_stdpractice_gst_raises_on_bad_mode(self):
     target_model = create_explicit_model(self.pspec,
                                          ideal_gate_type='static')
     with self.assertRaises(ValueError):
         result = ls.run_stdpractice_gst(self.ds,
                                         target_model,
                                         self.fiducials,
                                         self.fiducials,
                                         self.germs,
                                         self.maxLens,
                                         modes="Foobar")
Ejemplo n.º 3
0
 def test_stdpractice_gst_TP(self):
     result = ls.run_stdpractice_gst(
         self.ds,
         self.pspec,
         self.fiducials,
         self.fiducials,
         self.germs,
         self.maxLens,
         modes="full TP",
         models_to_test={"Test": self.mdl_guess},
         comm=None,
         mem_limit=None,
         verbosity=5)
Ejemplo n.º 4
0
 def test_stdpractice_gst_pickle_output(self):
     with BytesIO() as pickle_stream:
         target_model = create_explicit_model(self.pspec,
                                              ideal_gate_type='static')
         result = ls.run_stdpractice_gst(self.ds,
                                         target_model,
                                         self.fiducials,
                                         self.fiducials,
                                         self.germs,
                                         self.maxLens,
                                         modes="Target",
                                         output_pkl=pickle_stream)
         self.assertTrue(len(pickle_stream.getvalue()) > 0)
Ejemplo n.º 5
0
 def test_stdpractice_gst_advanced_options(self):
     target_model = create_explicit_model(self.pspec,
                                          ideal_gate_type='static')
     result = ls.run_stdpractice_gst(
         self.ds,
         target_model,
         self.fiducials,
         self.fiducials,
         self.germs,
         self.maxLens,
         modes="full TP",
         comm=None,
         mem_limit=None,
         advanced_options={
             'all': {
                 'objective': 'chi2',
                 'bad_fit_threshold':
                 -100,  # so we create a robust estimate and convey guage opt to it.
                 'on_bad_fit': ["robust"]
             }
         },
         verbosity=5)
Ejemplo n.º 6
0
 def test_stdpractice_gst_gaugeOptTarget(self):
     myGaugeOptSuiteDict = {
         'MyGaugeOpt': {
             'item_weights': {
                 'gates': 1,
                 'spam': 0.0001
             }
         }
     }
     target_model = create_explicit_model(self.pspec,
                                          ideal_gate_type='static')
     result = ls.run_stdpractice_gst(self.ds,
                                     target_model,
                                     self.fiducials,
                                     self.fiducials,
                                     self.germs,
                                     self.maxLens,
                                     modes="full TP",
                                     gaugeopt_suite=myGaugeOptSuiteDict,
                                     gaugeopt_target=self.mdl_guess,
                                     comm=None,
                                     mem_limit=None,
                                     verbosity=5)
Ejemplo n.º 7
0
    def test_stdpractice_gst_file_args(self, ds_path, model_path,
                                       fiducial_path, germ_path):
        import pickle
        #io.write_model(self.model, model_path)
        io.write_dataset(ds_path, self.ds, self.lsgstStrings[-1])
        io.write_circuit_list(fiducial_path, self.fiducials)
        io.write_circuit_list(germ_path, self.germs)
        target_model = create_explicit_model(self.pspec,
                                             ideal_gate_type='static')
        io.write_model(target_model, model_path)
        #with open(model_path, 'wb') as f:
        #    pickle.dump(target_model, f)

        result = ls.run_stdpractice_gst(ds_path,
                                        model_path,
                                        fiducial_path,
                                        fiducial_path,
                                        germ_path,
                                        self.maxLens,
                                        modes="full TP",
                                        comm=None,
                                        mem_limit=None,
                                        verbosity=5)