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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################################################################
#
# Floating potential probe measurement on GOLEM tokamak
# Roman Pavelka, 2012, rework of various codes for GOLEM tokamak
#
#######################################################################
# Modules import
#################
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 os
import sys
from pygolem_lite.modules import list2array, multiplot
from pygolem_lite import Shot, saveconst, save_adv, load_adv, get_data
# Module config
################
N = 12 # number of channels
channels = arange(N) # list of channels
# Data load
############
def LoadData():
Data = Shot()
# from data_configuration.cfg
tvec, data = Data['Papouch_Za'] # Used DACQ system Papuch Zacek
data = data[:, channels]
Bt_trigger = Data['Tb'] # Time delay of torroidal mag. field
plasma_start = Data['plasma_start'] # Plasma lifespan
plasma_end = Data['plasma_end']
plasma = Data['plasma'] # Was plasma created
return tvec, data, Bt_trigger,plasma_end,plasma_start, plasma
# Analysis
###########
def analysis():
tvec, data, Bt_trigger, plasma_end, plasma_start, plasma = LoadData()
# offset_interv = (tvec > Bt_trigger)*(tvec < plasma_start)
# offset = median(dataTe[offset_interv,:], axis = 0)
# dataTe[:,0]-=offset[0]
# dataTe[:,1]-=offset[1]
data *= 101 # Resistor dividor 6k/(600k+6k)
# dU = dataTe[:,0]-dataTe[:,1]
# Te = dU/log(2); #result of the double (triple) probe theory
# plasma_interv = (tvec > plasma_start)*(tvec < plasma_end)
# Te[~plasma_interv] = 0
# Te[Te < 0] = 0
# save_adv('Te_probe', tvec, Te)
# save_adv('dU_probe', tvec, dU)
# data = map(lambda i: data[:, i], channels)
save_adv('floating_potential', tvec, data)
#index_f = open('index.html','w')
#index_f.write('<img src="floating_potential.png" width="100%"/>\n')
#index_f.close()
def graphs(file_type):
out = get_data('floating_potential', '$U_f$' , 'U [V]', xlim=[0, 40], ylim= [-1, 40] )
# out = [data[1][:,i] for i in channels]
title = "Floating potential by Roman"
# out = [get_data('dU_probe', '$U_1-U_2$ ' , "U [V]" ),
# get_data('dataTe', ['$U_1$ ', '$U_2$ '] , "U [V]" ),
# get_data('Te_probe', 'Probe $T_e$ ' , "T [eV]" , ylim=[0,None], smoothing = 1e3),
# get_data('electron_temperature_median', 'Mean plasma $T_e$ from plasma conductivity', 'T [eV]' , ylim = [0,None] , reduction = True) ]
multiplot(out, title , 'floating_potential', (10,len(out)*2), 100, 'vertical', file_type)
os.system('convert -resize 150x120\! floating_potential.png icon.png')
def main():
if sys.argv[1] == "analysis":
analysis()
if sys.argv[1] == "plots":
graphs('png')
saveconst('status', 0)
if sys.argv[1] == "test":
pass
if __name__ == "__main__":
main()
|