Skip to content

Commit

Permalink
warning into init
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq committed Mar 15, 2024
1 parent 2a1d8cb commit e8cba96
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions appletree/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def __init__(self, name: Optional[str] = None, llh_name: Optional[str] = None, *
if "bins" in kwargs.keys() and "bins_type" in kwargs.keys():
self.set_binning(**kwargs)

if self.bins_type != "meshgrid" and self.add_eps_to_hist:
warn(
"It is empirically dangerous to have add_eps_to_hist==True,\
when your bins_type is not meshgrid! It may lead to very bad fit with\
lots of eff==0."
)

def set_binning(self, **kwargs):
"""Set binning of component."""
if "bins" not in kwargs.keys() or "bins_type" not in kwargs.keys():
Expand Down Expand Up @@ -149,12 +156,6 @@ def implement_binning(self, mc, eff):
raise ValueError(f"Unsupported bins_type {self.bins_type}!")
if self.add_eps_to_hist:
# as an uncertainty to prevent blowing up
if self.bins_type != "meshgrid":
warn(
"It is empirically dangerous to have add_eps_to_hist==True,\
when your bins_type is not meshgrid! It may lead to very bad fit with\
lots of eff==0."
)
hist = jnp.clip(hist, 1.0, jnp.inf)
return hist

Expand Down

0 comments on commit e8cba96

Please sign in to comment.