Skip to content

Commit 8fe9103

Browse files
committed
serializable
1 parent 88a31ae commit 8fe9103

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

batbot/spectrogram/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,9 +1760,15 @@ def compute_wrapper(
17601760
segments['stft_db'].append(stft_db[:, start + trim_begin : start + trim_end])
17611761
segment_waveplot = waveplot[:, start + trim_begin : start + trim_end]
17621762
segments['waveplot'].append(segment_waveplot)
1763-
# convert to JSON serializable datatype and add to metadata if segment_waves is True
17641763
if segment_waves:
17651764
segment_waveplot = waveform_ms[:, start + trim_begin : start + trim_end]
1765+
# convert into some JSON serializable
1766+
segment_waveplot = [
1767+
[
1768+
round(float(val), 3) for val in row
1769+
]
1770+
for row in segment_waveplot
1771+
]
17661772
metadata_waveplot = {
17671773
"waveplot": segment_waveplot,
17681774
}

0 commit comments

Comments
 (0)