Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Fix breaking attribute name change (#432)
Browse files Browse the repository at this point in the history
In #370 the name of the N_acc attribute was renamed to n_acc to adapt to
the pylint naming rules. However, this wwas neglecting that this
attribute was part of the API for the class, and people were using it as
N_acc. This commit reverts the breaking change and changes the name back
to N_acc.
  • Loading branch information
mtreinish authored Jun 24, 2020
1 parent 3b72172 commit 13133b0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions qiskit/ignis/verification/accreditation/fitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name


"""
Class for accreditation protocol
Expand Down Expand Up @@ -38,7 +40,7 @@ class AccreditationFitter:

bound = 1
confidence = 1
n_acc = 0
N_acc = 0
num_runs = 0
flag = 'accepted'
outputs = []
Expand Down Expand Up @@ -90,7 +92,7 @@ def single_protocol_run(self, results, postp_list, v_zero):
else:
output_target = count
if self.flag == 'accepted':
self.n_acc += 1
self.N_acc += 1
self.outputs.append(output_target)

def bound_variation_distance(self, theta):
Expand All @@ -101,12 +103,12 @@ def bound_variation_distance(self, theta):
Args:
theta (float): number between 0 and 1
"""
if self.n_acc == 0:
if self.N_acc == 0:
QiskitError("ERROR: Variation distance requires"
"at least one accepted run")
if self.n_acc/self.num_runs > theta:
if self.N_acc/self.num_runs > theta:
self.bound = self.g_num*1.7/(self.num_traps+1)
self.bound = self.bound/(self.n_acc/self.num_runs-theta)
self.bound = self.bound/(self.N_acc/self.num_runs-theta)
self.bound = self.bound+1-self.g_num
self.confidence = 1-2*np.exp(-2*theta*self.num_runs*self.num_runs)
if self.bound > 1:
Expand Down

0 comments on commit 13133b0

Please sign in to comment.