# =============================================================================
# A simple code for extracting data from diagnostics and double rake probe from
# shots on Golem
# =============================================================================
import numpy as np
from urllib.request import urlopen
def diag_collect(shot, diag):
print('%s from shot %i' % (diag, shot))
url = 'http://golem.fjfi.cvut.cz/utils/data/%i/%s' % (shot, diag)
ourl = urlopen(url)
data_all = np.loadtxt(ourl)
time = np.array([row[0] for row in data_all])
data = np.array([row[1] for row in data_all])
ourl.close()
return time, data
def pap_collect(shot, pin):
print('Data from shot %i, pin %s' % (shot, pin))
url = f'http://golem.fjfi.cvut.cz/utils/data/{shot}/{pin}'
ourl = urlopen(url)
data_all = np.loadtxt(ourl)
data = np.array([row[1] for row in data_all])
ourl.close()
return data
# Example:
# time, data = diag_collect(30141, 'loop_voltage')
# pin_data = pap_collect(30141, 'drppin16')