-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_remote.py
37 lines (29 loc) · 981 Bytes
/
example_remote.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
import os
import pyarrow.parquet as pq
import pandas as pd
import matplotlib.pyplot as plt
# read .json TCV_db structure
df_TCV_db = pd.read_json('TCV_db.json')
# read .parquet table
df_Table_DATA = pq.read_table('TCV_DATAno57093.parquet')
# plot PhotoDiode signal for ELMs visualization
time = df_Table_DATA[df_Table_DATA.column_names.index('time')]
PD = df_Table_DATA[df_Table_DATA.column_names.index('PD')]
fig, ax = plt.subplots()
ax.plot(time, PD, 'k')
plt.xlabel('Time [s]')
plt.ylabel('Dalpha emission from PhotoDiode [V]')
# get Events from TCV_db structure
Events = df_TCV_db.no57093.Events
# get ELM times
ELM_times = Events['ELM']['time']
# get closer
elm = []
df_DATA = df_Table_DATA.to_pandas()
for jj in range(len(ELM_times)):
elm.append(df_DATA['time'].sub(ELM_times[jj]).abs().idxmin())
PD_ELMs = df_Table_DATA['PD'].to_pandas()
ELM_values = PD_ELMs[elm]
# plot ELM events
ax.scatter(ELM_times, ELM_values, facecolors='None', edgecolors='r')
plt.show()