Skip to content

Commit

Permalink
Added stack level 2 to the warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MCruces-fz committed Apr 6, 2021
1 parent 4959384 commit 58e1993
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions invisible_cities/cities/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ def create_timestamp(rate: float) -> float:

if rate == 0:
warnings.warn("Zero rate is unphysical, using default "
"rate = 0.5 Hz instead")
"rate = 0.5 Hz instead", stacklevel=2)
rate = 0.5 * units.hertz
elif rate < 0:
warnings.warn(f"Negative rate is unphysical, using "
f"rate = {abs(rate) / units.hertz} Hz instead")
f"rate = {abs(rate) / units.hertz} Hz instead",
stacklevel=2)
rate = abs(rate)

def create_timestamp_(event_number: Union[int, float]) -> float:
Expand Down

0 comments on commit 58e1993

Please sign in to comment.