In [2]:
import numpy as np
from matplotlib.pyplot import *
from pylab import *
import matplotlib.image as mpimg
#from urllib  import urlopen #python 2.7 
from urllib.request  import urlopen #python 3.0 

ShotNo = 22471


#Create a path to data
#baseURL = "http://golem.fjfi.cvut.cz/utils/data/" #remote access
baseURL = "file:///golem/database/operation/shots/" #local access
#dataURL = urlopen(baseURL+ str(ShotNo) + '/' + diagnSPEC + '.npz')


fig=figure(1);subplots_adjust(hspace=0.001)

sbp1=subplot(511)
dataURL = urlopen(baseURL+ str(ShotNo) + '/loop_voltage')
obj1=np.loadtxt(dataURL, delimiter='\t')
ylim(0,26);yticks(arange(0, 30, 5))
title('#'+str(ShotNo));ylabel('$U_l$ [V]')
plt.plot(obj1[:,0]*1000, obj1[:,1], 'k-',label='Loop voltage $U_l$' );legend(loc=0)

sbp1=subplot(512, sharex=sbp1)
dataURL = urlopen(baseURL+ str(ShotNo) + '/toroidal_field')
obj1=np.loadtxt(dataURL, delimiter='\t')
yticks(arange(0, 0.5 , 0.1));ylim(0,0.35)
ylabel('$B_t$ [T]')
plt.plot(obj1[:,0]*1000, obj1[:,1], 'k-',label='Toroidal mag. field $B_t$');legend(loc=0)

sbp1=subplot(513, sharex=sbp1)
dataURL = urlopen(baseURL+ str(ShotNo) + '/plasma_current')
obj1=np.loadtxt(dataURL, delimiter='\t')
yticks(arange(0, 4.5, 1));ylim(0,4.5)
ylabel('$I_p$ [kA]')
plt.plot(obj1[:,0]*1000, obj1[:,1]/1000, 'k-',label='Plasma current $I_p$');legend(loc=0)

sbp1=subplot(514, sharex=sbp1)
dataURL = urlopen(baseURL+ str(ShotNo) + '/photodiode_alpha')
obj1=np.loadtxt(dataURL, delimiter='\t')
yticks(arange(0, 0.09 , 0.02));ylim(0,0.09)
ylabel('Intensity [a.u.]')
plt.plot(obj1[:,0]*1000, obj1[:,1], 'k-',label='$H_\\alpha$ radiation');legend(loc=0)

sbp1=subplot(515, sharex=sbp1)
dataURL = urlopen(baseURL+ str(ShotNo) + '/electron_density')
obj2=np.loadtxt(dataURL, delimiter=' ')
yticks(arange(0, 0.8 , 0.2));ylim(0,0.8)
ylabel('$n_e$')
xticks(arange(8, 30, 5));xlim(5,25)
xlabel('Time [ms]')
plt.plot(obj2[:,0]*1000, obj2[:,1]*1e-19, 'k-',label='electron density $n_e$');legend(loc=0)

xticklabels = sbp1.get_xticklabels()
setp(xticklabels, visible=False)

savefig('basicgraph.pdf')
savefig('basicgraph.jpg')

show()
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/usr/lib/python3.4/urllib/request.py in open_local_file(self, req)
   1337         try:
-> 1338             stats = os.stat(localfile)
   1339             size = stats.st_size

FileNotFoundError: [Errno 2] No such file or directory: '/golem/database/operation/shots/22471/loop_voltage'

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-2-2c070127e003> in <module>()
     18 
     19 sbp1=subplot(511)
---> 20 dataURL = urlopen(baseURL+ str(ShotNo) + '/loop_voltage')
     21 obj1=np.loadtxt(dataURL, delimiter='\t')
     22 ylim(0,26);yticks(arange(0, 30, 5))

/usr/lib/python3.4/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    159     else:
    160         opener = _opener
--> 161     return opener.open(url, data, timeout)
    162 
    163 def install_opener(opener):

/usr/lib/python3.4/urllib/request.py in open(self, fullurl, data, timeout)
    461             req = meth(req)
    462 
--> 463         response = self._open(req, data)
    464 
    465         # post-process response

/usr/lib/python3.4/urllib/request.py in _open(self, req, data)
    479         protocol = req.type
    480         result = self._call_chain(self.handle_open, protocol, protocol +
--> 481                                   '_open', req)
    482         if result:
    483             return result

/usr/lib/python3.4/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    439         for handler in handlers:
    440             func = getattr(handler, meth_name)
--> 441             result = func(*args)
    442             if result is not None:
    443                 return result

/usr/lib/python3.4/urllib/request.py in file_open(self, req)
   1314                 raise URLError("file:// scheme is supported only on localhost")
   1315         else:
-> 1316             return self.open_local_file(req)
   1317 
   1318     # names for the localhost

/usr/lib/python3.4/urllib/request.py in open_local_file(self, req)
   1354         except OSError as exp:
   1355             # users shouldn't expect OSErrors coming from urlopen()
-> 1356             raise URLError(exp)
   1357         raise URLError('file not on local host')
   1358 

URLError: <urlopen error [Errno 2] No such file or directory: '/golem/database/operation/shots/22471/loop_voltage'>
In [ ]:
 
In [ ]:
 
In [ ]: