Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r890 - trunk/StandAlone


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r890 - trunk/StandAlone
  • Date: Tue, 7 Feb 2006 11:31:53 -0700 (MST)

Author: abe
Date: Tue Feb  7 11:31:53 2006
New Revision: 890

Modified:
   trunk/StandAlone/manta_scaling_plot.pl
Log:

Modified script to create correct scaling plots.

M    manta_scaling_plot.pl


Modified: trunk/StandAlone/manta_scaling_plot.pl
==============================================================================
--- trunk/StandAlone/manta_scaling_plot.pl      (original)
+++ trunk/StandAlone/manta_scaling_plot.pl      Tue Feb  7 11:31:53 2006
@@ -7,6 +7,9 @@
 $title = "";
 $use_errorbars = 0;
 $plot_linear = 1;
+$linear_plot_point = 0;
+$start_labels = 0;
+@use_series;
 
 sub usage {
 
@@ -14,15 +17,21 @@
         "Usage: make_scaling_plot.pl -file <infile.html>\n" .
         "-file <infile.html>  -- Input file\n" .
         "-key <string>        -- Key to search for on x axis default 
\"np\"\n" .
-        "-series <n>      -- Independent series inteleaved by n lines.\n" .
-        "                    This means that the input is interleaved.\n" .
-        "                    Default 1.\n" .
-        "-labels <label0> <label1>\n" .
-        "-plottype <string> -- default minmaxavg\n".
-        "-title <string>".
-        "-errorbars       -- Display min and max with error bars\n".
-        "-nolinear        -- Don't plot linear for each series.\n" .
-        "                 -- Specify a label for each series. (required)\n";
+        "-series <n>          -- Independent series inteleaved by n 
lines.\n" .
+        "                        This means that the input is 
interleaved.\n" .
+        "                        Default 1.\n" .
+        "-use_series <0,2,..> -- Comma delimited string indicates which 
series\n" .
+        "                        to use in output. default all\n". 
+        "-labels <label0> <label1> ...\n" .
+        "                     -- Specify a label for each series. 
(required)\n" . 
+        "-plottype <string>   -- default minmaxavg\n".
+        "-title <string>      -- Specify plot title.".
+        "-errorbars           -- Display min and max with error bars\n".
+        "-nolinear            -- Don't plot linear for each series.\n" .
+        "-linlabels <i>    -- Show linear labels beginning with point i\n";
+        "-linplotpt <i>       -- Data point to use for plotting linear 
scaling\n" .
+        "                        Default 0\n";
+
 }
 
 # Form the plot command.
@@ -61,47 +70,46 @@
     # Usual min/max/average plot.
     for ($i=0;$i<$series;++$i) {
 
-        # Determine linear plots for average.
-        my $x0 = $data[$i][0][0];
-        my $y0 = $data[$i][0][3];
-        my $x1 = $data[$i][1][0];
-        my $y1 = $data[$i][1][3];
-
-        my $m = ($y1-$y0) / ($x1-$x0);
-
-        # Plot the actual data.
-        $tmp_file = "$out_file.temp$i.txt";
-        push(@plots, 
-             #"\"$tmp_file\" using 1:2 title \"Min $labels[$i]\", " .
-             #"\"$tmp_file\" using 1:3 title \"Max $labels[$i]\", " .
-             "\"$tmp_file\" using 1:4 title \"Avg $labels[$i]\" with linesp 
lt 2 lw 3"
-             );
-
-        # Check to see if linear scaling should be plotted also
-        if ($plot_linear) {
-
-            # Add labels for percent of linear at each point.
-            for (my $p=0;$p<(@{$data[$i]});++$p) {
-                my $x = $data[$i][$p][0];
-                my $y = $m*($x-$x0)+$y0;
-                my $percent_of_lin = 
sprintf("%2.0f",(($data[$i][$p][3]/$y)*100));
-                
-                $label = $label . "set label \" $percent_of_lin%\" at 
$x,$data[$i][$p][3]\n";
-            }
+        if (use_series($i)) {
 
+            # Determine linear plots for average.
+            my $x0 = 0;
+            my $y0 = 0;
+            my $x1 = $data[$i][$linear_plot_point][0];
+            my $y1 = $data[$i][$linear_plot_point][3];
+            
+            my $m = ($y1-$y0) / ($x1-$x0);
+            
+            # Plot the actual data.
+            $tmp_file = "$out_file.temp$i.txt";
             push(@plots, 
-                 "$m*(x-$x0)+$y0 notitle with lines 1"
-                 );
-        }
-
-        # Check to see if we should use error bars.
-        if ($use_errorbars) {
-            push(@plots, 
-                 "\"$tmp_file\" using 1:4:2:3 notitle with yerrorbars" 
+                 "\"$tmp_file\" using 1:4 title \"$labels[$i]\" with linesp 
lt 2 lw 3"
                  );
+            
+            # Check to see if linear scaling should be plotted also
+            if ($plot_linear) {
+                
+                # Add labels for percent of linear at each point.
+                for (my $p=$start_labels;$p<(@{$data[$i]});++$p) {
+                    my $x = $data[$i][$p][0];
+                    my $y = $m*($x-$x0)+$y0;
+                    my $percent_of_lin = 
sprintf("%2.0f",(($data[$i][$p][3]/$y)*100));
+                    
+                    $label = $label . "set label \" $percent_of_lin%\" at 
$x,$data[$i][$p][3]\n";
+                }
+                
+                push(@plots, 
+                     "$m*(x-$x0)+$y0 notitle with lines 1"
+                     );
+            }
+            
+            # Check to see if we should use error bars.
+            if ($use_errorbars) {
+                push(@plots, 
+                     "\"$tmp_file\" using 1:4:2:3 notitle with yerrorbars" 
+                     );
+            }   
         }
-
-
     }
 
     $plot = "$plot\n$label\nplot " . join( ", ", @plots ) . "\n";
@@ -110,6 +118,15 @@
     return $plot;
 }
 
+sub use_series {
+    my $s = $_[0];
+    foreach (@use_series) {
+        if ($_ == $i) {
+            return 1;
+        }
+    }
+    return 0;
+}
 
 # Parse args
 for ($i=0;$i<@ARGV;++$i) {
@@ -119,6 +136,9 @@
     elsif ($ARGV[$i] eq "-series") {
         $series = $ARGV[++$i];
     }
+    elsif ($ARGV[$i] eq "-useseries") {
+        @use_series = split(/\,/, $ARGV[++$i]);
+    }
     elsif ($ARGV[$i] eq "-labels") {
         ++$i;
         while (($i < @ARGV) && !($ARGV[$i] =~ /^-/)) {
@@ -143,6 +163,12 @@
     elsif ($ARGV[$i] eq "-nolinear") {
         $plot_linear = 0;
     }
+    elsif ($ARGV[$i] eq "-linplotpt") {
+        $linear_plot_point = $ARGV[++$i];
+    }
+    elsif ($ARGV[$i] eq "-linlabels") {
+        $start_labels = $ARGV[++$i];
+    }
 }
 
 # Check to see if enough subtitles were provided.
@@ -163,6 +189,16 @@
 if ($out_file eq "") {
     $out_file = $input_file;
     $out_mode = ">>";
+}
+
+# Determine which series to use.
+if (@use_series == 0) {
+    for (my $i=0;$i<$series;++$i) {
+        push(@use_series,$i);
+    }
+}
+else {
+    print "Only using series: " . join(@use_series, ", ") . "\n";
 }
 
 # Open input file.




  • [MANTA] r890 - trunk/StandAlone, abe, 02/07/2006

Archive powered by MHonArc 2.6.16.

Top of page