Skip to main content

Utility to efficiently explore functions on their domains

Project description

Cartesian Explorer

https://img.shields.io/pypi/v/cartesian-explorer.svg https://img.shields.io/travis/DaniloZZZ/cartesian-explorer.svg Documentation Status Updates

A handy tool to map functions over their domains.

Works:

  • Map over cartesian product of arguments: pass arrays of values for function argement

  • Built-in caching

Will work:

  • Handy plotting utilities

  • Resolving dependencies between functions that require and provide variables

Usage

Map

from cartesian_explorer import Explorer

explorer = Explorer()

def my_function(x, y):
    return x+y
data = explorer.map(my_function, x=range(5), y=range(3))
print(data)
assert data.shape == (5, 3)
assert data[1, 2] == my_function(1, 2)

Cache

from cartesian_explorer import Explorer
explorer = Explorer()
mock = MagicMock()
my_function = mock.my_function
wrapped = explorer.cache_function(my_function)
wrapped(a=1, b=2)
wrapped(a=1, b=2)
my_function.assert_called_once_with(a=1, b=2)

History

0.1.0 (2020-05-16)

  • First release on PyPI.

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

cartesian_explorer-0.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

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