utopya_post module

The utopya_post module provides classes to post process results. All classes are accesible through the top level utopya module.

  • The UtopyaHtmlFile class could be used to fill the body of an html file.

  • The UtopyaBarPlot class facilitates creation of (stacked) bar plots.

The configuration of the objects is done using rcfile settings.

Class hierarchy

The classes provided by this module have been derived with the following hierchy:

Classes

class utopya_post.UtopyaHtmlFile

Bases: utopya_base.UtopyaBase

Storage for content of HTML file. A list attribute lines is created to hold the body of the content.

Use the Write() method to write the content to a file.

Append(line)

Add line to content.

Prepend(line)

Add line to content.

Extend(html)

Add lines from other UtopyaHtmlFile object.

Write(filename, title=None, info=False)

Write content to HTML file.

This routine will add add the header lines, including a title if provided.

Enable the info flag to write an informative message on the created file.

Return html code to display an image with given attributes; a link is created to the full size version.

Example:

self.GetImgLink( 'test.png', 'width="400"' )
class utopya_post.UtopyaPlot(**kwargs)

Bases: utopya_base.UtopyaBase

Base class for figures. An attribute fig of the matplotlib.pyplot.figure class is created, initialized with the optional keyword arguments.

Close()

Close file.

Export(filename)

Export figure to provided filename.

class utopya_post.UtopyaBarPlot(**kwargs)

Bases: utopya_post.UtopyaPlot

Create bar plot with timing values. A vertical bar is drawn for one or more experiment; different values are stacked.

Example usage:

# initialize plot:
p = UtopyaBarPlot()

# add timing values for 2 experiments:
p.Add( [2.0,3.0], label='base' )
p.Add( [1.0,4.0], label='extra' )

# create plot:
p.Finish( figname='bars.png' )

The optional arguments of the finish() method can be used for fine-tuning the result.

Add(y, label=None)

Define list of values for the bars. Elements might be None if not available.

The optional label will be used in a legend.

Finish(figname=None, title=None, xlabs=[], ydefault=None, yref=None)

Create bar plot.

Optional arguments:

  • figname : save result to file

  • title : figure title

  • xlabs : list with names on x-axis for the bars

  • ydefault : default value to be used for a bar if all values are None.

  • yrefreference value, if defined the y-axis is in percentage

    of this value