exppy


Nameexppy JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/mrkwjc/exppy
SummaryNumerical experiments in python
upload_time2023-09-27 15:22:56
maintainer
docs_urlNone
authorMarek Wojciechowski
requires_python>=3.6
licenseMIT
keywords doe numerical experiment
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # exppy - module that automates numerical experiments
This module is intended for performing numerical experiments with continuous parameters. Currently, parameters of the model can be randomized with uniform or log-uniform distributions in the given range. Simple random, latin hypercube or generalized subset designs can be used (supported by `pyDOE2` package).

Example:

```python
from exppy import LHSDesign, Experiment
from math import sin, cos
import pylab


class MyDesign(LHSDesign):
    spec = (('x', (0, 6.28, 'uniform', 10)),
            ('y', (0, 6.28, 'uniform', 10)))
    samples = 50


class MyModel:
    # model can be any class, but it is required to have 'solve' method
    # which takes sample `d` as argument and returns dict of results `res`
    def solve(self, d):
        x, y = d.x, d.y
        res = {'F': sin(x)*cos(y), 'G': x*y}
        return res

# Evaluate experiments and dump everything to 'test' directory:
ex = Experiment(MyDesign(), MyModel(), dirname='test')
ex.run()  

# Plot 'F'
x = ex.design.x
y = ex.design.y
F = ex.result.F
pylab.tricontour(x, y, F, levels=14, linewidths=0.5, colors='k')
cntr = pylab.tricontourf(x, y, F, levels=14, cmap="RdBu_r")
pylab.colorbar(cntr)
pylab.plot(x, y, 'ko', ms=3)
pylab.title('$\sin(x)\cos(y)$\n (%d LHS samples)' % ex.design.samples)
```

The resulting figure looks like this:

![image](data/sincos.png)

For more hints look into the `test_exppy.py` file. Docs are in plans...

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mrkwjc/exppy",
    "name": "exppy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "doe,numerical experiment",
    "author": "Marek Wojciechowski",
    "author_email": "mrkwjc@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/55/1e/a272f4218fb15ff5e3046446e882eb7a58f89992b8a19ca3f11cf7b5beaa/exppy-0.1.3.tar.gz",
    "platform": null,
    "description": "# exppy - module that automates numerical experiments\nThis module is intended for performing numerical experiments with continuous parameters. Currently, parameters of the model can be randomized with uniform or log-uniform distributions in the given range. Simple random, latin hypercube or generalized subset designs can be used (supported by `pyDOE2` package).\n\nExample:\n\n```python\nfrom exppy import LHSDesign, Experiment\nfrom math import sin, cos\nimport pylab\n\n\nclass MyDesign(LHSDesign):\n    spec = (('x', (0, 6.28, 'uniform', 10)),\n            ('y', (0, 6.28, 'uniform', 10)))\n    samples = 50\n\n\nclass MyModel:\n    # model can be any class, but it is required to have 'solve' method\n    # which takes sample `d` as argument and returns dict of results `res`\n    def solve(self, d):\n        x, y = d.x, d.y\n        res = {'F': sin(x)*cos(y), 'G': x*y}\n        return res\n\n# Evaluate experiments and dump everything to 'test' directory:\nex = Experiment(MyDesign(), MyModel(), dirname='test')\nex.run()  \n\n# Plot 'F'\nx = ex.design.x\ny = ex.design.y\nF = ex.result.F\npylab.tricontour(x, y, F, levels=14, linewidths=0.5, colors='k')\ncntr = pylab.tricontourf(x, y, F, levels=14, cmap=\"RdBu_r\")\npylab.colorbar(cntr)\npylab.plot(x, y, 'ko', ms=3)\npylab.title('$\\sin(x)\\cos(y)$\\n (%d LHS samples)' % ex.design.samples)\n```\n\nThe resulting figure looks like this:\n\n![image](data/sincos.png)\n\nFor more hints look into the `test_exppy.py` file. Docs are in plans...\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Numerical experiments in python",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/mrkwjc/exppy"
    },
    "split_keywords": [
        "doe",
        "numerical experiment"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b88d7848f2997732f0256e8a35d1d8eb42608cd8a5a48bfa6a568a860c01b6b",
                "md5": "4b8b9a44f4e115cf286321620a65ef7a",
                "sha256": "3de7dc154dc510b2568f43f02eba5b4366347b2aadf66358c8c5026510005cd8"
            },
            "downloads": -1,
            "filename": "exppy-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4b8b9a44f4e115cf286321620a65ef7a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7336,
            "upload_time": "2023-09-27T15:22:53",
            "upload_time_iso_8601": "2023-09-27T15:22:53.058624Z",
            "url": "https://files.pythonhosted.org/packages/6b/88/d7848f2997732f0256e8a35d1d8eb42608cd8a5a48bfa6a568a860c01b6b/exppy-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "551ea272f4218fb15ff5e3046446e882eb7a58f89992b8a19ca3f11cf7b5beaa",
                "md5": "af29323ae87fff1209e2d64235ddba4d",
                "sha256": "2f5628e816619d3a6e046bcc7143861aeddc462f1c7f022dd9fe914a620b73e6"
            },
            "downloads": -1,
            "filename": "exppy-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "af29323ae87fff1209e2d64235ddba4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7286,
            "upload_time": "2023-09-27T15:22:56",
            "upload_time_iso_8601": "2023-09-27T15:22:56.833154Z",
            "url": "https://files.pythonhosted.org/packages/55/1e/a272f4218fb15ff5e3046446e882eb7a58f89992b8a19ca3f11cf7b5beaa/exppy-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-27 15:22:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mrkwjc",
    "github_project": "exppy",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "exppy"
}
        
Elapsed time: 0.35033s