Distribution Stats & Timer for Testing Non-deterministic Value Generators
Project description
MonkeyScope
Distribution Timer for Non-deterministic Value Generators
Sister Projects:
- Fortuna: Collection of abstractions to make custom random value generators. https://pypi.org/project/Fortuna/
- Pyewacket: Complete drop-in replacement for the Python3 random module. https://pypi.org/project/Pyewacket/
- RNG: Python3 API for the C++ Random Library. https://pypi.org/project/RNG/
Support these and other random projects: https://www.patreon.com/robertsharp
Quick Install
$ pip install MonkeyScope
$ python3
>>> import MonkeyScope
Installation may require the following:
- Python 3.6 or later with dev tools (setuptools, pip, etc.)
- Cython:
pip install Cython
- Modern C++17 compiler and standard library for your platform.
MonkeyScope Specifications
MonkeyScope.distribution_timer(func: staticmethod, *args, **kwargs) -> None
- Logger for the statistical analysis of non-deterministic generators.
- @param func :: function, method or lambda to analyze. Evaluated as
func(*args, **kwargs)
- @optional_kw num_cycles=10000 :: Total number of samples to use for analysis.
- @optional_kw post_processor=None :: Used to scale a large set of data into a smaller set of groupings for better visualization of the data, esp. useful for distributions of floats. For many functions in quick_test(), math.floor() is used, for others round() is more appropriate. For more complex post processing - lambdas work nicely. Post processing only affects the distribution, the statistics and performance results are unaffected.
MonkeyScope.distribution(func: staticmethod, *args, **kwargs) -> None
- Stats and distribution.
MonkeyScope.timer(func: staticmethod, *args, **kwargs) -> None
- Just the function timer.
MonkeyScope Terminal Example
$ python3
Python 3.7.4
>>> import MonkeyScope, random
>>> MonkeyScope.timer(random.random)
Typical Timing: 32 ± 12 ns
MonkeyScope Script Example
import MonkeyScope, random
x, y, z = 1, 10, 2
MonkeyScope.distribution_timer(random.randint, x, y)
MonkeyScope.distribution_timer(random.randrange, x, y)
MonkeyScope.distribution_timer(random.randrange, x, y, z)
Typical Script Output
Output Analysis: Random.randint(1, 10)
Typical Timing: 1270 ± 88 ns
Statistics of 1000 samples:
Minimum: 1
Median: 5.0
Maximum: 10
Mean: 5.425
Std Deviation: 2.867468395641005
Distribution of 100000 samples:
1: 10.0%
2: 10.073%
3: 10.046%
4: 10.07%
5: 10.032%
6: 9.991%
7: 9.978%
8: 10.115%
9: 9.836%
10: 9.859%
Output Analysis: Random.randrange(1, 10)
Typical Timing: 1135 ± 69 ns
Statistics of 1000 samples:
Minimum: 1
Median: 5.0
Maximum: 9
Mean: 5.028
Std Deviation: 2.605228588819031
Distribution of 100000 samples:
1: 11.281%
2: 11.098%
3: 11.04%
4: 11.119%
5: 10.999%
6: 11.176%
7: 11.206%
8: 11.091%
9: 10.99%
Output Analysis: Random.randrange(1, 10, 2)
Typical Timing: 1332 ± 55 ns
Statistics of 1000 samples:
Minimum: 1
Median: 5.0
Maximum: 9
Mean: 5.068
Std Deviation: 2.771890329720857
Distribution of 100000 samples:
1: 19.868%
3: 20.025%
5: 20.001%
7: 19.811%
9: 20.295%
Development Log:
MonkeyScope 1.2.3
- Minor typos fixed.
MonkeyScope 1.2.2
- MonkeyScope is now compatible with python notebooks.
MonkeyScope 1.2.1
- Documentation update
MonkeyScope 1.2.0
- Minor performance improvement.
MonkeyScope 1.1.5
- Public Release
MonkeyScope Beta 0.1.5
- Installer Update
MonkeyScope Beta 0.1.4
- Minor Bug Fix
MonkeyScope Beta 0.1.3
- Continued Development
MonkeyScope Beta 0.1.2
- Renamed to MonkeyScope
MonkeyTimer Beta 0.0.2
- Changed to c++ compiler
MonkeyTimer Beta 0.0.1
- Initial Project Setup
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
MonkeyScope-1.2.3.tar.gz
(61.9 kB
view details)
Built Distribution
File details
Details for the file MonkeyScope-1.2.3.tar.gz
.
File metadata
- Download URL: MonkeyScope-1.2.3.tar.gz
- Upload date:
- Size: 61.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.20.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89001e04fc2a045ee3a37e4b6f48fffe7b2164415036dfc8c86f0496f8af5393 |
|
MD5 | 2f0d4bf2b50294a8d01d9a04e1721535 |
|
BLAKE2b-256 | 14bc597ac30c9ade3eb0a65803a0504b566a06575d841e7a52aee0d5584470cb |
File details
Details for the file MonkeyScope-1.2.3-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: MonkeyScope-1.2.3-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 50.8 kB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.20.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3fdf5ee1e45a4f90eebc43cad2dbcb946cbe5b660d7c2b1f563ca469d7b614 |
|
MD5 | 974512ab356e2673b4bf6636ca98a0c0 |
|
BLAKE2b-256 | e73d998a090717983652acf83420831e45e44fae79e11678394c3d8ff4a28926 |