import numpy as np from matplotlib.pyplot import * #from golem_data import golem_data from pylab import * import matplotlib.image as mpimg shot_no=39187 base_url = "http://golem.fjfi.cvut.cz/shots/" DAS='Diagnostics/BasicDiagnostics/' # create data cache in the 'golem_cache' folder ds = np.DataSource('golem_cache') figure(num=None, figsize=(8, 5), dpi=80, facecolor='w', edgecolor='k') identifier = "U_Loop.csv" data_file = ds.open(base_url + str(shot_no)+ '/' +DAS +identifier) data = np.loadtxt(data_file,delimiter=",") ylabel('$U_l$ [V]') xlabel('Time [ms]') ylim(0,26) xlim(0,25) yticks(arange(0, 26, 5)) xticks(arange(0, 30, 5)) title('#'+str(shot_no)) plot(data[:,0]*1000, data[:,1],label='Loop voltage') legend(loc=0) savefig('Ul.pdf') savefig('Ul.jpg') figure(num=None, figsize=(8, 5), dpi=80, facecolor='w', edgecolor='k') identifier = "U_IntRogCoil.csv" data_file = ds.open(base_url + str(shot_no)+ '/' +DAS +identifier) data = np.loadtxt(data_file,delimiter=",") ylabel('$I_{p+ch}$ [kA]') xlabel('Time [ms]') ylim(0,3.5) #xlim(5,25) yticks(arange(0, 5.5, 0.5)) #xticks(arange(0, 30, 5)) title('#'+str(shot_no)) plot(data[:,0]*1000, data[:,1]/1000,label='Rogowski coil current') legend(loc=0) savefig('I_p+ch.pdf') savefig('I_p+ch.jpg') figure(num=None, figsize=(8, 5), dpi=80, facecolor='w', edgecolor='k') identifier = "U_IntBtCoil.csv" data_file = ds.open(base_url + str(shot_no)+ '/' +DAS +identifier) data = np.loadtxt(data_file,delimiter=",") ylabel('$B_{t}$ [T]') xlabel('Time [ms]') ylim(0,0.7) #xlim(5,25) yticks(arange(0, 0.7, 0.1)) #xticks(arange(8, 35, 5)) title('#'+str(shot_no)) plot(data[:,0]*1000, data[:,1],label='Toroidal magnetic field') legend(loc=0) savefig('B_t.pdf') savefig('B_t.jpg') figure(num=None, figsize=(8, 5), dpi=80, facecolor='w', edgecolor='k') identifier = "U_LeybPhot.csv" data_file = ds.open(base_url + str(shot_no)+ '/' +DAS +identifier) data = np.loadtxt(data_file,delimiter=",") ylabel('$I_{rad}$ [a.u.]') xlabel('Time [ms]') ylim(0,0.14) #xlim(5,25) yticks(arange(0, 0.14, 0.025)) #xticks(arange(8, 20, 5)) title('#'+str(shot_no)) plot(data[:,0]*1000, data[:,1],label='Whole spectrum Radiation power') legend(loc=0) savefig('I_rad.pdf') savefig('I_rad.jpg') exit() fig=figure(1) subplots_adjust(hspace=0.001) sbp1=subplot(411) obj1 = golem_data(shot_no , 'loop_voltage') ylabel('$U_l$ [V]') ylim(0,26) yticks(arange(0, 30, 5)) title('#'+str(shot_no)) plot(data[:,0]*1000, data[:,1],label='Loop voltage') legend(loc=0) sbp1=subplot(412, sharex=sbp1) obj1 = golem_data(shot_no , 'toroidal_field') ylabel('$B_t$ [T]') yticks(arange(0, 0.5 , 0.1)) ylim(0,0.35) plot(data[:,0]*1000, data[:,1],label='Toroidal mag. field') legend(loc=0) sbp1=subplot(413, sharex=sbp1) obj2 = golem_data(shot_no , 'plasma_current') ylabel('$I_p$ [kA]') yticks(arange(0, 4.5, 1)) ylim(0,4.5) plot(obj2.tvec*1000,obj2.data/1000, label='Plasma current') legend(loc=0) subplot(414, sharex=sbp1) obj1 = golem_data(shot_no , 'photodiode_alpha') ylabel('Intensity [a.u.]') yticks(arange(0, 0.09 , 0.02)) plot(data[:,0]*1000, data[:,1],label='$H_{\\alpha}$ radiation') xticks(arange(8, 30, 5)) xlim(5,25) ylim(0,0.09) xlabel('Time [ms]') legend(loc=0) xticklabels = sbp1.get_xticklabels() setp(xticklabels, visible=False) #show() savefig('basicgraph.pdf') savefig('basicgraph.jpg')