import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import requests
/opt/anaconda3/lib/python3.8/site-packages/pandas/core/computation/expressions.py:20: UserWarning: Pandas requires version '2.7.3' or newer of 'numexpr' (version '2.7.1' currently installed). from pandas.core.computation.check import NUMEXPR_INSTALLED
shot_no = 47141 # to be replaced by the actual discharge number
plasma_start = float(requests.get(f'http://golem.fjfi.cvut.cz/shots/{shot_no}/Diagnostics/PlasmaDetection/Results/t_plasma_start').text)
plasma_end = float(requests.get(f'http://golem.fjfi.cvut.cz/shots/{shot_no}/Diagnostics/PlasmaDetection/Results/t_plasma_end').text)
print ('Plasma start =', round(plasma_start, 3), 'ms')
print ('Plasma end =', round(plasma_end, 3), 'ms')
# convert to s
plasma_start*=1e-3
plasma_end*=1e-3
Plasma start = 4.074 ms Plasma end = 13.272 ms
data_url = f"http://golem.fjfi.cvut.cz/shots/{shot_no}/Diagnostics/LangBallPenProbe/DAS_raw_data_dir/data.csv"
df = pd.read_csv(data_url)
df.set_index('time', inplace=True)
df.head()
ch1 | ch2 | |
---|---|---|
time | ||
0.000000e+00 | -0.532227 | -0.014160 |
6.400017e-08 | -0.523438 | -0.014160 |
1.280003e-07 | -0.514648 | -0.014648 |
1.920005e-07 | -0.504883 | -0.014160 |
2.560007e-07 | -0.495117 | -0.014160 |
df.plot()
<AxesSubplot:xlabel='time'>
df_plasma = df[plasma_start:plasma_end]
normalized_time = df_plasma.index.to_numpy()
normalized_time-=normalized_time.min()
normalized_time/=normalized_time.max()
df_plasma.plot.scatter(x = 'ch1', y = 'ch2', s = .1, c = normalized_time, alpha = .7)
plt.savefig('icon-fig.png')