Skip to content

Commit

Permalink
Migrate away from removed numpy.math
Browse files Browse the repository at this point in the history
This was just a wrapper for the python stdlib math anyway, so nothing
was lost. Also I checked and numpy does not provide a factorial function.
  • Loading branch information
mweinelt committed Jan 5, 2025
1 parent 74a13c6 commit 2c22e97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions asteroid_filterbanks/multiphase_gammatone_fb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
import numpy as np
import torch
from .enc_dec import Filterbank
Expand Down Expand Up @@ -87,8 +88,8 @@ def gammatone_impulse_response(samplerate_hz, len_sec, center_freq_hz, phase_shi
""" Generate single parametrized gammatone filter """
p = 2 # filter order
erb = 24.7 + 0.108 * center_freq_hz # equivalent rectangular bandwidth
divisor = (np.pi * np.math.factorial(2 * p - 2) * np.power(2, float(-(2 * p - 2)))) / np.square(
np.math.factorial(p - 1)
divisor = (np.pi * math.factorial(2 * p - 2) * np.power(2, float(-(2 * p - 2)))) / np.square(
math.factorial(p - 1)
)
b = erb / divisor # bandwidth parameter
a = 1.0 # amplitude. This is varied later by the normalization process.
Expand Down

0 comments on commit 2c22e97

Please sign in to comment.