Skip to content

Commit

Permalink
Adding exceptions for hl and cfs
Browse files Browse the repository at this point in the history
Signed-off-by: Gerardo Roa Dabike <gerardo.roa@gmail.com>
  • Loading branch information
groadabike committed Nov 15, 2022
1 parent bbc5f9d commit 00d29ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clarity/enhancer/nalr.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ def __init__(self, nfir: int, fs: int):
self.delay[nfir // 2] = 1.0

def hl_interp(self, hl: np.ndarray, cfs: np.ndarray):
assert len(hl) == len(cfs), "Hearing losses and center frequencies don't match!"
hl_interpf = scipy.interpolate.interp1d(cfs, hl)
try:
hl_interpf = scipy.interpolate.interp1d(cfs, hl)
except ValueError:
raise ValueError(
"Hearing losses (hl) and center frequencies (cfs) don't match!"
)
return hl_interpf(self.aud)

def build(
Expand Down

0 comments on commit 00d29ca

Please sign in to comment.