pyg4ometry.utils

Classes

Samples

Timer

A class for recording the CPU time at specific positions within code

Functions

_write_pickle(obj, path)

_load_pickle(path)

Module Contents

pyg4ometry.utils._write_pickle(obj, path)
pyg4ometry.utils._load_pickle(path)
class pyg4ometry.utils.Samples(**metadata)
metadata
times
add(name, time)
n_samples_description()
sample_names(exclude=None)
means(exclude=None)
stds(exclude=None)
classmethod from_existing(*samples)

Merge two or more existing samples non-destructively to create a new Sample instance.

__str__()
write(path)
writeAppend(path, verbose=False)
__getitem__(key)
__setitem__(key, value)
__contains__(key)
class pyg4ometry.utils.Timer(**metadata)

A class for recording the CPU time at specific positions within code with the use of a name. Records time stamps in a Samples instance. To record multiple samples of a given event, simply call add with the same name repeatedly.

timer = Timer()

while True:

… timer.add(“step1”) … timer.add(“step2”)

mean_step1 = timer.samples.means()[“step1”] std_step1 = timer.samples.stds()[“step1”]

metadata
time0
last_time
samples
add(name)
update()

Update the last_time attribute to now.

__str__()
updateTotal()