From d5443247c0d03dbb71199d7d2a95539d2b87e1e1 Mon Sep 17 00:00:00 2001 From: Corey Ostrove Date: Tue, 20 Feb 2024 16:46:32 -0700 Subject: [PATCH] Log-likelihood hessian test modernization Switch from loading old models and datasets from disk to spinning these up from scratch. --- test/test_packages/tools/test_logl.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/test/test_packages/tools/test_logl.py b/test/test_packages/tools/test_logl.py index a4e75251d..8e73a9f1a 100644 --- a/test/test_packages/tools/test_logl.py +++ b/test/test_packages/tools/test_logl.py @@ -2,20 +2,36 @@ import psutil import pygsti +from pygsti.modelpacks import smq1Q_XY +import pygsti.protocols as proto from ..testutils import BaseTestCase, compare_files class LogLTestCase(BaseTestCase): def test_memory(self): + model = smq1Q_XY.target_model() + model = model.depolarize(spam_noise = .01, op_noise = .001) + model = model.rotate(max_rotate=.005, seed=1234) + + prep_fiducials = smq1Q_XY.prep_fiducials() + meas_fiducials = smq1Q_XY.meas_fiducials() + germs = smq1Q_XY.germs() + op_labels = list(model.operations.keys()) # also == std.gates + maxLengthList = [1] + #circuits for XY model. + gss = pygsti.circuits.make_lsgst_structs(op_labels, prep_fiducials[0:4], + meas_fiducials[0:3], smq1Q_XY.germs(), maxLengthList) + + edesign = proto.CircuitListsDesign([pygsti.circuits.CircuitList(circuit_struct) for circuit_struct in gss]) + + ds = pygsti.data.simulate_data(model, edesign.all_circuits_needing_data, 1000, seed = 1234) + def musage(prefix): p = psutil.Process(os.getpid()) print(prefix, p.memory_info()[0]) current_mem = pygsti.baseobjs.profiler._get_mem_usage - musage("Initial") - ds = pygsti.data.DataSet(file_to_load_from=compare_files + "/analysis.dataset") - model = pygsti.io.load_model(compare_files + "/analysis.model") musage("Pt1") with self.assertRaises(MemoryError):