iam-git / WellMet (public) (License: MIT) (since 2021-08-31) (hash sha1)
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".

/plotly_plot.py (1feb1d43e90e027f35bbd0a6730ab18501cef63a) (2807 bytes) (mode 100644) (type blob)

#!/usr/bin/env python
# coding: utf-8

import plotly.graph_objects as go


def tri_estimation_graph(bx, tri_estimation_name='TRI_current_estimations', filename=''):
    if not filename:
        filename = 'store/%s_%s_%s_graph'%(bx.gm_signature, repr(bx), tri_estimation_name)

    data = bx.guessbox.estimations[tri_estimation_name]
    x=data[0]
    # it can be effectively done with pandas
    p_f = []
    p_mix = []
    p_outside = []
    p_success = []
    for estimation in data[1]:
        # -1 = 'out', 0=success, 1=failure, 2=mix
        p_f.append(estimation[1])
        p_mix.append(estimation[2])
        p_outside.append(estimation[-1])
        p_success.append(estimation[0])
    
    
    # uplně hahoru - success
    # outside
    # mix
    # uplně dolu - failure
    
    fig = go.Figure()
    
    fig.add_trace(go.Scatter(
        x=x, y=p_f,
        mode='lines',
        line=dict(width=0.5, color='red'), #rgb(184, 247, 212)
        name="Failure",
        stackgroup='one',
        groupnorm='fraction' # sets the normalization for the sum of the stackgroup
    ))
    fig.add_trace(go.Scatter(
        x=x, y=p_mix,
        mode='lines',
        line=dict(width=0.5, color='orange'),
        name="Mixed",
        stackgroup='one'
    ))
    fig.add_trace(go.Scatter(
        x=x, y=p_outside,
        mode='lines',
        line=dict(width=0.5, color='white'),
        name="Outside",
        stackgroup='one'
    ))
    fig.add_trace(go.Scatter(
        x=x, y=p_success,
        mode='lines',
        line=dict(width=0.5, color='green'),
        name="Success",
        stackgroup='one'
    ))
    try:
        fig.add_trace(go.Scatter(x=(min(x),max(x)), y=(bx.pf_exact,bx.pf_exact),
                    mode='lines',
                    name=bx.pf_exact_method,
                    line=dict(color='blue')))
    except AttributeError:
        pass
    
    fig.update_layout(
        showlegend=True,
        #xaxis_type='category',
        yaxis=dict(
            type='linear',
            range=[0, 1],
            #ticksuffix='%'
            ))
            
    # zatím nechcu nikomu nic zobrazovat
    #fig.show()
    fig.write_html(filename + ".html")
    
    # kdyby někdo chtěl statické obrázky
    # musí mať psutil nainštalovany
    try:
        fig.write_image(filename + ".png")
    except:
        pass 
        
    # vratíme figuru,
    # uživatel by mohl s ní eště něčo udělat    
    return fig





# 3D plot requires WebGL support
# which is not currently availiable under Haiku.
#
#import plotly.graph_objects as go
#import numpy as np
#
## Helix equation
#t = np.linspace(0, 10, 50)
#x, y, z = np.cos(t), np.sin(t), t
#
#fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,
#                                   mode='markers')])
#fig.show()
#


Mode Type Size Ref File
100644 blob 28117 0907e38499eeca10471c7d104d4b4db30b8b7084 IS_stat.py
100644 blob 6 0916b75b752887809bac2330f3de246c42c245cd __init__.py
100644 blob 72 458b7e2ca46acd9ec0d2caf3cc4d72e515bb73dc __main__.py
100644 blob 73368 3d245b8568158ac63c80fa0847631776a140db0f blackbox.py
100644 blob 11243 10c424c2ce5e8cdd0da97a5aba74c54d1ca71e0d candybox.py
100644 blob 29927 066a2d10ea1d21daa6feb79fa067e87941299ec4 convex_hull.py
100644 blob 104545 e18d5341a83d25a9fb1c50dfcf0e918938f0d5da dicebox.py
100644 blob 36886 d27b8a79485ea48402937e44102a2c44fcef4dc5 estimation.py
100644 blob 34394 3f0ab9294a9352a071de18553aa687c2a9e6917a f_models.py
100644 blob 35721 3daee87ec0bc670207356490e16f200fed0d4fc4 g_models.py
100644 blob 20916 664935796049ce2f405be7c5bc6981a10fb72a8e ghull.py
100644 blob 2718 5d721d117448dbb96c554ea8f0e4651ffe9ac457 gp_plot.py
100644 blob 29393 96162a5d181b8307507ba2f44bafe984aa939163 lukiskon.py
100644 blob 2888 0c4303f8865b4861382119d77147f227958f2aec misc.py
040000 tree - e83032b6b83795f53d85ba08eb565f1e82d19951 mplot
100644 blob 1462 437b0d372b6544c74fea0d2c480bb9fd218e1854 plot.py
100644 blob 2807 1feb1d43e90e027f35bbd0a6730ab18501cef63a plotly_plot.py
040000 tree - 6e1bcfee31549c0fa0a3dc2f88ebe138fdc6754a qt_gui
100644 blob 8566 5c8f8cc2a34798a0f25cb9bf50b5da8e86becf64 reader.py
100644 blob 4284 a0e0b4e593204ff6254f23a67652804db07800a6 samplebox.py
100644 blob 6558 df0e88ea13c95cd1463a8ba1391e27766b95c3a5 sball.py
100644 blob 6739 0b6f1878277910356c460674c04d35abd80acf13 schemes.py
100644 blob 76 11b2fde4aa744a1bc9fa1b419bdfd29a25c4d3e8 shapeshare.py
100644 blob 54884 fbe116dab4fc19bb7568102de21f53f15a8fc6bf simplex.py
100644 blob 13090 2b9681eed730ecfadc6c61b234d2fb19db95d87d spring.py
100644 blob 10953 da8a8aaa8cac328ec0d1320e83cb802b562864e2 stm_df.py
040000 tree - a41d3eeae051f742aaa02a0037d14b4fd067357e testcases
100644 blob 2465 d829bff1dd721bdb8bbbed9a53db73efac471dac welford.py
100644 blob 25318 fcdabd880bf7199783cdb9c0c0ec88c9813a5b18 whitebox.py
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/iam-git/WellMet

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/iam-git/WellMet

Clone this repository using git:
git clone git://git.rocketgit.com/user/iam-git/WellMet

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main