Revision cca0ed70d9c0e84e4749ac1ff638116f0b741801 (click the page title to view the current version)

Handling/BasicExamples

Changes from cca0ed70d9c0e84e4749ac1ff638116f0b741801 to 791ff8ecd357f01437df9779ee5f77df440be97f

---
format:markdown
...
 
 
# Computer systems 4 GOLEM  (basic examples)

## $U_l$ @ #33993

### Python (e.g. through [the Jupyter Notebook](jupyter.org))

<table>
<tr><td>
~~~
%matplotlib inline #If interactive mode

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt


shot_no = 33993

data_URL = "http://golem.fjfi.cvut.cz/shots/{shot_no}/DASs/StandardDAS/{identifier}.csv"  
ds = np.DataSource(destpath='/tmp')

def open_remote(shot_no, identifier, url_template):
    return ds.open(url_template.format(shot_no=shot_no, identifier=identifier))

def read_signal(shot_no, identifier): 
    file = open_remote(shot_no, identifier, data_URL)
    return pd.read_csv(file, names=['Time',identifier],
                     index_col='Time', squeeze=True)  # squeeze makes simple 1-column signals a Series

loop_voltage = read_signal(shot_no, 'LoopVoltageCoil_raw')
ax = loop_voltage.plot(grid=True)
ax.set(xlabel="Time [s]", ylabel="$U_l$ [V]", title="Loop voltage $U_l$ #{}".format(shot_no));

plt.show()
plt.savefig('graph.jpg')


#Run it: save it as script.py and run "python script.py" or execute in a ceel in a Jupyter Notebook
~~~

</td><td><img src="/Handling/CompAlgSystems4Golem/python/v3/Jupyter/Demos/33993/Ul/code/graph.jpg"></img></td></tr>
</table>

### Gnuplot

<table>
<tr><td>
~~~

#set terminal jpeg; #if you want a file
set terminal wxt #if you want a graph on the screen
ShotNo = '33993'
DAS='DASs/StandardDAS/'
identifier = 'LoopVoltageCoil_raw.csv' ;
baseURL='http://golem.fjfi.cvut.cz/shots/'
DataURL= baseURL.ShotNo.'/'.DAS.identifier
set datafile separator ',';
set title "Uloop@ShotNo";
! wget -q @DataURL ;
plot identifier u 1:2 w l t 'Uloop'


#Run it: save it as script.gp and run "gnuplot --persist script.gp" 
#Run it interactively or  save it as script.gp and run "gnuplot --persist script.gp" 
~~~

</td><td><img src="/Handling/CompAlgSystems4Golem/gnuplot/Demos/33993/Ul/code/graph.jpg"></img></td></tr>
</table>