global $Mode; if ($Mode != "beginner") step_header("4"); ?>
You are at Step 4: Check Results, in
global $Mode;
if ($Mode == "beginner")
echo "beginner mode.";
else if ($Mode == "intermediate")
echo "intermediate mode.";
else if ($Mode == "expert")
echo "expert mode.";
?>
global $Mode;
if ($Mode == "beginner") { ?>
You are finally ready to visualize the results. Do the following:
You are done! We suggest you to read the overview of the project, then go back to the initial page and select the intermediate mode. Good luck! } else if ($Mode == "intermediate") { ?>
Here you can analyze all or part of the results, in a table and graph format.
To continue, proceed to either Step 1 and select new problems, or to Step 2 and specify new solution techniques.
Note: if you use the back button, your results will not be recorded. Please use the Step button at the top of this page if you want to go back to Step 1 or 2.
} else if ($Mode == "expert") { ?>
} ?>
Recorded results:
Nothing has been selected for plotting, please check at least one result in the plot this value column.";
else {
$timestamp = date("y-m-d_H.i.s", time());
global $ymin;
global $ymax;
global $y_legend;
global $red_legend;
global $blue_legend;
global $yellow_legend;
global $purple_legend;
global $green_legend;
$myFile = $TempDirectory . "/gnuplot-" . $timestamp . '.dat';
$fh = fopen($myFile, 'w') or die("can't open file");
if ($PLOTTER == "GNUPLOT")
{
fwrite($fh, "set title 'evaluation'\n");
fwrite($fh, "set ylabel 'phi'\n");
fwrite($fh, "set terminal push\n");
fwrite($fh, "set terminal png\n");
fwrite($fh, "set autoscale\n");
fwrite($fh, "set output '" . $TempDirectory . "/gnuplot-" . $timestamp . ".png'\n");
fwrite($fh, 'set xtics rotate ("" 0 ');
$count = 1;
$new_count = 1;
foreach (explode(':', $ResultIDs) as $i)
{
if ($i == "") continue;
if ($_POST['plot_' . $count] == "Yes")
{
$j = explode('@', $i);
fwrite($fh, ', "' . $j[1] . '" ' . $new_count++ . " ");
}
$count++;
}
fwrite($fh, ")\n");
fwrite($fh, 'set xrange [0:' . ($new_count) . ']' . "\n");
if ($ymin != -1.0 && $ymax != 1.0)
fwrite($fh, 'set yrange [' . $ymin . ':' . $ymax . ']' . "\n");
fwrite($fh, "set boxwidth 1\n");
fwrite($fh, "set style fill solid\n");
//fwrite($fh, "set style fill solid 0.25 border\n");
fwrite($fh, "set nokey\n");
fwrite($fh, "set boxwidth 0.8\n");
fwrite($fh, "plot '-' using 1:2 w boxes\n");
$count = 1;
$new_count = 1;
foreach (explode(':', $ResultIDs) as $i)
{
if ($i == "") continue;
if ($_POST['plot_' . $count] == "Yes")
{
$j = explode('@', $i);
fwrite($fh, $new_count++ . " " . $j[0] . "\n");
}
$count++;
}
fwrite($fh, "end\n");
fwrite($fh, "set output\n");
fwrite($fh, "set terminal pop\n");
fclose($fh);
passthru('/usr/bin/gnuplot /tmp/gnuplot-' . $timestamp . ".dat");
if ($new_count != 1)
{
echo '';
}
}
else if ($PLOTTER == "PyChart")
{
fwrite($fh, "from pychart import *\n");
fwrite($fh, "theme.get_options()\n");
fwrite($fh, "theme.use_color = 1\n");
fwrite($fh, "theme.reinitialize()\n");
$IsFirst = 1;
$count = 1;
$new_count = 1;
fwrite($fh, 'labels = [');
foreach (explode(':', $ResultIDs) as $i)
{
if ($i == "") continue;
if ($_POST['plot_' . $count] == "Yes")
{
$j = explode('@', $i);
if ($IsFirst == 1)
{
$IsFirst = 0;
}
else
{
fwrite($fh, ', ');
}
$xxx = str_replace('/', '//', $j[1]);
fwrite($fh, '("/4/a90{}' . $xxx . '", ' . $new_count++ . ")");
}
$count++;
}
fwrite($fh, "]\n");
fwrite($fh, "chart_object.set_defaults(area.T, size = (150, 120), ");
if ($ymin != -1.0 && $ymax != -1.0)
fwrite($fh, "y_range = ($ymin, $ymax),");
fwrite($fh, " x_coord = category_coord.T(labels, 0))\n");
if ($ymax == $ymin)
$tic = 1000;
else
{
$tic = floor(($ymax - $ymin) / 10);
if ($tic < 1) $tic = 1;
}
fwrite($fh, 'ar = area.T(x_axis=axis.X(label=""), y_axis=axis.Y(label="');
fwrite($fh, $y_legend . '", tic_interval=' . $tic . '))' . "\n");
$ColorList = "";
$count = 1;
foreach (explode(':', $ResultIDs) as $i)
{
if ($i == "") continue;
if ($_POST['plot_' . $count] == "Yes")
{
$NewColor = $_POST['color_' . $count];
if (strstr($ColorList, $NewColor) == FALSE)
$ColorList .= " " . $NewColor;
}
$count++;
}
foreach (explode(' ', $ColorList) as $color)
{
if ($color == "") continue;
fwrite($fh, 'ar.add_plot(');
fwrite($fh, 'bar_plot.T(label="');
if ($color == "red")
fwrite($fh, $red_legend);
else if ($color == "darkseagreen")
fwrite($fh, $green_legend);
else if ($color == "aquamarine1")
fwrite($fh, $blue_legend);
else if ($color == "darkorchid")
fwrite($fh, $purple_legend);
else if ($color == "goldenrod")
fwrite($fh, $yellow_legend);
else
fwrite($fh, "not-set");
fwrite($fh, '", data = [');
$IsFirst = 1;
$count = 1;
foreach (explode(':', $ResultIDs) as $i)
{
if ($i == "") continue;
if ($_POST['plot_' . $count] == "Yes")
{
$scale = $_POST['scale_' . $count];
if ($_POST['op_' . $count] == "squared")
$scale *= $scale;
else if ($_POST['op_' . $count] == "half")
$scale = sqrt($scale);
else if ($_POST['op_' . $count] == "threehalves")
$scale *= sqrt($scale);
else if ($_POST['op_' . $count] == "four")
$scale *= sqrt(sqrt($scale)) * sqrt($scale);
if ($_POST['color_' . $count] == $color)
{
$j = explode('@', $i);
if ($IsFirst) $IsFirst = 0;
else
fwrite($fh, ', ');
$xxx = str_replace('/', '//', $j[1]);
fwrite($fh, '("/4/a90{}' . $xxx . '", ' . $j[0] / $scale . ")");
}
}
$count++;
}
fwrite($fh, "], \n");
fwrite($fh, 'fill_style = fill_style.' . $color . ')' . "\n");
fwrite($fh, ")\n");
}
fwrite($fh, "ar.draw()\n");
fclose($fh);
global $PYTHONPATH;
global $TempDirectory;
global $ImageDirectory;
global $HTMLImageDirectory;
$command = "PYTHONPATH=$PYTHONPATH ";
$command .= 'python ' . $TempDirectory . '/gnuplot-' . $timestamp . ".dat --format=png --scale=3 --output=" . $ImageDirectory . "/gnuplot-" . $timestamp . ".png 2>&1";
passthru($command);
echo '
';
}
}
}
?>