Syncing to home.
This commit is contained in:
28
python/temp_BS.py
Normal file
28
python/temp_BS.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from thunderhopper.modeltools import load_data
|
||||
from thunderhopper.filetools import search_files
|
||||
from thunderhopper.model import process_signal
|
||||
|
||||
paths = search_files('Pseudochorthippus_parallelus_micarray-short_JJ_20240815T160355-20240815T160755-1m10s690ms-1m13s614ms', dir='../data/field/processed/song/')
|
||||
thresh_rel = np.array([0, 0.5, 1, 1.5, 2, 2.5, 3])[-1]
|
||||
thresh_abs = np.load('../data/inv/field/thresholds.npz')['sds'] * thresh_rel
|
||||
|
||||
for path in paths:
|
||||
print(f'Processing {path}')
|
||||
|
||||
data, config = load_data(path, files='raw')
|
||||
config['feat_thresh'] = thresh_abs
|
||||
|
||||
song, rate = data['raw'], config['rate']
|
||||
time = np.arange(song.shape[0]) / rate
|
||||
start, end = data['songs_0'].ravel()
|
||||
segment = (time >= start) & (time <= end)
|
||||
|
||||
signals, rates = process_signal(config, 'feat', signal=song, rate=rate)
|
||||
feat = signals['feat']
|
||||
|
||||
fig, axes = plt.subplots(1, 8, sharex=True, sharey=True, figsize=(16, 9))
|
||||
for i, ax in enumerate(axes):
|
||||
ax.plot(feat[..., i])
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user