Exemplo n.º 1
0
import numpy as np
import MDSplus as mds
import utils.plot_utils as au
import matplotlib
import matplotlib.pyplot as plt
from scipy import integrate
import scipy.interpolate as interp
col, col2, styles, my_cmap, dpi = au.define_colors()

#for now just need tor flux, pol flux, q, j, press


def get_tcv_eq(shot, time):
    """
    
    """
    conn = mds.Connection('tcvdata.epfl.ch')
    conn.openTree('tcv_shot', shot)

    #t = mds.Tree('tcv_shot', shot)
    #iptr_s = t.getNode(r'\magnetics::iplasma:trapeze')
    liuqe_flavour = 'LIUQE.M'
    _d = {'label': '', 'x': [], 'y': []}
    signals = {
        'p': dict.copy(_d),
        'q': dict.copy(_d),
        'torflux': dict.copy(_d),
        'i': dict.copy(_d),
        'polflux': dict.copy(_d),
        'f': dict.copy(_d),
        'jbs': dict.copy(_d)
Exemplo n.º 2
0
import matplotlib.pyplot as plt
import a4py.classes.ReadEQDSK as ReadEQDSK
import h5py
import a5py.ascot5io.ascot5 as a5
import numpy as np
from utils.plot_utils import common_style, limit_labels, define_colors
import scipy.interpolate as interp
from matplotlib.lines import Line2D
import sys
#sys.path.append('/home/matval/WORK/pythonscripts/python/')                                                                                           
from a5py.ascotpy.ascotpy import Ascotpy

common_style()
_,_,_, my_cmap, _ = define_colors()

class TFripple():

    def __init__(self, field_fname='/home/vallar/WORK/JT-60SA/3D/TFripple/ascot_TFcoilout_cocos5.h5',\
        coils_fname='/home/vallar/WORK/JT-60SA/3D/JT60SA_3Dfield.h5'):
        """
        """
        self.N=18
        self.read_file(field_fname, coils_fname)

    def read_file(self, field_fname, coils_fname):
        """ 
        coils,f,eqd = read_file()
        """ 
        try:
            self.coils = h5py.File(coils_fname, "r")
        except:
Exemplo n.º 3
0
import a5py.ascot5io.ascot5 as a5
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from utils.plot_utils import common_style, define_colors
import matplotlib.ticker as ticker

common_style()
colours, colours_old, styles, my_cmap, dpi= define_colors()
f=a5.Ascot('/home/vallar/WORK/ASCOT/runs/SA_003/fullpower/production/ascot_fullpower_2d_and_3d.h5')
# run_0766036146 RIPPLE
# run_2107319306, 2D - ACTIVE
data={
	'2D':
		{'run':f.run_2107319306,
		},
	'3D':
		{'run':f.run_1162028518,
		}
}
print('data dict created!')
E_edges=np.linspace(10e3, 500e3, 100)
xi_edges=np.linspace(-1, 1., 100)

for label in data.keys():
	endstate = data[label]['run'].endstate
	ind_wall = np.where(endstate['endcond']==32)
	data[label]['ind_wall'] = ind_wall

	E = endstate['energy'][ind_wall] # in J
	data[label]['E_end']=E/1.602e-19 # in keV
Exemplo n.º 4
0
import pytransp.classes.transp_exp as te
import numpy as np
import matplotlib.pyplot as plt
import utils.plot_utils as pu

colors,_,_,_,_ = pu.define_colors()

def compare_n0(fname_sim=['/home/vallar/TCV/58823/58823V71.CDF'], fname_exp='/home/vallar/TCV/58823/58823n0.dat', t=0.9):
    """
    Compares edge density between CDF output of TRANSP and n0 from experiments
    
    Parameters:
        fname_sim  arr  : array of strings with the name of CDF files
        fname_exp  str  : string of name where n0 at edge is stored
        t          float: time where to compute profile
    Returns:
        n0_exp  dict: dict with time and n0 of experiment
        n0_sim  dict: dict with time and n0 of CDF files
    
    """
    if type(fname_sim)==str: fname_sim=[fname_sim]

    # read data from experiments
    n0data = np.loadtxt(fname_exp)

    # start plot, it will be needed inside the for loop
    f1d = plt.figure(); ax1d=f1d.add_subplot(111)
    f=plt.figure(); ax=f.add_subplot(111) 
    ax.plot(n0data[:,0], n0data[:,1], 'k--', label='EXP')
    n0_exp = {}; n0_exp['t']=n0data[:,0]; n0_exp['n0']=n0data[:,1]
    n0_sim = {};   
Exemplo n.º 5
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec  4 12:03:45 2019

@author: vallar
"""
import a5py.ascot5io.ascot5 as a5
from a5py.ascotpy.ascotpy import Ascotpy
import a5py.marker.evaluate as eval_mrkr
import numpy as np
import matplotlib.pyplot as plt
from utils.plot_utils import common_style, limit_labels, define_colors
import plot_tips
common_style()
col, _, _, _, _ = define_colors()


def evaluate_derived_quant(orb, id_part):
    # evaluate derived quantities
    ind = np.where(orb['id'] == id_part)[0]
    pitch = eval_mrkr.eval_particle('pitch',
                                    mass=2. * 1.60e-27,
                                    charge=None,
                                    R=None,
                                    phi=None,
                                    z=None,
                                    vpar=orb['vpar'][ind],
                                    mu=orb['mu'][ind],
                                    theta=None,
                                    BR=orb['br'][ind],