Source

Collectors /

Filename Size Date modified Message
collectors
docs
examples
62 B
139 B
166 B
512 B
1.5 KB
71 B
2.0 KB
1.7 KB

Collectors

Collectors was initially developed to monitor SimPy simulation models but it can also be used to monitor any Python objects and collect data from them.

Our main development goals were:

  • Ease of use (simple API, little typing)
  • Efficiency:
    • No impact on simulation speed if you don’t use it.
    • As little impact as possible if you use it.
  • Flexibility and easy extensibility
  • Separation of data collection and data analysis

Simple usage example

>>> class Spam(object):
...     a = 1
...     b = 2
...
>>> spam = Spam()
>>>
>>> # Create and configure the collector
>>> col = Collector(
...     ('a', lambda: spam.a),
...     ('b', lambda: self.b)
... )
>>>
>>> # Collect all monitored variables (spam.a and spam.b)
>>> col()
>>> spam.a, spam.b = 3, 4
>>> col()
>>>
>>> # Get the collector’s data
>>> col
([1, 3], [2, 4])
>>> # You can also access it's elements by their name ...
>>> col.a
[1, 3]
>>> # ... or by their index
>>> col[1]
[2, 4]

Requirements

Collectors has only been tested with Python 2.6 but older versions should also work. Python 3.0 might also work; if not, we’ll put it on our schedule.

Installation

The easiest way to install Collectors is via PIP or distribute:

pip install Collectors

or

easy_install Collectors

If you downloaded the archive, execute:

python setup.py install

And finally, if you checked out the repository and always want to use the newest version, type:

pip install -e path/to/Collectors

or

pip install -e https+hg://bitbucket.org/scherfke/collectors/

Usage

The Documentation can be found in the docs/ directory or online.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.