Skip to main content

Distribution Stats & Timer for Testing Non-deterministic Value Generators

Project description

MonkeyScope Beta

Distribution Timer for Non-deterministic Value Generators

Sister Projects:

Support these and other random projects: https://www.patreon.com/brokencode

Quick Install

$ pip install MonkeyScope
$ python3
>>> import MonkeyScope ...

Installation may require the following:

  • Python 3.7 or later.
  • Cython: pip install Cython
  • Python3 developer environment, setuptools etc.
  • Modern C++17 Compiler and Standard Library.

MonkeyScope Specifications

  • MonkeyScope.distribution_timer(func: staticmethod, *args, **kwargs) -> None
    • Logger for the statistical analysis of non-deterministic output.
    • @param func :: function, method or lambda to analyze. 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.3
>>> import MonkeyScope
>>> import random
>>> MonkeyScope.timer(random.randrange, -10000, 10000, 2)
Typical Timing: 1594 ± 34 ns

MonkeyScope Script Example

import MonkeyScope
import random


MonkeyScope.distribution_timer(random.randint, 1, 10)
MonkeyScope.distribution_timer(random.randrange, 1, 10)
MonkeyScope.distribution_timer(random.randrange, 1, 10, 2)

Typical Script Output

Output Analysis: Random.randint(1, 10)
Typical Timing: 1375 ± 32 ns
Statistics of 1024 samples:
 Minimum: 1
 Median: 6
 Maximum: 10
 Mean: 5.5185546875
 Std Deviation: 2.8455943311882343
Distribution of 102400 samples:
 1: 10.1171875%
 2: 9.943359375%
 3: 9.9541015625%
 4: 9.8916015625%
 5: 10.1318359375%
 6: 10.0361328125%
 7: 9.8681640625%
 8: 10.16796875%
 9: 9.9052734375%
 10: 9.984375%

Output Analysis: Random.randrange(1, 10)
Typical Timing: 1219 ± 35 ns
Statistics of 1024 samples:
 Minimum: 1
 Median: 5
 Maximum: 9
 Mean: 4.9609375
 Std Deviation: 2.531992268646342
Distribution of 102400 samples:
 1: 11.0205078125%
 2: 11.2080078125%
 3: 11.16015625%
 4: 11.08203125%
 5: 11.1484375%
 6: 11.0791015625%
 7: 11.1923828125%
 8: 10.9375%
 9: 11.171875%

Output Analysis: Random.randrange(1, 10, 2)
Typical Timing: 1532 ± 36 ns
Statistics of 1024 samples:
 Minimum: 1
 Median: 5
 Maximum: 9
 Mean: 5.029296875
 Std Deviation: 2.8123316447928097
Distribution of 102400 samples:
 1: 19.984375%
 3: 19.931640625%
 5: 20.1552734375%
 7: 19.93359375%
 9: 19.9951171875%

ToDo List:

  1. Improve Documentation
  2. Concoct Examples
  3. Derive Tests
  4. Refactor Inception

Development Log:

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MonkeyScope-0.1.3.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

MonkeyScope-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl (54.4 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file MonkeyScope-0.1.3.tar.gz.

File metadata

  • Download URL: MonkeyScope-0.1.3.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.3

File hashes

Hashes for MonkeyScope-0.1.3.tar.gz
Algorithm Hash digest
SHA256 025802424ae2fe4576f0382a242718030ac8cae8fdc270019c2737fa3c040816
MD5 de8182221d4afa68bff365d819d2d39b
BLAKE2b-256 48224b98b612b87b41fac8c4e01451cb1decec801b98c69a1a96c5973511da00

See more details on using hashes here.

File details

Details for the file MonkeyScope-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: MonkeyScope-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 54.4 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.7.3

File hashes

Hashes for MonkeyScope-0.1.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 226a746f591350cd364e21c5781a23fa07751b5bfa803fd696b3f52a95dc3901
MD5 e85aec8fa7be3cdba2a2fb4cc35db5de
BLAKE2b-256 b070cf0709368f0041f99b7c13b84bd963c0a61084bc28524a8c986f3906b1bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page