"This is a notebook to plot waveform genreated by making-injections. Data file is a json format."
"This is a notebook to plot waveform genreated by making-injections.ipynb. Data file is a json format."
]
]
},
},
{
{
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
This is a notebook to plot waveform genreated by making-injections. Data file is a json format.
This is a notebook to plot waveform genreated by making-injections.ipynb. Data file is a json format.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
import json
import json
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
#load all waveform files first.
#load all waveform files first.
for i in range(0,99):
for i in range(0,99):
with open(f'{i}.json','r') as f:
with open(f'{i}.json','r') as f:
waveform = json.load(f)
waveform = json.load(f)
#extract time series at V1,L1,and H1 from waveform file.
#extract time series at V1,L1,and H1 from waveform file.
data_V1 = waveform['data']['V1']
data_V1 = waveform['data']['V1']
data_L1 = waveform['data']['L1']
data_L1 = waveform['data']['L1']
data_H1 = waveform['data']['H1']
data_H1 = waveform['data']['H1']
times_V1 = waveform['times']['V1']
times_V1 = waveform['times']['V1']
times_L1 = waveform['times']['L1']
times_L1 = waveform['times']['L1']
times_H1 = waveform['times']['H1']
times_H1 = waveform['times']['H1']
#plot the waveform at V1,L1,and H1
#plot the waveform at V1,L1,and H1
fig=plt.figure()
fig=plt.figure()
plt.title('0')
plt.title('0')
plt.subplot(221)
plt.subplot(221)
plt.title('V1')
plt.title('V1')
plt.xlabel('time')
plt.xlabel('time')
plt.ylabel('waveform')
plt.ylabel('waveform')
plt.plot(times_V1,data_V1)
plt.plot(times_V1,data_V1)
plt.subplot(222)
plt.subplot(222)
plt.title('L1')
plt.title('L1')
plt.xlabel('time')
plt.xlabel('time')
plt.ylabel('waveform')
plt.ylabel('waveform')
plt.plot(times_L1,data_L1)
plt.plot(times_L1,data_L1)
plt.subplot(223)
plt.subplot(223)
plt.title('H1')
plt.title('H1')
plt.xlabel('time')
plt.xlabel('time')
plt.ylabel('waveform')
plt.ylabel('waveform')
plt.plot(times_H1,data_H1)
plt.plot(times_H1,data_H1)
fig.tight_layout(h_pad=0.4)
fig.tight_layout(h_pad=0.4)
#save figures
#save figures
plt.savefig(f'{i}',dpi=1000)
plt.savefig(f'{i}',dpi=1000)
```
```
%% Output
%% Output
/home/changfeng/.local/lib/python3.6/site-packages/ipykernel_launcher.py:15: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
/home/changfeng/.local/lib/python3.6/site-packages/ipykernel_launcher.py:15: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).