feat(filters): add NET - Ehlers Noise Elimination Technology (TASC Dec 2020)

This commit is contained in:
Miha Kralj
2026-03-17 14:38:31 -07:00
parent f7dcc20f7c
commit 8112009b32
14 changed files with 1092 additions and 0 deletions
+1
View File
@@ -558,6 +558,7 @@ HAS_CHEBY1 = _bind("qtl_cheby1", [_dp, _ci, _dp, _ci, _cd])
HAS_CHEBY2 = _bind("qtl_cheby2", [_dp, _ci, _dp, _ci, _cd])
HAS_ELLIPTIC = _bind("qtl_elliptic", [_dp, _ci, _dp, _ci])
HAS_EDCF = _bind("qtl_edcf", [_dp, _ci, _dp, _ci])
HAS_NET = _bind("qtl_net", [_dp, _ci, _dp, _ci])
HAS_BPF = _bind("qtl_bpf", [_dp, _ci, _dp, _ci, _ci])
HAS_ALAGUERRE = _bind("qtl_alaguerre", [_dp, _ci, _dp, _ci, _ci])
HAS_BILATERAL = _bind("qtl_bilateral", [_dp, _ci, _dp, _ci, _cd, _cd])
+9
View File
@@ -38,6 +38,7 @@ __all__ = [
"cheby2",
"elliptic",
"edcf",
"net",
"bpf",
"alaguerre",
"bilateral",
@@ -377,6 +378,14 @@ def edcf(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
return _wrap(dst, idx, f"EDCF_{period}", "filters", offset)
def net(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Ehlers Noise Elimination Technology."""
period = int(kwargs.get("length", period)); offset = int(offset)
src, idx = _arr(close); n = len(src); dst = _out(n)
_check(_lib.qtl_net(_ptr(src), n, _ptr(dst), period))
return _wrap(dst, idx, f"NET_{period}", "filters", offset)
def bpf(close: object, period: int = 14, bandwidth: int = 5,
offset: int = 0, **kwargs) -> object:
"""Bandpass Filter."""
+10
View File
@@ -1461,6 +1461,16 @@ public static unsafe partial class Exports
catch { return StatusCodes.QTL_ERR_INTERNAL; }
}
// Net: Pattern A (src, out, int period)
[UnmanagedCallersOnly(EntryPoint = "qtl_net")]
public static int QtlNet(double* src, int n, double* dst, int period)
{
int v = Chk1(src, dst, n); if (v != 0) return v;
v = ChkPeriod(period); if (v != 0) return v;
try { Net.Batch(Src(src, n), Dst(dst, n), period); return StatusCodes.QTL_OK; }
catch { return StatusCodes.QTL_ERR_INTERNAL; }
}
// ═══════════════════════════════════════════════════════════════════════
// §8.12 Cycles
// ═══════════════════════════════════════════════════════════════════════