From ce40c7b3f367fd79d4b8f59efeadd409d001449c Mon Sep 17 00:00:00 2001 From: MatteoRobbiati Date: Tue, 28 Jan 2025 22:16:11 +0100 Subject: [PATCH] fix: TensorNetworkResult error raising --- src/qibotn/result.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/qibotn/result.py b/src/qibotn/result.py index b140601..078f2e1 100644 --- a/src/qibotn/result.py +++ b/src/qibotn/result.py @@ -22,13 +22,22 @@ class TensorNetworkResult: self.measured_probabilities = {"default": self.measured_probabilities} def probabilities(self): + """Return calculated probabilities according to the given method.""" return self.measured_probabilities[self.prob_type] def frequencies(self): - return self.measures + """Return frequencies if a certain number of shots has been set.""" + if self.measures is None: + raise_error( + ValueError, + f"To access frequencies, circuit has to be executed with a given number of shots != None", + ) + else: + return self.measures def state(self): - if self.nqubits < 30: + """Return the statevector if the number of qubits is less than 30.""" + if self.nqubits < 20: return self.statevector else: raise_error(