# coding: utf-8
# In[18]:
import pandas as pd
import matplotlib.pyplot as plt
URL = 'http://golem.fjfi.cvut.cz/utils/data/{}/{}'
# function for reading 1D y(t) signals
def read_signal1d(shot_number, signal_id):
#url = URL.format(shot_number, signal_id)
url = signal_id
return pd.read_table(url,names=['time',signal_id],
index_col='time')
# read the specified signals
shot_no = 29395
U_l = read_signal1d(shot_no, 'loop_voltage')
I_p = read_signal1d(shot_no, 'plasma_current')
P_OH = U_l*I_p # vectorized, time-aligned operation
B_t = read_signal1d(shot_no, 'toroidal_field')
H_a = read_signal1d(shot_no, 'photodiode_alpha')
# combine into a data frame table
df = pd.concat([U_l, I_p, B_t, H_a], axis='columns')
# plot the data table in subplots from 4 to 25 ms
df.loc[4e-3:25e-3].plot(subplots=True, ylim=(0,None))
plt.show() # display the figure in a window
plt.savefig('graph.jpg')
# In[ ]: