Source code :: main

[Return]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib 
matplotlib.rcParams['backend'] = 'Agg'
matplotlib.rc('font',  size='10')
matplotlib.rc('text', usetex=True)  # FIXME !! nicer but slower !!!
import matplotlib.pyplot as plt

from numpy import *
import numpy as np
import os
import sys
import re
from pygolem_lite.modules import list2array, multiplot, get_data
from pygolem_lite import Shot, saveconst, save_adv,load_adv


channels = [1,2]


  
def LoadData():
    
    Data = Shot()
    plasma_start = Data['plasma_start']
    plasma_end = Data['plasma_end']
    plasma = Data['plasma']
    return plasma_end,plasma_start, plasma


    
def Calc_Mean_RakeProbe():
    shot = Shot()
    t, data_st = shot['papouch_st']

    plasma_start = shot['plasma_start']
    plasma_end = shot['plasma_end']

    where_plasma = (plasma_start <= t) & (t <= plasma_end)

    rpm = [mean(data_st[where_plasma,i]) for i in range(data_st.shape[1])]
    
    positions = np.arange(1, len(rpm)+1)
    try:
        probe_position = float(re.findall('position=(\\d*)', str(shot['wwwcomment']))[0])
        positions *= 5
        positions += probe_position
        plt.xlabel('Radial probe position [mm]')
    except IndexError:
        plt.xlabel('Rake probe \#')
    

    plt.plot(positions, rpm,'ro')
    plt.ylabel('$U_{fl}$ mean')

    plt.savefig("graf.png")


def main():
    if sys.argv[1] ==  "analysis":
	Calc_Mean_RakeProbe()

	saveconst('status', 0)



if __name__ == "__main__":
    main()
    	 

Navigation