GOLEM Example: Get Data from ASCII files¶
In [1]:
                    Copied!
                    
                    
                %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
#from urllib import urlopen # Python 2
from urllib.request import urlopen # Python 3
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
#from urllib import urlopen # Python 2
from urllib.request import urlopen # Python 3
        
        Below we define the url of the loop voltage data for the GOLEM shot #22667.
The list of all available diagnostics is here http://golem.fjfi.cvut.cz/shots/0/Data.php#all_data
In [2]:
                    Copied!
                    
                    
                baseURL = "http://golem.fjfi.cvut.cz/utils/data/"
ShotNo = 26219
identifier = "loop_voltage"
url = baseURL + str(ShotNo) + '/' + identifier
baseURL = "http://golem.fjfi.cvut.cz/utils/data/"
ShotNo = 26219
identifier = "loop_voltage"
url = baseURL + str(ShotNo) + '/' + identifier
        
        The signal data is got from an ascii file located at the url. We download the file and convert it into a Numpy array.
In [3]:
                    Copied!
                    
                    
                with urlopen(url) as response:
    data = np.loadtxt(response, delimiter='\t')
with urlopen(url) as response:
    data = np.loadtxt(response, delimiter='\t')
        
        In [4]:
                    Copied!
                    
                    
                plt.plot(data[:,0], data[:,1])
plt.plot(data[:,0], data[:,1])
        
        Out[4]:
[<matplotlib.lines.Line2D at 0x167cfbe0460>]