-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsavenoise2.py
38 lines (29 loc) · 997 Bytes
/
savenoise2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Extract noise data from all LNGS wavs with the name satisfying the pattern
'LF_TILE15_77K_*VoV_1.wav' and save them as `toy.DataCycleNoise` objects.
"""
import glob
import os
import toy
from matplotlib import pyplot as plt
fig = plt.figure('savenoise2')
fig.clf()
axs = fig.subplots(2, 1)
axs[0].set_title('LNGS 1 GSa/s')
axs[1].set_title('LNGS 125 MSa/s')
sources = list(sorted(glob.glob('darksidehd/LF_TILE15_77K_*VoV_1.wav')))
for source in sources:
suffix = '.wav'
dest = 'noises/' + os.path.split(source)[1][:-len(suffix)] + '-noise.npz'
print(f'saving {source} to {dest}...')
lngs1GSas = toy.DataCycleNoise(timebase=1)
lngs1GSas.load_LNGS_wav(source, 1100)
lngs1GSas.save(dest)
lngs1GSas = toy.DataCycleNoise(timebase=1)
lngs1GSas.load(dest)
axs[0].plot(lngs1GSas.generate(1, 1000)[0])
lngs125MSas = toy.DataCycleNoise(timebase=8)
lngs125MSas.load(dest)
axs[1].plot(lngs125MSas.generate(1, 1000)[0])
fig.tight_layout()
fig.show()