Source code :: home.php

[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
 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
##!/usr/bin/python2
## -*- coding: utf-8 -*-

##""" CREATED: 7/2012
##    AUTHOR: MICHAL ODSTRCIL
##"""

<%!
    import os, re, datetime
    import numpy as np
    from bottle import static_file
    from pygolem_lite.modules import cat, Data, loadconst , emph, modified, make_zoom_image, get_page_paths, wiki
    from os.path import split, exists
    from pygolem_lite.config import  TororoidalMagneticFieldTrigger, TororoidalMagneticFieldCapacitor, CurrentDriveElectricFieldCapacitor, StabilizationCapacitor, BreakDownElectricFieldCapacitor
    import datetime
    import random
%>
<%page args="shot, page, default_path"/>

<%

page_path, base_path, page  = get_page_paths(shot, page, default_path)
get = Data.get_nice

s = cat(base_path + "/date")
  #nicely formated date 
shot_date = '20'+s[4:6]+'-'+s[2:4]+'-'+s[:2] 


def make_menu(base, levels):
    try:
	page_list = []
	paths = sorted([  base +  '/'  + i for i in os.listdir(base_path + base) ])
	for path in paths:
	    if levels == 1:
		page_list.append([ split(path)[0] , split(path)[-1]])
	    elif levels == 2:
		for item in os.listdir(base_path + path):
		    page_list.append([ path , item])
	i = 0
	for page in page_list:
	    make_item(page[0], page[1])
	    i += 1
	    if i > 4:    # split row if it is too long !!!
		newline()
		i = 0
    except:
	print "!!!!!!! menu_make in home.template failed ", base, levels
%>
<%def name="newline()">
    </tr><tr>
</%def>

<%def name="make_item(path, item)">
    <%
	path  = path+'/'+item+'/'
	# remove names, dates, initials
	name  = re.sub('(\d+)([a-zA-Z\ ]+)([_\.\w]+)', r'\2',  item)
	name = re.sub('([\w]+)/([a-zA-Z\ ]+)', r'\2',  name)
    %>
    <td valign="bottom">
	<a href='${path}'> \
	<?php
	if (file_exists("${path + 'icon.png'}"))
	{
	    echo "<img src='${path}/icon.png?${random.randint(1,1e6)}' width='150px'/><br/>";
	}
	else
	{
	    echo "<img src='/_static/failed.png'/><br/>";
	}
	?>
	    <center>${name}</center>
	    </a>
    </td>
</%def>


## add link to the log of web creation 
<a class="viewcode-back" href="${ 'web_log'}"> ${emph("[WebLog]")}</a>
			
			

<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">

<tr class="field"><th class="field-name">Date:</th><td class="field-body">
  ${shot_date} - <b> ${cat(base_path + "/starttime")} </td>
</tr>

<tr class="field"><th class="field-name">Session:</th><td class="field-body">\
<a href='http://golem.fjfi.cvut.cz/tasks/${cat(base_path + "/SessionNameDate")}'>\
${cat(base_path + "/SessionName")}</a>  </td>

</tr>
<tr class="field"><th class="field-name">Comment:</th><td class="field-body"><b>\
${ emph(cat(base_path+'wwwcomment') )}</b></td>
</tr>

</tbody>
</table>

<%  plasma_status = get('plasma_status')  %>
%if plasma_status != "OK":
	<h3> <font color='red'> Machine failure: ${plasma_status}  </font></h3>
%endif

<% ee(shot) %>



<table >
<tr valign='top'>
<td>
<h2>&nbsp;&nbsp;&nbsp;&nbsp;Basic parameters:  <font size='3'>(<a href="http://golem.fjfi.cvut.cz/golplot/index12.php">compare</a>)</font> </h2>

<ul>
    %try:
      
	<li>Chamber pressure p<sub>chamber</sub> : ${ emph( get('pressure_initial', '%.2f'))}-&gt; ${ emph( get('pressure', '%.2f'))}  mPa
	(request: ${ get('pressure_request', '%i')} mPa) ${wiki("/predecessor-CASTOR/Vacuum/vacuum")}     </li>
	<li>Working gas:
	%if int(get('gas_filling')):
	    ${emph(get('working_gas'))}
	%else:
	    None
	%endif
	    </li>
	<li>Preionization: ${ "ON" if int(get('preionization')) else "OFF"}</li>

	<li>Chamber temperature: ${get('chamber_temperature', '%.2f')} C</li>

	<li>C<sub>B<sub>t</sub></sub> capacitors ( ${get('Cb', '%.1f', 1e3)} mF) charged to: ${emph(get('Ub', '%i V'))}, \
	triggered ${emph(get('Tb', '%.1f ms', 1e3))}  ${wiki("/Infrastructure/Capacitors/ToroidalMagneticFieldLine/generation_toroidal")}</li>
	<li>C<sub>BD</sub> capacitors (${get('Cbd', '%.1f', 1e3)} mF) charged to: ${emph(get('Ubd', '%i V'))}, triggered \
	${emph(get('Tbd', '%.1f ms', 1e3))} ${wiki("/Tokamak/Coils/TransformerPrimary-BreakdownElectricField/generation_transformer")}</li>
	<li>C<sub>CD</sub> capacitors (${get('Ccd', '%.1f', 1e3)} mF) charged to: ${emph(get('Ucd', '%i V'))}, triggered  \
	${emph(get('Tcd', '%.1f ms', 1e3))}  ${wiki("/Tokamak/Transformer/coils_transformer") } </li>
	<li>C<sub>ST</sub> capacitors (${get('Cst', '%.1f', 1e3)} mF) charged to: ${emph(get('Ust', '%i V'))}, triggered \
	${ emph(get('Tst','%.1f ms', 1e3))}   ${wiki("/Tokamak/Coils/Stabilization/coils_stabilisation")}</li>
	%try:
	    ${ ( "<li><font color='red'> Max saturation of iron core transformator:  " + get('transformator_saturation', '%i%%', 100) + " </font> " + wiki("/Tokamak/Transformer/coils_transformer") + "</li>" ) if float(get('transformator_saturation')) > 0.8 else "" }
	    ${ ( "<li><font color='red'>  Level of noise <a href='basicdiagn/graphpresb.png'>(dBt)</a> in room:  " + get('noise_level', '%0.3f V') + " </font> </li>" ) if float(get('noise_level')) > 0.03 else "" }
	%except:
	    pass
	%endtry
      <li>Time since session beginning: ${str(datetime.timedelta(seconds=int(get('time'))))} h</li>
    %except Exception, e:
	<h2> Parameters loading failed: ${str(e)} </h2>
    %endtry

    
    </ul>
    </td>
    <td>



%try:
    % if cat(base_path+'basicdiagn/Plasma')[0] == "1":
    <h2>&nbsp;&nbsp;&nbsp;&nbsp;Plasma parameters:</h2>

	<ul>
	<li>Plasma life time <b> ${get('plasma_life', '%.1f', 1e3)} </b> [ms] (from  ${ get('plasma_start', '%.1f', 1e3)} to ${get('plasma_end', '%.1f', 1e3)}) </li>
	<li>Mean toroidal magnetic field Bt:  ${get('toroidal_field_mean', '%.2f')}  T ${wiki("/Diagnostics/Basic/ToroidalMagneticField/index")}</li>
	<li>Mean plasma current: ${ get('plasma_current_mean', '%.2f', 1e-3)}  kA ${wiki("/Diagnostics/Magnetic/RogowskiCoilArroundChamber/Theory/diagnostics_rogowski")}</li>
	<li>Mean Uloop: ${get('loop_voltage_mean', '%.2f')}  V ${wiki("/Diagnostics/Basic/Uloop/index")}</li>
	<li>Break down voltage: ${get('breakdown_voltage',  '%.1f') }  V ${wiki("/Education/ExperimentMenu/Breakdownstudies")} </li>
	<li><a href='analysis/Basics/0612AdvancedAnalysis.ON/#power_balance'>Ohmic heating power: </a> ${get('input_power_mean', '%.2f', 1e-3)}   kW</li>
	<li><a href='analysis/Basics/0612AdvancedAnalysis.ON/#safety_factor'>Q edge:</a>  ${get('Q95_mean', '%.1f')} ${wiki("http://fusionwiki.ciemat.es/wiki/Rotational_transform")} </li>
	<li><a href='analysis/Basics/0612AdvancedAnalysis.ON/#electron_temperature'>Central electron temperature:</a>  ${ emph( get('temperature_mean', '%.1f'))} eV ${wiki("/Diagnostics/Basic/Uloop/index#theory")}</li>
	<li><a href='analysis/Basics/0612AdvancedAnalysis.ON/#density'>Line electron density:</a>  ${ emph(get('electron_density_mean', "%.2f" , 1e-19) ) } [10^19.m^-3] 
	${wiki("/Diagnostics/Basic/Interferometry/diagnostics_interferometry")} </li>
	</ul>
	
    %endif


%except Exception, e:
    <h2> Plasma parameters loading failed: ${str(e)} </h2>
%endtry

</td>
</tr>
</table>


#####################
## need to be changed if you add more diagnostics 
<% N_rows = 4 if get('electron_density_mean') == "N/A" else 5 
wiki_links = [ "/Diagnostics/Basic/Uloop/index", "/Diagnostics/Basic/ToroidalMagneticField/index", "/Diagnostics/Basic/PlasmaCurrent/index" , "/Diagnostics/Radiation/Photocel/photocell", "/Diagnostics/Basic/Interferometry/index"]

%>

<table cellpadding="3">
<tr valign="top">
<td rowspan="${N_rows}">
${make_zoom_image( 'basicdiagn/graphpres' , "", "_home")}
</td>
%for i in range(N_rows):
    <td> 
    %try:
	##<div style="position: relative; left: -0px">
	<font size=1>
	<b><a href="http://golem.fjfi.cvut.cz:5001${wiki_links[i]}">WIKI</a></b>
	</font>
	##</div>  
	##<a href="http://golem.fjfi.cvut.cz:5001${wiki_links[i]}"><img src="/_static/wiki.png" /></a>
    %except:
	Missing wiki link
    %endtry
    </td></tr><tr valign="top">
%endfor
</tr>
</table>
######################

    <ul>
    <li>basicdiagn processing evolution:
    <?php
    if (file_exists('basicdiagn/graphpres.svgz')) {
      $ending="svgz"; }
    else {
      $ending="png"; }
    ?>
    <a href='basicdiagn/graphpresb.<?php echo $ending ?>' rel="lightbox_home"  >raw</a>&#8594;
    <a href='basicdiagn/graphpresi.<?php echo $ending ?>' rel="lightbox_home"  >integrated</a>&#8594;
    <a href='basicdiagn/graphpresfull.<?php echo $ending ?>' rel="lightbox_home"  >final</a>

    <li><a href="analysis/Basics/0411ShotHomepage.ONN/"/>Accessing data</a> 
    <ul>
    <li> Basic diagnostics txt: 
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/loop_voltage'>loop_voltage</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/plasma_current'>plasma_current</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/toroidal_field'>toroidal_field</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/photodiode'>photodiode</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/niturbo6251'>hxr</a></li>
    <li> Basic diagnostics xls: 
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/loop_voltage.xls'>loop_voltage</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/plasma_current.xls'>plasma_current</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/toroidal_field.xls'>toroidal_field</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/photodiode.xls'>photodiode</a>,
    <a href='http://golem.fjfi.cvut.cz/cgi-bin/data/${shot}/niturbo6251.xls'>hxr</a></li>
    </ul>
    </li>
    </ul>




<h2>Data Acquisition Systems (DAS):</h2>
<table>
<tr>
    <% make_menu('DAS', 1) %>
</tr>
</table>

<h2>Diagnostics: </h2>
<table>
<tr>
    <%make_menu('diagnostics', 2) %>
</tr>
</table>

<h2>Analysis:</h2>
<table>
<tr>
   <%make_menu('analysis', 2) %>
</tr>
</table>

<%def name="ee(shot)">
  %try:
      %if np.mod(shot, 10000) == 0 or  (get('plasma') == 1 and np.float(get('electron_temperature_max')) > 80 ):
	  <h3> <font color='red'> Congratulation, you have reached nuclear fusion. <br> The following explosion destroyed half of Prague and radioactive fallout contaminated whole Europe. <br> Have a nice day  </font></h3>
	  <img src="/_static/nuclear.png" />
      %endif
  %except:
      <% print "ee failed" %> 
  %endtry
</%def>


<h2> Acknowledgement: </h2>

<table cellpadding="5">
<tr>
<td valign='middle' align='center' >
<div  style="display:table-cell; vertical-align:middle">
<a href=http://www.fusenet.eu><img src="/_static/logos/fusenet_logo.gif" width="150px"></a>
</div>
</td>
<td valign='middle'>
<a href=http://jaderka.cz><img src="/_static/logos/fjfi.svg" width="80px"></a>
</td>
</tr>
</table>

<hr/>

Thanks to the specific help
<span style="display:inline-block; vertical-align:middle">
<a href=http://www.ni.com/><img src="/_static/logos/National_Instruments.svg" width="150px"></a> </span>
and
<span style="display:inline-block; vertical-align:middle">
<a href=http://www.pfeiffer-vacuum.com><img src="/_static/logos/Pfeiffer_Vacuum_Technology.svg" width="150px"</a></span>

Navigation