Loading of basic libraries.
The matplotlib library is used for plotting, the pandas library for data retrieval and manipulation.
# Basic libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
The parametrized URL address to obtain CSV files from the analysis results of the basic diagnostics
data_URL = 'http://golem.fjfi.cvut.cz/shots/{shot_no}/Diagnostics/BasicDiagnostics/Results/{name}.csv'
Discharge number to use. The special discharge number 0 refers to the most recent discharge
shot_no = 36081
The processed loop voltage signal $U_\mathrm{loop}$ is automatically downloaded and read using the Pandas library into a pandas.Series object from the specified URL.
U_loop = pd.read_csv(data_URL.format(shot_no=shot_no, name='U_loop'), # create a specific URL
names=['time', 'U_loop'], # names of the columns
index_col=0, # first column will serve as index (independent variable)
squeeze=True, # return as Series since there is only 1 dependent variable column
)
The .plot() wrapper method for plotting with the matplotlib library automatically selects the x and y values and the plot type (line for 1D). It returns an Axes object, which is then used to label the axes and set a title.
ax = U_loop.plot()
ax.set(title="GOLEM #{}".format(shot_no), xlabel='time [ms]', ylabel=r'$U_\mathrm{loop}$ [V]')
plt.savefig('plot.jpg')