##!/usr/bin/python2
## -*- coding: utf-8 -*-
##""" CREATED: 7/2012
##AUTHOR: MICHAL ODSTRCIL
##"""
<%page args="shot, page"/>
<%
import os
from pygolem_lite.web import cat, emph, get_page_paths, make_config
page_path, base_path, page = get_page_paths(shot, page)
youtube = "tomography/youtube_url"
from pygolem_lite import Shot, saveconst
import random
%>
<a href="#original">Original image </a><br/>
<a href="#correct">Corrected image </a>
<?php
#$youtube = "tomography/youtube_url";
#if (file_exists($youtube)) {
#echo '<h2>Visible spectra tomography</h2>';
#$fp = fopen($youtube, "r");
#$url = fgets($fp, 1024);
#echo "<iframe width='480' height='390' src=$url frameborder='0' allowfullscreen></iframe>";
#//http://www.youtube.com/embed/AiPHnA0k4v0
#echo ' <img src="schema_server.png" /> ';
#}
if (file_exists('tomography/video.avi')) {
?>
<h2>Tomographic reconstruction </h2>
##<a href="tomography/video.avi"> Show plasma animation </a>
<video controls>
<source src="tomography/video.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
<source src="tomography/video.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video><br/>
<?php
}
#if (file_exists('tomography/SVD.png')) {
?>
<h2>Color emissivity</h2>
<img src='tomography/colors_1.png'>
<img src='tomography/colors_2.png'><br/>
##<h2>Singular value decomposition</h2>
##<img src='tomography/SVD.png'><br/>
##<?php } ?>
% for camera in [1,2]:
<?php
if (file_exists("${ str(camera)+'/plasma_all.png' }")) {
?>
<h2>Camera ${camera} - time evolution</h2>
##<h3>Parameters:</h3>
##${make_config(page_path+'/'+str(camera)+'/parameters.txt')}
<a id="corrected"><h3>Corrected image</h3></a>
<img src='${camera}/CorrectedRGB.png?${random.randint(1,1e6)}'></img><br/>
<a id="original"><h3>Original image</h3></a>
<img src='${camera}/plasma_all.png?${random.randint(1,1e6)}'></img><br/>
<% correct = True %>
<?php } ?>
%endfor
<?php
if ( ! file_exists('1/') && ! file_exists('2/')) {
$plasma = ${Shot(shot)['plasma']};
if ( $plasma == 1 ) {
echo '<h2>Camera failed </h2>';
} else {
echo '<h2>No plasma</h2>';
}
}
?>
${Shot(shot).get_pygolem_list(['camera:output_power_tomo', 'camera:position_horizontal_tomo', 'camera:position_vertical_tomo', 'camera:color_emiss_1', 'camera:color_emiss_2'])}