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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
##!/usr/bin/python2
## -*- coding: utf-8 -*-

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

<%page args="shot, page, default_path"/>

<%!
    import os, re, datetime
    import numpy as np
    from pygolem_lite.web import cData
    from pygolem_lite.web import cat, 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 random, commands
%>
<%

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

def get(diagn, *args):
    out = cData.get_nice(diagn, *args)
    return "<a href='Data.php#"+diagn.lower()+"'>"+out+"</a>"

def get_wiki_links():
    wiki_path = "/srv/www/svoboda/golem/wiki/wikidata"
    wiki_url = "http://golem.fjfi.cvut.cz/wiki/"
    links = commands.getstatusoutput('cd '+wiki_path+';  git grep -I --ignore-case --all-match --word-regexp --cached  --files-with-matches   -e '+str(shot)+' --  "*.page"')[1]
    if len(links) == 0: return []
    links = re.sub('\.page', '', links).split('\n')
    link_urls = ", ".join(["<a href='"+wiki_url + l+"'>"+l+"</a>" for l in links])
    return link_urls
    


def make_menu(base, levels):
    try:
	page_list = []
	paths = sorted([  base +  '/'  + i for i in os.listdir(base_path + base) \
	if os.path.isdir(base_path +  base +  '/'  + i ) ])
	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):
		    if os.path.isdir(  base_path  +  path +"/"+ item  ):
			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 Exception, e:
	print "!!!!!!! menu_make in home.template failed: " + str(e), 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>

<?php   include 'tags.template'; ?> 


## 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">
%try:
    <tr class="field"><th class="field-name">Date:</th><td class="field-body">
    ${cData['date']} - <b> ${cData['time']} </td>
    </tr>
%except:
    
%endtry


<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")}'>\
${cData['session_name']}</a> 

<a href='http://golem.fjfi.cvut.cz/utils/session_list?session_list=${cData["date_str"]}:${cData["session_name"]}'>\
[new]</a> 

</td>

</tr>
<tr class="field"><th class="field-name">Comment:</th><td class="field-body"> \
%try:
    <b>${ emph(get('wwwcomment') ) }</b>
%except:
    Loading of wwwcomment failed
%endtry 
</td>
</tr>

<% 
try:
    links = get_wiki_links()
except:
    links = []
%> 

%if len(links) > 0:
    </tr>
    <tr class="field"><th class="field-name">Wiki links:</th><td class="field-body"> \
    ${links}
    </td>
    </tr>
%endif


</tbody>
</table>

<%  plasma_status = cData['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/utils/golplot?action=Plot+All&shotno_0=${shot}&diagn_0=loop_voltage&shotno_1=${shot-1}&diagn_1=loop_voltage">compare</a>)</font> </h2>
##<a href="http://golem.fjfi.cvut.cz/golplot/index12.php">compare</a>

<ul>
    %try:
      
	<li>Gas pressure p<sub>ch</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:
	%try:
	    %if  int(cData['gas_filling']):
		${emph(get('working_gas'))}
	    %else:
		None
	    %endif
	%except:
	    None
	%endtry
	</li>
	<li>Preionization: ${ "ON" if int(cData['preionization']) else "OFF"}</li>

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

	<li>C<sub>B<sub>t</sub></sub> capacitors changed 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 changed 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 changed 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 changed 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 cData['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 cData['noise_level'] > 0.03 else "" }
	%except:

	%endtry
      <li> Probability of breakdown: ${get('breakdown_probability', '%i%%')} ${wiki("/Education/ExperimentMenu/BreakdownStudies/Breakdownstudies")}  </li>
      <li>Time since session beginning: ${str(datetime.timedelta(seconds=int(cData['session_length'])))} h</li>
    %except Exception, e:
	<h2> Parameters loading failed: ${str(e)} </h2>
    %endtry

    
    </ul>
    </td>
    <td>



%try:
    % if cData["plasma"] == 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/Breakdownstudies")} </li>
	<li><a href='/shots/${shot}/analysis/Basics/0612AdvancedAnalysis.ON/#power_balance'>Ohmic heating power: </a> ${get('input_power_mean', '%.2f', 1e-3)}   kW</li>
	<li><a href='/shots/${shot}/analysis/Basics/0612AdvancedAnalysis.ON/#safety_factor'>Q edge:</a>  ${get('safety_factor_mean', '%.1f')} ${wiki("http://fusionwiki.ciemat.es/wiki/Rotational_transform")} </li>
	<li><a href='/shots/${shot}/analysis/Basics/0612AdvancedAnalysis.ON/#electron_temperature'>Electron temperature:</a>  ${ emph( get('temperature_mean', '%.1f'))} eV ${wiki("/Diagnostics/Basic/Uloop/index#theory")}</li>
	<li><a href='/shots/${shot}/analysis/Basics/0612AdvancedAnalysis.ON/#density'>Line electron density:</a>  ${ emph(get('electron_density_mean', "%.2f" , 1e-17) ) } [10^17.m^-2] 
	${wiki("/Diagnostics/Basic/Interferometry/index")} </li>
	</ul>
	
    %endif


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

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

<?php 
if (file_exists("basicdiagn/graphpres.png"))
{
?>
   #####################
    
    ## need to be changed if you add more diagnostics 
    <% 
    N_rows = 5 if (cData.exist('electron_density_mean')  and cData['electron_density_mean'] > 1e16 \
	and cData['electron_density:reliability'] < 0.25 and cData['plasma'] == 1 ) else  4  # number of rows depends on density 
    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):
	## je to humus, kdo chce at si to opravi sam poradne 
	<td height=${int(550./N_rows)}>  
	%try:
	    <font size=1>
	    <b><a href="http://golem.fjfi.cvut.cz/wiki${wiki_links[i]}">WIKI</a></b>
	    </font>
	%except:
	    Missing wiki link
	%endtry
	</td></tr><tr valign="top">
    %endfor
    </tr>
    </table>
    ######################
<?php } ?>


    <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>
    ##<li><a href="analysis/Basics/0411ShotHomepage.ONN/"/>Accessing data</a> </li>
    ##%for tp in ['txt', 'xls']:
	<li> Basic diagnostics:
	%for i in ['loop_voltage', 'plasma_current', 'toroidal_field', 'photodiode', 'hxr']:
	    ##<a href='http://golem.fjfi.cvut.cz/utils/data/${shot}/${i}.${tp}'>${i}</a>,
	    <a href='Data.php#${i}'>${i}</a>,
	%endfor 
	<a href='Data.php#all_data'> <b>other diagnostics </b></a>
	</li>
    ##%endfor
    
    </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  (cData['plasma'] == 1 and cData['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 Exception, e:
    <h3>  ee failed <%  str(e) %> <% shot %>  </h3> 
  %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

«