]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
new scaler display version
authorJan Michel <j.michel@gsi.de>
Tue, 10 Dec 2013 14:34:34 +0000 (15:34 +0100)
committerJan Michel <j.michel@gsi.de>
Tue, 10 Dec 2013 14:34:34 +0000 (15:34 +0100)
web/htdocs/layout/blue.css
web/htdocs/tools/scaler.pl

index c88b90712662100280c4217d36c6428473cfc804..14acdfad683eb6c6544084d0eea25f03b99d0218 100644 (file)
@@ -349,18 +349,27 @@ table.queryresult th div, table.queryresult td div {
   position:relative;
   cursor:default;
 }
-
+/*****************
+ * Table for scaler view
+ *****************/
 .scalers td:nth-child(2){
-  min-width:160px;
-/*   font-family:monospace; */
-  }
-  
-.scalers td:nth-child(3),.scalers td:nth-child(1){
   min-width:100px;
-  text-align:left;
-/*   font-family:monospace; */
+  text-align:right;  
   }
 
+.scalers td:nth-child(3){
+  min-width:100px;
+  text-align:right;
+  }
+.scalers td:nth-child(4){
+  min-width:100px;
+  text-align:right;
+  }
+table.scalers td:first-child{
+  width:85px;
+  text-align:center;
+  }  
+  
 .scalers tr:first-child {
   border-bottom:1px solid #555;
   }
\ No newline at end of file
index 7614eadcf2d885b147d068e2ad4e9eafb1c963f8..13fcbef717be7bec529ae62706fb2e4c3b7e38b5 100755 (executable)
@@ -35,31 +35,49 @@ if($ENV{'QUERY_STRING'} =~ /get/) {
     $rate->[$i] += 0x01000000 if ($rate->[$i] < 0);
     $rate->[$i] = $rate->[$i] / ($delay/1E6); 
     }
-#   if(! ref($olddata->{rate}) eq "ARRAY") {
-# #     push(@{$olddata->{rate}},$rate);
-#     }
+
   my @dat = $data->{0x3820}->{value};
+  my $start = -9;
+  my $historyexists = exists($olddata->{rate});
+  if ($historyexists && scalar @{$olddata->{rate}} < 9) {
+    $start = -(scalar @{$olddata->{rate}});
+    }
 
   for(my $i = 0; $i < 4; $i++) {
-    my $sum = 0;
+    my $avgsum = 0; $sum = 0;
     for(my $j=0;$j<4;$j++) {
       $sum += $rate->[2*$j+8+$i*16];
+      $avgsum += $rate->[2*$j+8+$i*16];
+      if($historyexists) {
+        foreach my $k ($start .. -1) {
+          $avgsum += $olddata->{rate}->[$k]->[2*$j+8+$i*16]||0;
+          }
+        }
       }
+    $avgsum /= 1-$start;
     print "<div><hr class=\"queryresult\"><table class='queryresult scalers'>";
-    $t  = sprintf("<tr><td><b>Diamond $i</b>");
-    $t .= sprintf("<td>%d<td>Sum",$sum);
-    $t .= sprintf("<td rowspan=\"6\"><img height=\"180\" width=\"500\" src=\"scaler.pl?plot%1d%d.%d\">",$i,$q,time()/5);
+    $t  = sprintf("<tr><td><b>Diamond $i</b><th>Average<th>Current<th>Ratio");
+    $t .= sprintf("<td rowspan=\"6\"><img height=\"180\" width=\"700\" src=\"scaler.pl?plot%1d%d.%d\">",$i,$q,time()/5);
+    $t .= sprintf("<tr><td>Sum<td>%d<td>%d<td>",$avgsum,$sum);
     for(my $j=0;$j<4;$j++) {
-      $t .= sprintf("<tr><td>INP %d<td title=\"%d\">%d",$j+4+$i*8,$data->{0x3820}->{value}[2*$j+8+$i*16],$rate->[2*$j+8+$i*16]);
-      $t .= sprintf("<td>(%.1f%%)",$rate->[2*$j+8+$i*16]/($sum||1E334)*100);
+      my $avgrate = $rate->[2*$j+8+$i*16];
+      if($historyexists) {
+        foreach my $k ($start .. -1) {
+          $avgrate += $olddata->{rate}->[$k]->[2*$j+8+$i*16]||0;
+          }
+        }
+      $avgrate /= 1-$start;
+      $t .= sprintf("<tr><td>INP %d<td>%d", $j+4+$i*8, $avgrate);
+      $t .= sprintf("<td title=\"%d\">%d",$data->{0x3820}->{value}[2*$j+8+$i*16],$rate->[2*$j+8+$i*16]);
+      $t .= sprintf("<td>%.1f%%",$rate->[2*$j+8+$i*16]/($sum||1E334)*100);
       }
     #$t =~ s/(?<=\d)(?=(?:\d\d\d)+\b)/&#8198;/g; 
     print $t;
-    print "<tr><td colspan=\"3\">&nbsp;</table></div>\n";
+    print "</table></div>\n";
     }
 
 
-  printf("<hr class=\"queryresult\"><p>Time between last two readings (mod 1.6s) %d ms",$delay/1000.);
+  printf("<hr classxtics=\"queryresult\"><p>Time between last two readings (mod 1.6s) %d ms",$delay/1000.);
   printf(".  %d entries",scalar @{$olddata->{rate}});
   if((scalar @{$olddata->{rate}}) >= 100) {
     shift(@{$olddata->{rate}});
@@ -89,11 +107,11 @@ elsif($ENV{'QUERY_STRING'} =~ /plot/) {
     return;
     }
   my $cmd = "";
-  $cmd .= "set terminal png xeeeeff font sans 6 size 500,180;\n";
+  $cmd .= "set terminal png font sans 6 size 700,180;\n";
   $cmd .= "set key off;\n";
   $cmd .= "unset xtics;\n";
-  $cmd .= "set lmargin 5;set rmargin 0.1;set tmargin 0.7; set bmargin 0.7;\n";
-#   $cmd .= "set ytics font \"Times, 6\";\n";
+  $cmd .= "set ylabel offset 1,0 \\\"kHz\\\";\n";
+  $cmd .= "set lmargin 8;set rmargin 0.1;set tmargin 0.7; set bmargin 0.7;\n";
   $cmd .= "plot '-' with lines,'-' with lines,'-' with lines, '-' with lines\n";
   for(my $j=0; $j<4; $j++) {
     foreach my $r (@{$data->{rate}}) {
@@ -106,7 +124,6 @@ elsif($ENV{'QUERY_STRING'} =~ /plot/) {
   print @o;
   return 1;
   }
-  
 
 
 ###############################