Example #1
0
    def _test_gateset_writeload(self, tmp_path, param):
        mdl = std.target_model()
        mdl.set_all_parameterizations(param)
        io.write_model(mdl, tmp_path)

        gs2 = stdin.read_model(tmp_path)
        self.assertAlmostEqual(mdl.frobeniusdist(gs2), 0.0)
        for lbl in mdl.operations:
            self.assertEqual(type(mdl.operations[lbl]),
                             type(gs2.operations[lbl]))
        for lbl in mdl.preps:
            self.assertEqual(type(mdl.preps[lbl]), type(gs2.preps[lbl]))
        for lbl in mdl.povms:
            self.assertEqual(type(mdl.povms[lbl]), type(gs2.povms[lbl]))
        for lbl in mdl.instruments:
            self.assertEqual(type(mdl.instruments[lbl]),
                             type(gs2.instruments[lbl]))
Example #2
0
    def test_stdpractice_gst_file_args(self, ds_path, model_path,
                                       fiducial_path, germ_path):
        io.write_dataset(ds_path, self.ds, self.lsgstStrings[-1])
        io.write_model(self.model, model_path)
        io.write_circuit_list(fiducial_path, self.fiducials)
        io.write_circuit_list(germ_path, self.germs)

        result = ls.do_stdpractice_gst(ds_path,
                                       model_path,
                                       fiducial_path,
                                       fiducial_path,
                                       germ_path,
                                       self.maxLens,
                                       modes="TP",
                                       comm=None,
                                       memLimit=None,
                                       verbosity=5)
Example #3
0
    def test_long_sequence_gst_with_file_args(self, ds_path, model_path,
                                              fiducial_path, germ_path):
        io.write_dataset(ds_path, self.ds, self.lsgstStrings[-1])
        io.write_model(self.model, model_path)
        io.write_circuit_list(fiducial_path, self.fiducials)
        io.write_circuit_list(germ_path, self.germs)

        self.options.update(randomizeStart=1e-6,
                            profile=2,
                            verbosity=10,
                            memoryLimitInBytes=2 * 1000**3)
        result = ls.do_long_sequence_gst(ds_path,
                                         model_path,
                                         fiducial_path,
                                         fiducial_path,
                                         germ_path,
                                         self.maxLens,
                                         advancedOptions=self.options)
Example #4
0
    def test_long_sequence_gst_with_file_args(self, ds_path, model_path,
                                              fiducial_path, germ_path):
        io.write_dataset(ds_path, self.ds, self.lsgstStrings[-1])
        io.write_model(self.model, model_path)
        io.write_circuit_list(fiducial_path, self.fiducials)
        io.write_circuit_list(germ_path, self.germs)

        self.options.update(
            randomize_start=1e-6,
            profile=2,
        )
        result = ls.run_long_sequence_gst(ds_path,
                                          model_path,
                                          fiducial_path,
                                          fiducial_path,
                                          germ_path,
                                          self.maxLens,
                                          advanced_options=self.options,
                                          verbosity=10)
Example #5
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)