artemis.core.book

Book classes that work as dictionaries. Concrete classes to store, access and manage histograms, tdigests and tool objects.

Module Contents

class artemis.core.book.BaseBook(hists={})

Bases: collections.MutableMapping

Base class for a collection of objects in a dictionary-like object.

_content

dictionary of histograms

Type

OrderedDict

Parameters

hists (dict) – dictionary of histograms to initialize book

classmethod load_from_dicts(cls, content)
compatible(self, other)

books have equivalent keys re-implement in derived classes

_updated(self)
__eq__(self, other)

book1 == book2

__ne__(self, other)

book1 != book2

__len__(self)

len(book)

__contains__(self, name)

if book has key

_get(self, name)
__getitem__(self, name)
_set(self, name, value)
__setitem__(self, name, value)

book[key] = value

_del(self, name)
__delitem__(self, name)

del book[key]

__iter__(self)

for k, v in book.items()

_iter_keys(self)
_iter_values(self)
keys(self)
values(self)
items(self)

book.items()

__add__(self, other)

book = book1 + book2

__iadd__(self, other)

book += book1

class artemis.core.book.ArtemisBook(hists={})

Bases: artemis.core.book.BaseBook

Book for histograms and timers.

_timers

dictionary of timer objects

Type

OrderedDict

compatible(self, other)
reset(self)

clear bin contents of all histograms

copy(self)

return copy w or w/o bin contents

write(self)

serialize and write to file

book(self, algname, name, bins, axis_name=None, timer=False)
rebook(self, excludes=[])

Force reset of all histograms with a copy do NOT include copying data

_fill_timer(self, algname, name, data)
fill(self, algname, name, data)
_from_message(self, msg)
_to_message(self)
load(self, fname)
finalize(self, fname)
class artemis.core.book.TDigestBook(tdigests={})

Bases: artemis.core.book.BaseBook

Book of TDigest objects

Provides methods for serializing/deserializing protobuf. Conversion to/from protobuf TDigest to TDigest python implementation.

compatible(self, other)
__setitem__(self, name, value)

book[key] = value

reset(self)

clear bin contents of all histograms

copy(self)

return copy w or w/o bin contents

write(self)

serialize and write to file

book(self, algname, name)
rebook(self, excludes=[])

Force reset of all tdigests

fill(self, algname, name, data)
_digest_to_protobuf(self, digest, name)

Private function that converts a TDigest object to a google protocol buffer object

Input: TDigest object, the name of the TDigest objects name (this is the name of the column in the Artemis project) Returns: google protocol buffer object TDigest_instance

_digest_from_protobuf(self, protobuf)
_from_message(self, msg)
_to_message(self)
classmethod load(cls, fname)
finalize(self, fname)
class artemis.core.book.ToolStore(tools={})

Bases: artemis.core.book.BaseBook

__setitem__(self, name, value)

book[key] = value

add(self, logger, toolcfg)
get(self, key)