utopya_post module¶
The utopya_post module provides classes to post process results.
All classes are accesible through the top level utopya module.
The
UtopyaHtmlFileclass could be used to fill the body of an html file.The
UtopyaBarPlotclass 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.UtopyaBaseStorage for content of HTML file. A list attribute
linesis 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
UtopyaHtmlFileobject.
- 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
infoflag to write an informative message on the created file.
- GetImgLink(img_src, img_attr='')¶
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.UtopyaBaseBase class for figures. An attribute
figof thematplotlib.pyplot.figureclass 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.UtopyaPlotCreate 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 filetitle: figure titlexlabs: list with names on x-axis for the barsydefault: default value to be used for a bar if all values are None.yrefreference value, if defined the y-axis is in percentageof this value