SimPEG.utils.Counter#

class SimPEG.utils.Counter[source]#

Bases: object

Class for recording iterations and operation times. Counter allows anything that calls it to record iterations and timings in a simple way.

Also has plotting functions that allow quick recalls of data.

Examples

If you want to use this, import count or timeIt and use them as decorators on class methods.

>>> from SimPEG.utils import Counter, count, timeIt
>>> class MyClass(object):
...     def __init__(self, url):
...         self.counter = Counter()
...     @count
...     def MyMethod(self):
...         pass
...     @timeIt
...     def MySecondMethod(self):
...         pass
>>> c = MyClass('blah')
>>> for i in range(100): c.MyMethod()
>>> for i in range(300): c.MySecondMethod()
>>> c.counter.summary()
Counters:
  MyClass.MyMethod                        :      100
Times:                                        mean      sum
  MyClass.MySecondMethod                  : 9.08e-07, 2.72e-04,  300x

Methods

count(prop)

Increases the count of the property.

countTic(prop)

Times a property call, this is the init call.

countToc(prop)

Times a property call, this is the end call.

summary()

Provides a text summary of the current counters and timers.

Galleries and Tutorials using SimPEG.utils.Counter#

Parametric DC inversion with Dipole Dipole array

Parametric DC inversion with Dipole Dipole array

EM: TDEM: 1D: Inversion

EM: TDEM: 1D: Inversion

EM: TDEM: 1D: Inversion with VTEM waveform

EM: TDEM: 1D: Inversion with VTEM waveform

Heagy et al., 2017 1D RESOLVE Bookpurnong Inversion

Heagy et al., 2017 1D RESOLVE Bookpurnong Inversion

Heagy et al., 2017 1D FDEM and TDEM inversions

Heagy et al., 2017 1D FDEM and TDEM inversions