Skip to content

Commit

Permalink
supress warnings about inaccurate IIR filtering after 10 of them, war…
Browse files Browse the repository at this point in the history
…n users about timestamp resolution.

fix warning about unrecognized extra arguments when there is no synthetic input function.
  • Loading branch information
tobidelbruck committed Oct 6, 2022
1 parent f7ae803 commit 565f699
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion v2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def main():

# check to make sure there are no other arguments that might be bogus misspelled arguments in case
# we don't have synthetic input class to pass these to
if synthetic_input_instance is None and not other_args is None:
if synthetic_input_instance is None and len(other_args)>0:
logger.error(f'There is no synthetic input class specified but there are extra arguments {other_args} that are probably incorrect')
v2e_quit(1)

Expand Down
11 changes: 10 additions & 1 deletion v2ecore/emulator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
logger = logging.getLogger(__name__)



def lin_log(x, threshold=20):
"""
linear mapping + logarithmic mapping.
Expand Down Expand Up @@ -84,7 +85,13 @@ def low_pass_filter(
eps = inten01*(delta_time/tau)
max_eps = torch.max(eps)
if max_eps >0.3:
logger.warning(f'IIR lowpass filter update has large maximum update eps={max_eps:.2f} from delta_time/tau={delta_time:.3g}/{tau:.3g}')
IIR_MAX_WARNINGS = 10
if low_pass_filter.iir_warning_count<IIR_MAX_WARNINGS:
logger.warning(f'IIR lowpass filter update has large maximum update eps={max_eps:.2f} from delta_time/tau={delta_time:.3g}/{tau:.3g}')
low_pass_filter.iir_warning_count+=1
if low_pass_filter.iir_warning_count==IIR_MAX_WARNINGS:
logger.warning(f'Supressing further warnings about inaccurate IIR lowpass filtering; check timestamp resolution and DVS photoreceptor cutoff frequency')

eps = torch.clamp(eps, max=1) # keep filter stable
else:
eps=delta_time/tau
Expand All @@ -101,6 +108,8 @@ def low_pass_filter(

return new_lp_log_frame

low_pass_filter.iir_warning_count=0


def subtract_leak_current(base_log_frame,
leak_rate_hz,
Expand Down

0 comments on commit 565f699

Please sign in to comment.