Handling/DataMining/Depot/python/1117MaximO_DistrFunc/npDS.py

import numpy as np
import matplotlib.pyplot as plt
plt.style.use("dark_background")


"""IMPORT DATA"""
Pshotno=24940
Vshotno=24942
ds = np.DataSource(None)
PlasmaData = ds.open("http://golem.fjfi.cvut.cz/shots/"+str(Pshotno)+"//DAS/0416RigolDS1074a.ON/data_all")
VacuumData = ds.open("http://golem.fjfi.cvut.cz/shots/"+str(Vshotno)+"//DAS/0416RigolDS1074a.ON/data_all")
Readings=np.loadtxt(PlasmaData)
Vacuum=np.loadtxt(VacuumData)


"""INTERPRET DATA"""

Current = (-np.cumsum(Readings[:,2])) - (-np.cumsum(Vacuum[:,2]))
Uloop = -Readings[:,1]
Diode = -Readings[:,3]
Coil = np.cumsum(Readings[:,0])


"""FIGURE SETUP"""
with plt.rc_context({'axes.edgecolor':'white', 'xtick.color':'black', 'ytick.color':'black', 'figure.facecolor':'white'}):
    fig = plt.figure(figsize=(10, 8))
    fig.suptitle("Task 13", fontsize=16, color="black")

    ax1 = plt.subplot2grid((4,1),(0,0))
    ax1.tick_params(labelsize=6)
    ax1.text(-105,9,"Toroidal\nMagnetic\nfield\n(integrated)", fontsize=9, style="italic", ha="center", color="black", bbox=dict(facecolor='#d998cb', boxstyle="round,pad=0.5"))
    ax1.axvline(50, ls='-.', color='white')
    ax1.axvline(950, ls='-.', color='white')

    ax2 = plt.subplot2grid((4,1),(1,0))
    ax2.tick_params(labelsize=6)
    ax2.text(-105,9,"Loop\nVoltage", fontsize=9, style="italic", ha="center", color="black", bbox=dict(facecolor='#52bacc', boxstyle="round,pad=0.5"))
    ax2.axvline(50, ls='-.', color='white')
    ax2.axvline(950, ls='-.', color='white')

    ax3 = plt.subplot2grid((4,1),(2,0))
    ax3.tick_params(labelsize=6)
    ax3.text(-105,20,"Plasma\ncurrent\n(integrated)", fontsize=9, style="italic", ha="center", color="black", bbox=dict(facecolor='#b6d957', boxstyle="round,pad=0.5"))
    ax3.axvline(50, ls='-.', color='white')
    ax3.axvline(950, ls='-.', color='white')

    ax4 = plt.subplot2grid((4,1),(3,0))
    ax4.tick_params(labelsize=6)
    ax4.text(-105,0.1,"Diode\nsignal", fontsize=9, style="italic", ha="center", color="black", bbox=dict(facecolor='#fac364', boxstyle="round,pad=0.5"))
    ax4.axvline(50, ls='-.', color='white')
    ax4.axvline(950, ls='-.', color='white')


    """PLOT"""

    ax1.plot(Coil, color="#d998cb")
    ax2.plot(Uloop, color="#52bacc")
    ax3.plot(Current, color="#b6d957")
    ax4.plot(Diode, color="#fac364")
    #print(plt.style.available)
    plt.show()