gwsumm.plot.core module

Parse, define, and geenrate plots as requests through the configuration for GWSumm

class gwsumm.plot.core.DataPlot(channels, start, end, state=None, outdir='.', tag=None, pid=None, href=None, new=True, all_data=False, read=True, fileformat='png', caption=None, **pargs)[source]

Bases: SummaryPlot

A SummaryPlot from instrumental data.

Parameters:
channelslist

a list of channel names that define the data sources for this DataPlot

startfloat

GPS start time of this DataPlot.

endfloat

GPS end time of this DataPlot.

tagstr

a descriptive tag for this DataPlot, used as part of the output file name

outdirstr

output directory path for this DataPlot, defaults to the current directory

hrefstr

custom URL for this plot to link towards.

**kwargs

all other keyword arguments to be passed to this plot’s :meth:`process` method.

Notes

All sub-classes of this object must provide the following methods

:meth:`add_data_source`

routine for appending data sources to the plot

DRAW_PARAMS = ['imshow', 'origin', 'vmin', 'vmax', 'alpha', 'color', 'normed', 'log', 'weights', 'orientation', 'marker', 'density', 'bottom', 'label', 'interpolation', 'rwidth', 'aspect', 'cmap', 'range', 'histtype', 'zorder', 'norm', 's', 'linestyle', 'cumulative', 'linewidth', 'stacked', 'extent', 'bins', 'rasterized', 'logbins', 'align']

list of parameters parsed for plot() calls

add_channel(channel)[source]
add_hvlines()[source]

Add horizontal and vertical lines to this DataPlot

These should be defined in the configuration via the hline and vline keys.

property allchannels

List of all unique channels for this plot

apply_parameters(*axes, **pargs)[source]
property channels

List of data-source :class:`Channels <~gwpy.detector.channel.Channel>` for this DataPlot.

Type:

:class:`~gwpy.detector.channel.ChannelList`

defaults = {'animation.convert_args': ['-layers', 'OptimizePlus'], 'axes.axisbelow': False, 'axes.edgecolor': 'gray', 'axes.formatter.limits': [-3, 4], 'axes.formatter.use_mathtext': True, 'axes.grid': True, 'axes.labelpad': 5.0, 'axes.labelsize': 18.0, 'axes.titlesize': 22.0, 'contour.algorithm': 'mpl2014', 'figure.figsize': [12.0, 6.0], 'figure.labelsize': 'large', 'figure.labelweight': 'normal', 'font.sans-serif': ['Roboto'], 'grid.alpha': 0.5, 'grid.linewidth': 0.5, 'legend.edgecolor': 'inherit', 'legend.fancybox': False, 'legend.fontsize': 10.0, 'legend.handlelength': 1.0, 'legend.numpoints': 2, 'mathtext.bf': 'Roboto', 'mathtext.cal': 'Calligraffiti', 'mathtext.fontset': 'custom', 'mathtext.it': 'Roboto:italic', 'mathtext.rm': 'Roboto', 'mathtext.sf': 'Roboto', 'mathtext.tt': 'Roboto Slab', 'savefig.transparent': True, 'svg.fonttype': 'none', 'text.parse_math': True, 'xtick.labelsize': 14.0, 'ytick.labelsize': 14.0}

dict of default plotting kwargs

draw()[source]

Process all data and generate the output file for this SummaryPlot.

This function should be provided by all sub-classes, and should take no arguments.

property end
finalize(outputfile=None, close=True, **savekwargs)[source]

Save the plot to disk and close.

classmethod from_ini(config, section, start, end, channels=None, **kwargs)[source]

Define a new DataPlot.

get_channel_groups()[source]

Find and group (mean, min, max) sets of channels for plotting.

Returns:
groupslist of tuple

list of (channelname, channellist) tuples giving core channel name and an ordered list of channels. Ordering in preference of ‘rms’, ‘mean’, ‘min’, ‘max’.

Notes

This method used to return an OrderedDict, but was changed to return a list of tuple to enable plotting a channel multiple times on a plot, for whatever reason.

property href

HTML <img> href attribute for this SummaryPlot.

property ifos

Interferometer set for this DataPlot

init_plot(data=[], FigureClass=<class 'gwpy.plot.plot.Plot'>, geometry=(1, 1), projection='rectilinear', sharex=True, sharey=True, **kwargs)[source]

Initialise the Figure and Axes objects for this DataPlot.

property logx
property logy
property outputfile

Output file for this DataPlot.

parse_legend_kwargs(**defaults)[source]

Pop the legend arguments from the pargs for this Plot

parse_list(prefix, **defaults)[source]

Parse a list of something from parameters

This enables listing `hline`s (for example) in the config as

[plot-blah] hline = 100 hline-linestyle = ‘–’ hline-color = ‘red’ hline2 = 200 hline2-linestyle = ‘–’ hline2-color = ‘blue’

Returns an OrderedDict with keys matching the primary parsed value, and values as everything else, e.g.

{100: {‘linestyle’: ‘–’, ‘color’: ‘red’},

200: {‘linestyle’: ‘–’, ‘color’: ‘blue’},}

parse_plot_kwargs(**defaults)[source]

Pop keyword arguments for Axes.plot from the pargs for this Plot

parse_rcParams(params)[source]

Parse matplotlib rcParams settings from a dict of plot params

property pid
process(outputfile=None, close=True)[source]
property span

The GPS [start, stop) interval for this DataPlot.

property start
property state

~gwsumm.state.SummaryState defining validity of this DataPlot.

property tag

File tag for this DataPlot.

type = 'data'

name for DataPlot subclass

class gwsumm.plot.core.SummaryPlot(href=None, src=None, new=True, caption='')[source]

Bases: object

An image to displayed in GWSumm HTML output.

Parameters:
hrefstr, optional

The IMG URL for this SummaryPlot.

newbool, optional

bool flag whether this is a new plot to be processed (True), of that the output already exists on disk (False).

Notes

This class is a stub, designed to make creating detailed SummaryPlot classes easier.

property caption

HTML <fancybox plot> title attribute for this SummaryPlot.

classmethod from_ini(*args, **kwargs)[source]

Define a new SummaryPlot from a an INI-format ConfigParser section.

property href

HTML <img> href attribute for this SummaryPlot.

property new

Flag whether this is a new plot or, already exists.

Set new=False to skip actually processing this SummaryPlot, and just link to the outputfile.

property src
type = None