Skip to content

Commit

Permalink
Add Radial Filter Improvement DC-component estimation for all orders …
Browse files Browse the repository at this point in the history
…where the 0 Hz bin is NaN

Signed-off-by: HaHeho <[email protected]>
  • Loading branch information
HaHeho committed Jan 10, 2022
1 parent cdce133 commit 715ffaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Version history
* Add option for fractional octave smoothing of magnitude spectra to `plot2D()`
* Fix Exp4 to replace removed `deg2rad` and `rad2deg` utility functions
* Add option to generate unlimited radial filters
* Add Radial Filter Improvement DC-component estimation for all orders where the 0 Hz bin is NaN

*v2021.2.4*
* Implement option to use real spherical harmonic basis functions
Expand Down
14 changes: 6 additions & 8 deletions sound_field_analysis/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,15 +611,13 @@ def rfi(dn, kernelSize=512, highPass=0.0):
if highPass:
kernelSize //= 2

# DC-component estimation
# DC-component estimation for all odd and orders where the 0 Hz bin is NaN
dn_diff = _np.abs(dn[:, 1] / dn[:, 2])
oddOrders = range(1, dn.shape[0], 2)
dn[oddOrders, 0] = (
-1j
* dn[oddOrders, 1]
* 2
* (sourceKernelSize / kernelSize)
* dn_diff[oddOrders]
odd_orders = range(1, dn.shape[0], 2)
nan_orders = _np.isnan(dn[:, 0])
nan_orders[odd_orders] = True
dn[nan_orders, 0] = (
-2j * sourceKernelSize / kernelSize * dn[nan_orders, 1] * dn_diff[nan_orders]
)

# transform into time domain
Expand Down

0 comments on commit 715ffaa

Please sign in to comment.