Skip to content
Snippets Groups Projects

Numba riddance

Merged Peter Lünenschloß requested to merge numbaRiddance into develop
1 file
+ 2
14
Compare changes
  • Side-by-side
  • Inline
+ 2
14
@@ -14,7 +14,6 @@ import sys
import warnings
from typing import Union
import numba as nb
import numpy as np
import numpy.polynomial.polynomial as poly
import pandas as pd
@@ -208,8 +207,6 @@ def maxGap(in_arr):
"""
return max(in_arr[0], max(np.diff(in_arr)))
@nb.njit
def _exceedConsecutiveNanLimit(arr, max_consec):
"""
Check if array has more consecutive NaNs than allowed.
@@ -226,17 +223,8 @@ def _exceedConsecutiveNanLimit(arr, max_consec):
exceeded: bool
True if more than allowed consecutive NaNs appear, False otherwise.
"""
current = 0
idx = 0
while idx < arr.size:
while idx < arr.size and arr[idx]:
current += 1
idx += 1
if current > max_consec:
return True
current = 0
idx += 1
return False
views = np.lib.stride_tricks.sliding_window_view(arr, window_shape=max_consec)
return np.isnan(views).all(axis=1).any()
def validationTrafo(data, max_nan_total, max_nan_consec):
Loading