wellmet


Namewellmet JSON
Version 0.9.7.1 PyPI version JSON
download
home_pagehttps://rocketgit.com/iam-git/WellMet
Summarya pure Python framework for spatial structural reliability analysis
upload_time2023-05-31 17:29:16
maintainer
docs_urlNone
authorGerasimov Aleksei
requires_python>=3.8
licenseMIT
keywords failure probability monte carlo surrogate model response surface
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            WellMet is pure Python framework for spatial structural reliability analysis. Or, more specifically, for "failure probability estimation and detection of failure surfaces by adaptive sequential decomposition of the design domain".

# Installation
## For users of conda-based distributions
Anaconda users are encouraged to manually install WellMet's dependencies:
```
conda install -c anaconda scipy
conda install -c anaconda matplotlib
conda install -c anaconda pandas
conda install -c anaconda mpmath
conda install -c anaconda pyqtgraph

conda install -c conda-forge quadpy
```
pyopengl for 3D view (optionally):
```
conda install -c anaconda pyopengl
```

Finally, install WellMet from PyPI:
```
pip install wellmet
```

## For other users
Install WellMet from PyPI:
```
pip install wellmet
```

WellMet relies on ```quadpy``` for simplex integration. However, quadpy became a closed source software and requires licence fee now.
One probably could install official quadpy package and obtain a licence in order to support Nico Schloemer.
However, WellMet has never been tested with commertial quadpy versions.
So, we separately share the last GPL version:
```
pip install quadpy-gpl
```


# How to use:
## A. To run GUI with predefined benchmark problems:
1. Type in shell: ```python -m wellmet```
2. Choose problem to solve, choose (optionally) filename to store samples and estimations, set up the algorithm.
3. Press "Batch run..." button and type desired number of LSF calls.

## B. To test the algorithm on your own problem use the following code:
```
import numpy as np
import scipy.stats as stats

from wellmet.qt_gui import qt_box_functions as gui
from wellmet import whitebox
from wellmet.samplebox import SampleBox
from wellmet import f_models


# 1. Set up probability distribution
# Standard Gaussian variables, 2D
#f = f_models.SNorm(2)
# Just normal variables
f = f_models.Norm(mean=[-1, 0], std=[2, 1])
# Independent non-Gaussian variables
#f = f_models.UnCorD((stats.gumbel_r, stats.uniform))
# Correlated non-Gaussian marginals
#f = f_models.Nataf((stats.gumbel_r, stats.weibull_min(c=1.5)), [[1,0.8], [0.8,1]])

# 2. Define LSF function
def my_problem(input_sample):
    # get real (physical) space coordinates
    # X is a numpy array with shape (nsim, ndim)
    # the algorithm normally sends (1, ndim) sample
    X = input_sample.R
    # LSF
    g = X[:, 0] - X[:, 1] + 3
    # we should return an instance of SampleBox class
    # this instance stores coordinates along with LSF calculation result
    return SampleBox(input_sample, g, "my_problem")

# 3. Put them together
wt = whitebox.WhiteBox(f, my_problem)

# choose filename to store samples and estimations
gui.read_box(wt)
# setup algorithm
gui.setup_dicebox(wt)

# start GUI
gui.show_box(wt)
```

## C. The same without GUI:
```
import numpy as np
import scipy.stats as stats

from wellmet.samplebox import SampleBox
from wellmet import f_models


# 1. Set up probability distribution
# Standard Gaussian variables, 2D
#f = f_models.SNorm(2)
# Just normal variables
f = f_models.Norm(mean=[-1, 0], std=[2, 1])
# Independent non-Gaussian variables
#f = f_models.UnCorD((stats.gumbel_r, stats.uniform))
# Correlated:
# Nataf model with correlations of the respective _Gaussian_ marginals
#f = f_models.Nataf((stats.gumbel_r, stats.weibull_min(c=1.5)), [[1,0.8], [0.8,1]])

# 2. Define LSF function
def my_problem(input_sample):
    # get real (physical) space coordinates
    # X is a numpy array with shape (nsim, ndim)
    # the algorithm normally sends (1, ndim) sample
    X = input_sample.R
    # LSF
    g = X[:, 0] - X[:, 1] + 3
    # we should return an instance of SampleBox class
    # it stores coordinates along with LSF calculation result
    # with kind of signature
    return SampleBox(input_sample, g, "my_problem")






# 3. Prepare storage
# no need to store anything
#sample_box = SampleBox(f)

# keep samples and estimations continiously stored 
from wellmet import reader
sample_box = reader.Reader("meow_problem", f)

# 4. Setup the algorithm
from wellmet.dicebox.circumtri import CirQTri
import quadpy

scheme = quadpy.tn.stroud_tn_3_6b(sample_box.nvar)
convex_hull_degree = 5 # degreee of Grundmann-Moeller cubature scheme
q = 1 # should be > 0. Greater values slightly enforces exploration
screening_rate = 0 # 10 means to sacrifice every tenth sample for screening
box = CirQTri(sample_box, scheme, convex_hull_degree, q, screening_rate)


# 5. Here we go!
for i in range(20):
    # ask where to sample the next point
    # next_node is an f_model instance
    next_node = box()
    # call LSF
    new_sample = my_problem(next_node)
    # put calculation result to the box
    box.add_sample(new_sample)
    
print(box.get_pf_estimation())
sensitivities_results = box.Tri.perform_sensitivity_analysis()
print(sensitivities_results.sensitivities)
```








This software has been developed under internal academic project no. FAST-K-21-6943  "Quality Internal Grants of BUT (KInG BUT)'' supported by  the Czech Operational Programme ``Research, Development and Education''  (CZ.02.2.69/0.0/0.0/19\_073/0016948, managed by the Czech Ministry of Education.



            

Raw data

            {
    "_id": null,
    "home_page": "https://rocketgit.com/iam-git/WellMet",
    "name": "wellmet",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "failure probability,Monte Carlo,surrogate model,response surface",
    "author": "Gerasimov Aleksei",
    "author_email": "ger-alex@seznam.cz",
    "download_url": "https://files.pythonhosted.org/packages/16/c7/191109beccbc48d3f8ed6065caf0ab948cb29b652d1d76b0897291d6e12f/wellmet-0.9.7.1.tar.gz",
    "platform": null,
    "description": "WellMet is pure Python framework for spatial structural reliability analysis. Or, more specifically, for \"failure probability estimation and detection of failure surfaces by adaptive sequential decomposition of the design domain\".\n\n# Installation\n## For users of conda-based distributions\nAnaconda users are encouraged to manually install WellMet's dependencies:\n```\nconda install -c anaconda scipy\nconda install -c anaconda matplotlib\nconda install -c anaconda pandas\nconda install -c anaconda mpmath\nconda install -c anaconda pyqtgraph\n\nconda install -c conda-forge quadpy\n```\npyopengl for 3D view (optionally):\n```\nconda install -c anaconda pyopengl\n```\n\nFinally, install WellMet from PyPI:\n```\npip install wellmet\n```\n\n## For other users\nInstall WellMet from PyPI:\n```\npip install wellmet\n```\n\nWellMet relies on ```quadpy``` for simplex integration. However, quadpy became a closed source software and requires licence fee now.\nOne probably could install official quadpy package and obtain a licence in order to support Nico Schloemer.\nHowever, WellMet has never been tested with commertial quadpy versions.\nSo, we separately share the last GPL version:\n```\npip install quadpy-gpl\n```\n\n\n# How to use:\n## A. To run GUI with predefined benchmark problems:\n1. Type in shell: ```python -m wellmet```\n2. Choose problem to solve, choose (optionally) filename to store samples and estimations, set up the algorithm.\n3. Press \"Batch run...\" button and type desired number of LSF calls.\n\n## B. To test the algorithm on your own problem use the following code:\n```\nimport numpy as np\nimport scipy.stats as stats\n\nfrom wellmet.qt_gui import qt_box_functions as gui\nfrom wellmet import whitebox\nfrom wellmet.samplebox import SampleBox\nfrom wellmet import f_models\n\n\n# 1. Set up probability distribution\n# Standard Gaussian variables, 2D\n#f = f_models.SNorm(2)\n# Just normal variables\nf = f_models.Norm(mean=[-1, 0], std=[2, 1])\n# Independent non-Gaussian variables\n#f = f_models.UnCorD((stats.gumbel_r, stats.uniform))\n# Correlated non-Gaussian marginals\n#f = f_models.Nataf((stats.gumbel_r, stats.weibull_min(c=1.5)), [[1,0.8], [0.8,1]])\n\n# 2. Define LSF function\ndef my_problem(input_sample):\n    # get real (physical) space coordinates\n    # X is a numpy array with shape (nsim, ndim)\n    # the algorithm normally sends (1, ndim) sample\n    X = input_sample.R\n    # LSF\n    g = X[:, 0] - X[:, 1] + 3\n    # we should return an instance of SampleBox class\n    # this instance stores coordinates along with LSF calculation result\n    return SampleBox(input_sample, g, \"my_problem\")\n\n# 3. Put them together\nwt = whitebox.WhiteBox(f, my_problem)\n\n# choose filename to store samples and estimations\ngui.read_box(wt)\n# setup algorithm\ngui.setup_dicebox(wt)\n\n# start GUI\ngui.show_box(wt)\n```\n\n## C. The same without GUI:\n```\nimport numpy as np\nimport scipy.stats as stats\n\nfrom wellmet.samplebox import SampleBox\nfrom wellmet import f_models\n\n\n# 1. Set up probability distribution\n# Standard Gaussian variables, 2D\n#f = f_models.SNorm(2)\n# Just normal variables\nf = f_models.Norm(mean=[-1, 0], std=[2, 1])\n# Independent non-Gaussian variables\n#f = f_models.UnCorD((stats.gumbel_r, stats.uniform))\n# Correlated:\n# Nataf model with correlations of the respective _Gaussian_ marginals\n#f = f_models.Nataf((stats.gumbel_r, stats.weibull_min(c=1.5)), [[1,0.8], [0.8,1]])\n\n# 2. Define LSF function\ndef my_problem(input_sample):\n    # get real (physical) space coordinates\n    # X is a numpy array with shape (nsim, ndim)\n    # the algorithm normally sends (1, ndim) sample\n    X = input_sample.R\n    # LSF\n    g = X[:, 0] - X[:, 1] + 3\n    # we should return an instance of SampleBox class\n    # it stores coordinates along with LSF calculation result\n    # with kind of signature\n    return SampleBox(input_sample, g, \"my_problem\")\n\n\n\n\n\n\n# 3. Prepare storage\n# no need to store anything\n#sample_box = SampleBox(f)\n\n# keep samples and estimations continiously stored \nfrom wellmet import reader\nsample_box = reader.Reader(\"meow_problem\", f)\n\n# 4. Setup the algorithm\nfrom wellmet.dicebox.circumtri import CirQTri\nimport quadpy\n\nscheme = quadpy.tn.stroud_tn_3_6b(sample_box.nvar)\nconvex_hull_degree = 5 # degreee of Grundmann-Moeller cubature scheme\nq = 1 # should be > 0. Greater values slightly enforces exploration\nscreening_rate = 0 # 10 means to sacrifice every tenth sample for screening\nbox = CirQTri(sample_box, scheme, convex_hull_degree, q, screening_rate)\n\n\n# 5. Here we go!\nfor i in range(20):\n    # ask where to sample the next point\n    # next_node is an f_model instance\n    next_node = box()\n    # call LSF\n    new_sample = my_problem(next_node)\n    # put calculation result to the box\n    box.add_sample(new_sample)\n    \nprint(box.get_pf_estimation())\nsensitivities_results = box.Tri.perform_sensitivity_analysis()\nprint(sensitivities_results.sensitivities)\n```\n\n\n\n\n\n\n\n\nThis software has been developed under internal academic project no. FAST-K-21-6943  \"Quality Internal Grants of BUT (KInG BUT)'' supported by  the Czech Operational Programme ``Research, Development and Education''  (CZ.02.2.69/0.0/0.0/19\\_073/0016948, managed by the Czech Ministry of Education.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "a pure Python framework for spatial structural reliability analysis",
    "version": "0.9.7.1",
    "project_urls": {
        "Homepage": "https://rocketgit.com/iam-git/WellMet"
    },
    "split_keywords": [
        "failure probability",
        "monte carlo",
        "surrogate model",
        "response surface"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75d0afa472acf317ece94c3d923eb10c54ee90ef99e1193ab321161ae8c07aa3",
                "md5": "3e3aaf0dc4f59a54e69f208478a37ab1",
                "sha256": "6d31ee7cdf6958b8f55c4a61897c602c70182c609bb92b6c0dac92211e8707ee"
            },
            "downloads": -1,
            "filename": "wellmet-0.9.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e3aaf0dc4f59a54e69f208478a37ab1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 248312,
            "upload_time": "2023-05-31T17:29:13",
            "upload_time_iso_8601": "2023-05-31T17:29:13.127849Z",
            "url": "https://files.pythonhosted.org/packages/75/d0/afa472acf317ece94c3d923eb10c54ee90ef99e1193ab321161ae8c07aa3/wellmet-0.9.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16c7191109beccbc48d3f8ed6065caf0ab948cb29b652d1d76b0897291d6e12f",
                "md5": "4b16f77ee91a2cf3098ed46b7412347f",
                "sha256": "471f244498fc8a43d142c2d81135f5dacf9a10bd4fd2c13c5cb28d2ccb9c62f0"
            },
            "downloads": -1,
            "filename": "wellmet-0.9.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4b16f77ee91a2cf3098ed46b7412347f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 223510,
            "upload_time": "2023-05-31T17:29:16",
            "upload_time_iso_8601": "2023-05-31T17:29:16.103467Z",
            "url": "https://files.pythonhosted.org/packages/16/c7/191109beccbc48d3f8ed6065caf0ab948cb29b652d1d76b0897291d6e12f/wellmet-0.9.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-31 17:29:16",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wellmet"
}
        
Elapsed time: 0.10310s