gwsumm.tabs.data module

This module defines tabs for generating plots from data on-the-fly.

This module also provides the ProcessedTab mixin, which should be used to declare that a tab has a process() method that should be executed as part of a workflow, see the gw_summary executable as an example.

class gwsumm.tabs.data.DataTab(*args, **kwargs)[source]

Bases: ProcessedTab, StateTab

A tab where plots and data summaries are built upon request

This is the ‘default’ tab for the command-line gw_summary executable.

All *args and **kwargs are passed up-stream to the base class constructor, excepting the following:

Parameters:
namestr

name of this tab (required)

startLIGOTimeGPS, str

start time of this DataTab, anything that can be parsed by ~gwpy.time.to_gps is fine

endLIGOTimeGPS, str

end time of this DataTab, format as for start

stateslist of states <gwsumm.state.SummaryState>

the list of states (~gwsumm.state.SummaryState) over which this DataTab should be processed. More states can be added later (but before running :meth:`~DataTab.process`) via :meth:`~DataTab.add_state`.

ismetabool, optional, default: False

indicates that this tab only contains data already by others and so doesn’t need to be processed.

noplotsbool, optional, default: False

indicates that this tab only exists to trigger data access, and shouldn’t actually generate any figures

**kwargs

other keyword arguments

See also

:obj:`gwsumm.tabs.StateTab`

for details on the other keyword arguments (**kwargs) accepted by the constructor for the DataTab.

finalize_states(config=<configparser.ConfigParser object>, segdb_error='raise', **kwargs)[source]

Fetch the segments for each state for this SummaryTab

classmethod from_ini(cp, section, plotdir='plots', **kwargs)[source]

Define a new SummaryTab from the given section of the ConfigParser.

Parameters:
cp:class:`~gwsumm.config.GWConfigParser`

customised configuration parser containing given section

sectionstr

name of section to parse

plotdirstr, optional, default: 'plots'

output path for plots, relative to current directory

Returns:
tabDataTab

a new DataTab defined from the configuration

get_channels(*types, **kwargs)[source]

Return the set of data channels required for plots of the given types.

Parameters:
*typeslist of str

list of plot data type strings whose channel sets to return

newbool, default: True

only include plots whose ‘new’ attribute is True

Returns:
channelslist

an alphabetically-sorted list of channels

get_flags(*types, **kwargs)[source]

Return the set of data-quality flags required for plots of the given types.

Parameters:
*typeslist of str

list of plot type strings whose flag sets to return

Returns:
flagslist

an alphabetically-sorted list of flags

get_triggers(*types, **kwargs)[source]

Return the set of data-quality flags required for plots of the given types.

Parameters:
*typeslist of str

list of plot type strings whose flag sets to return

Returns:
flagslist

an alphabetically-sorted list of flags

html_content(frame)[source]

Build the #main div for this tab.

In this construction, the <div id=”id_”> is empty, with a javascript hook to load the given frame into the div when ready.

static print_segments(flag, table=False, caption=None)[source]

Print the contents of a SegmentList in HTML

process(config=<configparser.ConfigParser object>, nproc=1, **stateargs)[source]

Process data for this tab

Parameters:
configConfigParser.ConfigParser, optional

job configuration to pass to \(~DataTab.finalize_states\)

**stateargs

all other keyword arguments are passed directly onto the :meth:`~DataTab.process_state` method.

process_state(state, nds=None, nproc=1, config=<GWSummConfigParser()>, datacache=None, trigcache=None, segmentcache=None, segdb_error='raise', datafind_error='raise')[source]

Process data for this tab in a given state

Parameters:
state~gwsumm.state.SummaryState

the state to process. Can give None to process ALLSTATE with no plots, useful to load all data for other states

ndsbool, optional

True to use NDS to read data, otherwise read from frames. Use None to read from frames if possible, otherwise using NDS.

nprocint, optional

number of parallel cores to use when reading data and making plots, default: 1

configConfigParser, optional

configuration for this analysis

datacache~glue.lal.Cache, optional

Cache of files from which to read time-series data

trigcache~glue.lal.Cache, optional

Cache of files from which to read event triggers

segmentcache~glue.lal.Cache, optional

Cache of files from which to read segments

segdb_errorstr, optional

if 'raise': raise exceptions when the segment database reports exceptions, if 'warn''`, print warnings but continue, otherwise ``'ignore' them completely and carry on.

type = 'data'
write_html(*args, **kwargs)[source]

Write the HTML page for this state Tab.

Parameters:
maincontentstr, :class:`~MarkupPy.markup.page`

simple string content, or a structured page of markup to embed as the content of the #main div.

titlestr, optional, default: {parent.name}

level 1 heading for this Tab.

subtitlestr, optional, default: {self.name}

level 2 heading for this Tab.

tabs: `list`, optional

list of top-level tabs (with children) to populate navbar

ifostr, optional

prefix for this IFO.

ifomapdict, optional

dict of (ifo, {base url}) pairs to map to summary pages for other IFOs.

help_str, :class:`~MarkupPy.markup.page`, optional

non-menu content for navigation bar, defaults to calendar

csslist, optional

list of resolvable URLs for CSS files. See gwsumm.html.static.CSS for the default list.

jslist, optional

list of resolvable URLs for javascript files. See gwumm.html.JS for the default list.

aboutstr, optional

href for the ‘About’ page

footerstr, ~MarkupPy.markup.page

user-defined content for the footer (placed below everything else)

**inargs

other keyword arguments to pass to the :meth:`~Tab.build_inner_html` method

write_state_html(state)[source]

Write the ‘#main’ HTML content for this tab.

For now, this function just links all the plots in a 2-column format.

write_state_information(state)[source]
write_state_placeholder(state)[source]

Write a placeholder ‘#main’ content for this tab

class gwsumm.tabs.data.ProcessedTab[source]

Bases: object

Abstract base class to detect necessity to run Tab.process()

process()[source]

This method must be overridden by all subclasses

type = '_processed'