Removed error in smoothing function
This commit is contained in:
parent
8912cb145c
commit
417c1bd3d8
@ -34,6 +34,7 @@ __all__ = ['SmoothingType', 'smoothSpectralData', 'SmoothingWidth']
|
||||
|
||||
from enum import Enum, unique
|
||||
import bisect
|
||||
import copy
|
||||
import numpy as np
|
||||
|
||||
|
||||
@ -105,7 +106,9 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
|
||||
tr = 2 # truncate window after 2x std; shorter is faster and less accurate
|
||||
|
||||
# Safety
|
||||
MM = copy.deepcopy(M)
|
||||
Noct = sw.value[0]
|
||||
assert M, "Smoothing function: input array is empty"
|
||||
assert Noct > 0, "'Noct' must be absolute positive"
|
||||
if Noct < 1:
|
||||
raise Warning('Check if \'Noct\' is entered correctly')
|
||||
@ -120,9 +123,9 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
|
||||
L = M.shape[0] # number of data points
|
||||
|
||||
if st == SmoothingType.levels:
|
||||
P = 10**(M/10) # magnitude [dB] --> power
|
||||
P = 10**(MM/10) # magnitude [dB] --> power
|
||||
else:
|
||||
P = M # data already given as power
|
||||
P = MM # data already given as power
|
||||
# TODO: This does not work due to complex numbers. Should be split up in
|
||||
# magnitude and phase.
|
||||
# elif st == SmoothingType.tf:
|
||||
|
Loading…
Reference in New Issue
Block a user