Skip to content

Commit 14c94b3

Browse files
committed
fixing const-interpolator again
1 parent 9458174 commit 14c94b3

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

mir_eval/sonify.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,14 @@ def time_frequency(
183183
bounds_error=False,
184184
fill_value=(gram[:, 0], gram[:, -1]),
185185
)
186+
signal = interpolator(np.arange(length))
186187
else:
187188
# NOTE: This is a special case where there is only one time interval.
188189
# scipy 1.10 and above handle this case directly with the interp1d above,
189190
# but older scipy's do not. This is a workaround for that.
190191
#
191192
# In the 0.9 release, we can bump the minimum scipy to 1.10 and remove this
192-
interpolator = _const_interpolator(gram[:, 0])
193-
194-
signal = interpolator(np.arange(length))
193+
signal = np.tile(gram[:, 0], (1, length))
195194

196195
for n, frequency in enumerate(frequencies):
197196
# Get a waveform of length samples at this frequency
@@ -213,17 +212,6 @@ def time_frequency(
213212
return output
214213

215214

216-
def _const_interpolator(value):
217-
"""Return a function that returns `value`
218-
no matter the input.
219-
"""
220-
221-
def __interpolator(x):
222-
return value
223-
224-
return __interpolator
225-
226-
227215
def _fast_synthesize(frequency, n_dec, fs, function, length):
228216
"""Efficiently synthesize a signal.
229217
Generate one cycle, and simulate arbitrary repetitions

0 commit comments

Comments
 (0)