Changeset 29114 for trunk/tools/czartool/Czarplot.pm
- Timestamp:
- Sep 2, 2010, 3:09:56 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/tools/czartool/Czarplot.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/czartool/Czarplot.pm
r29058 r29114 33 33 ########################################################################### 34 34 sub createImageFileName { 35 my ($self, $label, $stage, $suffix ) = @_;35 my ($self, $label, $stage, $suffix, $isLog) = @_; 36 36 37 37 my $prefix = $self->{_outputPath} ? $self->{_outputPath} : "."; 38 38 my $stagePart = $stage ? $stage : "all_stages"; 39 return $prefix . "/czarplot_" . $label . "_" . $stagePart . "_$suffix.png"; 39 my $type = $isLog ? "log" : "linear"; 40 return $prefix . "/czarplot_" . $type . "_" . $label . "_" . $stagePart . "_$suffix.png"; 40 41 } 41 42 … … 46 47 ########################################################################### 47 48 sub createTimeSeries { 48 my ($self, $label, $selectedStage, $beginTime, $endTime) = @_; 49 50 my $outputFile = createImageFileName($self, $label, $selectedStage, "t"); 49 my ($self, $label, $selectedStage, $beginTime, $endTime, $makeLinear, $makeLog) = @_; 51 50 52 51 my ($minX, $maxX, $minY, $maxY, $timeDiff); … … 61 60 else {$stages = ["$selectedStage"]}; 62 61 63 my %gnuplotFiles; 62 my %gnuplotFilesLin; 63 my %gnuplotFilesLog; 64 64 my $stage = undef; 65 my $gnuplotFile = undef; 65 my $gnuplotFileLin = undef; 66 my $gnuplotFileLog = undef; 66 67 foreach $stage (@{$stages}) { 67 68 68 $gnuplotFile = $self->{_czarDb}->createTimeSeriesData($label, $stage, $beginTime, $endTime, \$minX, \$maxX, \$minY, \$maxY, \$timeDiff); 69 if ($gnuplotFile) {$gnuplotFiles{$stage} = $gnuplotFile;} 69 if($self->{_czarDb}->createTimeSeriesData( 70 $label, 71 $stage, 72 $beginTime, 73 $endTime, 74 \$minX, 75 \$maxX, 76 \$minY, 77 \$maxY, 78 \$timeDiff, 79 \$gnuplotFileLin, 80 \$gnuplotFileLog)) { 81 82 $gnuplotFilesLin{$stage} = $gnuplotFileLin; 83 $gnuplotFilesLog{$stage} = $gnuplotFileLog; 84 } 70 85 71 86 } 72 87 73 my $numOfPlots = keys(%gnuplotFiles );88 my $numOfPlots = keys(%gnuplotFilesLin); 74 89 75 90 if ($numOfPlots == 0 ) { … … 85 100 } 86 101 87 plotTimeSeries($self, \%gnuplotFiles, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff); 102 my $outputFile; 103 if ($makeLinear) { 104 105 $outputFile = createImageFileName($self, $label, $selectedStage, "t", 0); 106 $self->plotTimeSeries(\%gnuplotFilesLin, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 0); 107 } 108 if ($makeLog) { 109 110 $outputFile = createImageFileName($self, $label, $selectedStage, "t", 1); 111 $self->plotTimeSeries(\%gnuplotFilesLog, $outputFile, $label, $beginTime, $endTime, $maxX, $minX, $maxY, $minY, $timeDiff, 1); 112 } 88 113 } 89 114 … … 96 121 my ($self, $label, $beginTime, $endTime) = @_; 97 122 98 my $outputFile = createImageFileName($self, $label, undef, "h" );123 my $outputFile = createImageFileName($self, $label, undef, "h", 0); 99 124 100 125 my $inputFile = "/tmp/czarplot_gnuplot_".$label."_h.dat"; # TODO use stage not table 101 open (GNUDAT, ">$inputFile");126 open (GNUDAT, ">$inputFile"); 102 127 103 128 my ($processed, $pending, $faults); … … 216 241 ########################################################################### 217 242 sub plotTimeSeries { 218 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff ) = @_;243 my ($self, $gnuplotFiles, $outputFile, $label, $fromTime, $toTime, $maxX, $minX, $maxY, $minY, $timeDiff, $isLog) = @_; 219 244 220 245 $self->sortOutMaxMinY(\$minY, \$maxY); … … 222 247 my $timeFormat = undef; 223 248 my $divX = undef; 224 249 my $yTitle = undef; 250 if ($isLog) {$yTitle = "Log(Num of Exposures)";} 251 else {$yTitle = "Num of Exposures";} 225 252 $self->getTimeSpacing($timeDiff, \$divX, \$timeFormat); 226 253 … … 245 272 "set xdata time;" . 246 273 "set timefmt \"$self->{_dateFormat}\";" . 247 # "set yrange [\"$minY\":\"$maxY\"];" .274 # "set yrange [\"$minY\":\"$maxY\"];" . 248 275 "set xrange [\"$minX\":\"$maxX\"];" . 249 276 "set format x \"$timeFormat\";" . … … 251 278 "set grid xtics;" . 252 279 "set xlabel \"Time\";" . 253 "set ylabel \" Exposures\";" .280 "set ylabel \"$yTitle\";" . 254 281 "plot "; 255 282 … … 342 369 "set boxwidth;" . 343 370 "set style data histogram;" . 344 "set style histogram rowstacked;" .371 "set style histogram rowstacked;" . 345 372 "set style fill solid border -1;" . 346 373 "set ylabel \"Exposures\";" .
Note:
See TracChangeset
for help on using the changeset viewer.
