IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29867


Ignore:
Timestamp:
Nov 26, 2010, 3:27:03 PM (15 years ago)
Author:
rhenders
Message:

refactored more general purpose metrics code into this base class, such as summary plot creation, maks plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/Metrics.pm

    r29760 r29867  
    4747}
    4848
     49###########################################################################
     50#
     51# Writes HTML intro
     52#
     53###########################################################################
     54sub createHtml {
     55    my ($self, $title) = @_;
     56
     57    open (FILE, ">$self->{path}/index.html");
     58    $self->{htmlFile} = *FILE;
     59
     60    my $htmlFile = $self->{htmlFile};
     61    print $htmlFile "<html>\n";
     62    print $htmlFile "<head>\n";
     63    print $htmlFile "<title>$title</title>\n";
     64    print $htmlFile "<a name=\"top\"></a>\n";
     65    print $htmlFile "<h1 align=\"middle\">$title</h1>\n";
     66}
     67
     68###########################################################################
     69#
     70# Creates summary plots for period
     71#
     72###########################################################################
     73sub createSummaryPlots {
     74    my ($self) = @_;
     75
     76    my $htmlFile = $self->{htmlFile};
     77
     78    print $htmlFile "<a name=\"summaryplot\"></a>\n";
     79    print $htmlFile "<h2  align=\"middle\">Summary plots <a href=\"#top\">(top)</a></h1>\n";
     80    $self->{plotter}->createTimeSeries("all_stdscience_labels", undef, $self->{begin}, $self->{end}, 0, 0, 0);
     81    print $htmlFile "<img src=\"czarplot_linear_all_stdscience_labels_all_stages_t.png\" alt=\"timeseries\" />\n";
     82    $self->{plotter}->createHistogram("all_stdscience_labels", $self->{begin}, $self->{end}, 0, 0, 0);
     83    print $htmlFile "<img src=\"czarplot_linear_all_stdscience_labels_all_stages_h.png\" alt=\"histogram\" />\n";
     84    $self->{plotter}->createRateTimeSeries("all_stdscience_labels", undef, $self->{begin}, $self->{end}, undef, 0);
     85    print $htmlFile "<img src=\"czarplot_linear_all_stdscience_labels_all_stages_r.png\" alt=\"rate\" />\n";
     86    $self->{plotter}->plotStorageTimeSeries($self->{begin}, $self->{end});
     87    print $htmlFile "<img src=\"czarplot_cluster.png\" alt=\"storage plot not available\" />\n";
     88}
     89
     90###########################################################################
     91#
     92# Creates magic mask plots for provided period
     93#
     94###########################################################################
     95sub createMaskPlots {
     96    my ($self, $begin, $end) = @_;
     97
     98    my $htmlFile = $self->{htmlFile};
     99
     100    print $htmlFile "<a name=\"mask\"></a>\n";
     101    print $htmlFile "<h2  align=\"middle\">Magic mask fraction <a href=\"#top\">(top)</a></h1>\n";
     102
     103    $self->{plotter}->plotMagicMaskFraction($begin, $end);
     104    print $htmlFile "<img src=\"czarplot_magic_mask_fraction_h.png\" alt=\"\" />\n";
     105    print $htmlFile "<img src=\"czarplot_magic_mask_fraction_d.png\" alt=\"\" />\n";
     106}
     107
     108###########################################################################
     109#
     110# Writes HTML intro
     111#
     112###########################################################################
     113sub finishHtml {
     114    my ($self) = @_;
     115
     116    my $htmlFile = $self->{htmlFile};
     117
     118    print $htmlFile "<br>\n";
     119    print $htmlFile "</body>\n";
     120    print $htmlFile "</html>\n";
     121    close($htmlFile);
     122}
    491231;
Note: See TracChangeset for help on using the changeset viewer.