diff --git a/pisa/core/container.py b/pisa/core/container.py index 7ede83f1f..a1cd0217f 100644 --- a/pisa/core/container.py +++ b/pisa/core/container.py @@ -125,10 +125,12 @@ def link_containers(self, key, names): % (set(names) - set(self.names)) ) containers = [self.__getitem__(name) for name in link_names] - logging.trace('Linking containers %s into %s'%(link_names, key)) - new_container = VirtualContainer(key, containers) - self.linked_containers.append(new_container) - + if len(containers) > 0: + logging.trace('Linking containers %s into %s'%(link_names, key)) + new_container = VirtualContainer(key, containers) + self.linked_containers.append(new_container) + else: + logging.warning("None of the containers exist, skipping %s"%(key)) def unlink_containers(self): """Unlink all container""" diff --git a/pisa/core/map.py b/pisa/core/map.py index bc35b048d..6845e21c2 100755 --- a/pisa/core/map.py +++ b/pisa/core/map.py @@ -1217,6 +1217,7 @@ def fluctuate(self, method, random_state=None, jumpahead=None): loc=orig_hist[valid_mask], scale=sigma[valid_mask], random_state=random_state ) + gauss = np.clip(gauss, a_min=0, a_max=None) hist_vals = np.empty_like(orig_hist, dtype=np.float64) hist_vals[valid_mask] = poisson.rvs( diff --git a/pisa/stages/utils/kde.py b/pisa/stages/utils/kde.py index a09bd947e..669c82634 100644 --- a/pisa/stages/utils/kde.py +++ b/pisa/stages/utils/kde.py @@ -55,6 +55,7 @@ def __init__( coszen_name="reco_coszen", oversample=10, coszen_reflection=0.25, + adaptive=True, alpha=0.1, stack_pid=True, stash_hists=False, @@ -70,6 +71,7 @@ def __init__( self.oversample = int(oversample) self.coszen_reflection = float(coszen_reflection) self.alpha = float(alpha) + self.adaptive = adaptive self.stack_pid = stack_pid self.stash_hists = stash_hists self.stash_valid = False @@ -185,6 +187,7 @@ def apply_function(self): bw_method=self.bw_method, coszen_name=self.coszen_name, coszen_reflection=self.coszen_reflection, + adaptive=self.adaptive, alpha=self.alpha, oversample=self.oversample, use_cuda=False,