GraphUtilities

GraphUtilities is a a collection of utility functions and classes used in the DIRAC Graphs package.

The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex Project by … <to be added>

class DIRAC.Core.Utilities.Graphs.GraphUtilities.PrettyDateFormatter(locator)

Bases: AutoDateFormatter

This class provides a formatter which conforms to the desired date formats for the Phedex system.

__init__(locator)

Format dates according to the Phedex system

class DIRAC.Core.Utilities.Graphs.GraphUtilities.PrettyDateLocator(tz=None, minticks=5, maxticks=None, interval_multiples=True)

Bases: AutoDateLocator

get_locator(dmin, dmax)

pick the best locator based on a distance

class DIRAC.Core.Utilities.Graphs.GraphUtilities.PrettyScalarFormatter(*args, **kwargs)

Bases: ScalarFormatter

__init__(*args, **kwargs)
DIRAC.Core.Utilities.Graphs.GraphUtilities.add_time_to_title(begin, end, metadata={})

Given a title and two times, adds the time info to the title. Example results:

"Number of Attempted Transfers
(24 Hours from 4:45 12-14-2006 to 5:56 12-15-2006)"

There are two important pieces to the subtitle we add - the duration (i.e., ‘48 Hours’) and the time interval (i.e., 11:00 07-02-2007 to 11:00 07-04-2007).

We attempt to make the duration match the size of the span (for a bar graph, this would be the width of the individual bar) in order for it to make the most sense. The formatting of the time interval is based upon how much real time there is from the beginning to the end.

We made the distinction because some would want to show graphs representing 168 Hours, but needed the format to show the date as well as the time.

DIRAC.Core.Utilities.Graphs.GraphUtilities.comma_format(x_orig)
DIRAC.Core.Utilities.Graphs.GraphUtilities.convert_to_datetime(dstring)
DIRAC.Core.Utilities.Graphs.GraphUtilities.darkenColor(color, factor=2)
DIRAC.Core.Utilities.Graphs.GraphUtilities.evalPrefs(*args, **kw)

Interpret arguments as preferencies dictionaries or key-value pairs. The overriding order is right most - most important one. Returns a single dictionary of preferencies

DIRAC.Core.Utilities.Graphs.GraphUtilities.makeDataFromCSV(csv)

Generate plot data dictionary from a csv file or string

DIRAC.Core.Utilities.Graphs.GraphUtilities.pixelToPoint(size, dpi)

Convert size expressed in pixels into points for a given dpi resolution

DIRAC.Core.Utilities.Graphs.GraphUtilities.pretty_float(num)
DIRAC.Core.Utilities.Graphs.GraphUtilities.statistics(results, span=None, is_timestamp=False)
DIRAC.Core.Utilities.Graphs.GraphUtilities.time_interval(begin, end)

Determine the appropriate time interval based upon the length of time as indicated by the starttime and endtime keywords.

DIRAC.Core.Utilities.Graphs.GraphUtilities.to_timestamp(val)