Skip to content
Snippets Groups Projects
Commit d5bc7891 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

nb: fix per-noise calibration tracking

This should fix a bug whereby individual noise calibrations were not being
tracked internally properly.
parent f1a6839f
No related branches found
No related tags found
No related merge requests found
Pipeline #124421 passed
...@@ -252,7 +252,8 @@ class Budget(Noise): ...@@ -252,7 +252,8 @@ class Budget(Noise):
# initialize all noise objects # initialize all noise objects
for nc in self.noises: for nc in self.noises:
name = self.__init_noise(nc, noises) name = self.__init_noise(nc, noises)
self._budget_noises.add(name) if name:
self._budget_noises.add(name)
# initialize common calibrations and add to all budget noises # initialize common calibrations and add to all budget noises
for cal in self.calibrations: for cal in self.calibrations:
self.__add_calibration(cal, self._budget_noises) self.__add_calibration(cal, self._budget_noises)
...@@ -274,21 +275,17 @@ class Budget(Noise): ...@@ -274,21 +275,17 @@ class Budget(Noise):
else: else:
noise = nc noise = nc
cals = [] cals = []
if noise_filt and noise not in noise_filt:
return
name = self.__add_noise(noise)
for cal in cals:
self.__add_calibration(cal, [noise])
return name
def __add_noise(self, noise):
noise_obj = noise( noise_obj = noise(
*self.args, *self.args,
**self.kwargs **self.kwargs
) )
name = noise_obj.name name = noise_obj.name
if noise_filt and name not in noise_filt:
return
logging.debug("init {}".format(noise_obj)) logging.debug("init {}".format(noise_obj))
self._noise_objs[name] = noise_obj self._noise_objs[name] = noise_obj
for cal in cals:
self.__add_calibration(cal, [name])
return name return name
def __add_calibration(self, cal, noises): def __add_calibration(self, cal, noises):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment