<jupyter_start><jupyter_text>Coches results<jupyter_code># Scientific libraries
import numpy as np
import scipy


# Graphic libraries

import matplotlib.pyplot as plt
%matplotlib widget

plt.style.use("presentation")
plt.rcParams["figure.figsize"] = (4, 3)

# Creating alias for magic commands

# LPPview Classes
from LPPview import *
from LPPview.Classes.LPPic_temporal import History

root = "/DATA/tavant/"
folders = ["220_Coche_same_FakeR_2cm/", "219_Coche_same_fakeR/", "214_Coche_same_CE/"]
names = ["$L_R=2$ cm", "$L_R=2$ mm", "No $L_R$"]

paths = [root+f for f in folders]

def plot_ne():
    plt.figure()

    for i in [2, 1, 0]:
        

        path=paths[i]
        
        F = field(path)
        H = History(path)
        temporal_data = H.return_history()
        #print(temporal_data.keys())
        time = temporal_data["time"]*1e6
        # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
        # rate[0] = 0
        mob = temporal_data["mobi"]
        ne = temporal_data["elec"]


        plt.plot(time, F._qf*ne, label=names[i])
        
        
    plt.xlim(0, 300)
    plt.xlabel("Time [$\mu$s]")
    
    plt.ylabel("Mean electron density $n_e$ [m$^{-3}$]")
    
    plt.legend()
    
    plt.ylim(bottom=0, top=5e15)
    
plot_ne()     
plt.savefig("Coches_mean_ne.pdf")

def plot_Te():
    plt.figure()

    for i in [2, 0]:
        

        path=paths[i]
        
        F = field(path)
        H = History(path)
        temporal_data = H.return_history()
        #print(temporal_data.keys())
        time = temporal_data["time"]*1e6
        # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
        # rate[0] = 0
        mob = temporal_data["mobi"]
        ne = (temporal_data["SUMe_x"] + temporal_data["SUMe_y"] +temporal_data["SUMe_z"] )/3


        plt.plot(time, ne, label=names[i])
        
        
    plt.xlim(0, 300)
    plt.xlabel("Time [$\mu$s]")
    
    plt.ylabel("Mean electron temperature T$_e$ [V]")
    
    plt.legend()
    
    #plt.ylim(bottom=0, top=5e15)
    
plot_Te()     
plt.savefig("Coches_mean_Te.pdf")

def plot_ne():
    plt.figure()

    for i in [2, 0, 1]:
        

        path=paths[i]
        
        F = field(path)
        H = History(path)
        temporal_data = H.return_history()
        #print(temporal_data.keys())
        time = temporal_data["time"]*1e6
        # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
        # rate[0] = 0
        mob = temporal_data["mobi"]
        ne = temporal_data["coll"]


        plt.plot(time, F._qf*ne, label=names[i])
        
        
    plt.xlim(0, 300)
    plt.xlabel("Time [$\mu$s]")
    
    plt.ylabel("Mean ionization rate [m$^{-3}$/s]")
    
    plt.legend()
    
    #plt.ylim(bottom=0, top=5e15)
    
plot_ne()     
plt.savefig("Coches_mean_Siz.pdf")

def plot_ne_profile():
    plt.figure()

    ymax = 0
    for i, tmin, tmax in zip([2, 0], [170, 200], [250, 300]) :
        

        path=paths[i]
        
        F = field(path)
        H = History(path)
        temporal_data = H.return_history()
        #print(temporal_data.keys())
        time = temporal_data["time"]*1e6
        # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
        # rate[0] = 0
        mob = temporal_data["mobi"]
        ne = temporal_data["coll"]
        imin = tmin*1e-6/F._dT/F._Na/F._nT
        imax = tmax*1e-6/F._dT/F._Na/F._nT
        
        F.outputobject.parameters = {}
        F.definecoords()
        t = F.meanfield("Nume", "x", imin=imin, imax=imax)
        
        ymax = max(ymax, t.max())
        plt.plot(F.tab_y, t, label=names[i])
        
        
    b = F.meanfield("B(3)", "x", imin=imin, imax=imax)
    
    plt.plot(F.tab_y, b/b.max()*ymax, "--", label="$B_R$ (normalized)")
    
    plt.vlines(2.5, 0,ymax, "k", ":", alpha=0.7 )
    plt.xlim(0, 4)
    plt.xlabel("Axial position", fontsize=11)
    
    plt.ylabel("Electron density [m$^{-3}$]", fontsize=11)
    
    plt.legend(fontsize=10)
    
    #plt.ylim(bottom=0, top=5e15)
    
plot_ne_profile()     
plt.savefig("Coches_mean_ne_profile.pdf")

def plot_Ez_profile():
    plt.figure()

    ymax = 0
    for i, tmin, tmax in zip([2, 0], [170, 200], [250, 300]) :
        

        path=paths[i]
        
        F = field(path)
        H = History(path)
        temporal_data = H.return_history()
        #print(temporal_data.keys())
        time = temporal_data["time"]*1e6
        # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
        # rate[0] = 0
        mob = temporal_data["mobi"]
        ne = temporal_data["coll"]
        imin = tmin*1e-6/F._dT/F._Na/F._nT
        imax = tmax*1e-6/F._dT/F._Na/F._nT
        
        F.outputobject.parameters = {}
        F.definecoords()
        t = F.meanfield("Ej(2)", "x", imin=imin, imax=imax)*1e-3
        
        ymax = max(ymax, t.max())
        plt.plot(F.tab_y, t, label=names[i])
        
    ymax = 30    
    b = F.meanfield("B(3)", "x", imin=imin, imax=imax)
    
    plt.plot(F.tab_y, b/b.max()*ymax, "--", label="$B_R$ (normalized)")
    
    plt.vlines(2.5, 0,ymax, "k", ":", alpha=0.7 )
    plt.hlines(0, 0,4, "k", alpha=0.7 ,linewidth=1.5)
    plt.xlim(0, 4)
    plt.xlabel("Axial position", fontsize=11)
    
    plt.ylabel("Axial electric field $E_{z}$ [kV/m]", fontsize=11)
    
    plt.legend(fontsize=10)
    
    plt.ylim(bottom=-10, top=ymax)
    
plot_Ez_profile()     
plt.savefig("Coches_mean_Ez_profile.pdf")

def plot_Te_profile():
    plt.figure()

    ymax = 0
    for i, tmin, tmax in zip([2, 0], [170, 200], [250, 300]) :
        
        try:
            path=paths[i]

            F = field(path)
            H = History(path)
            temporal_data = H.return_history()
            #print(temporal_data.keys())
            time = temporal_data["time"]*1e6
            # rate =  (temporal_data["elec_SEE"] +  temporal_data["elec_SEE_sup"])/ temporal_data["elec_wal"]
            # rate[0] = 0
            mob = temporal_data["mobi"]
            ne = temporal_data["coll"]
            imin = tmin*1e-6/F._dT/F._Na/F._nT
            imax = tmax*1e-6/F._dT/F._Na/F._nT

            F.outputobject.parameters = {}
            F.definecoords()
            
            
            t = F.meanfield("Eke(2)", "x", imin=imin, imax=imax)

            ymax = max(ymax, t.max())
            plt.plot(F.tab_y, 2*t, label="T$_{e, z}$")
            
            t = F.meanfield("Eke(1)", "x", imin=imin, imax=imax)

            ymax = max(ymax, t.max())
            plt.plot(F.tab_y, 2*t, label="T$_{e, \\theta}$")
            t = F.meanfield("Eke(3)", "x", imin=imin, imax=imax)

            ymax = max(ymax, t.max())
            plt.plot(F.tab_y, 2*t, label="T$_{e, R}$")
            
            print(names[i])
        except:
            pass
        
    b = F.meanfield("B(3)", "x", imin=imin, imax=imax)
    
    plt.plot(F.tab_y, b/b.max()*ymax*2, "--", label="$B_R$")
    
    plt.vlines(2.5, 0,ymax*2, "k", ":", alpha=0.7 )
    plt.hlines(0, 0,4, "k", alpha=0.7 ,linewidth=1.5)
    plt.xlim(0, 4)
    plt.xlabel("Axial position [cm]", fontsize=11)
    
    plt.ylabel("Electron temperature T$_{e}$ [V]", fontsize=11)
    
    plt.legend(fontsize=10)
    
    plt.ylim(bottom=0, top=ymax*1.1*2)
    
plot_Te_profile()     
plt.savefig("Coches_mean_Tez_profile.pdf")
F.definecoords()
tab = F.return_cut2d(label="Ri", axe="x", position=0.5)
plt.figure()
plt.imshow(tab[:, ::-1],
           origin="lower left", vmax=1e24)
plt.colorbar()
F = field(paths[0])
F??
from LPPview.Classes.LPPic_fields import field<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1712849594019848, 'fraction_numerical': 0.02809640417579585, 'mean_word_length': 2.1934156378600824, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '344858', 'license': 'Unlicense', 'n_tokens_mistral': 3214, 'n_tokens_neox': 3029, 'n_words': 497, 'path': 'src/Chapitre6/figure/Notebooks/CH-6_Coches_results.ipynb', 'repo_name': 'antoinetavant/PhD_thesis_manuscript', 'size': '7759'}