diff --git a/docs/code/reliability/form/plot_FORM_linear_function_3d.py b/docs/code/reliability/form/FORM_linear_function_3d.py similarity index 71% rename from docs/code/reliability/form/plot_FORM_linear_function_3d.py rename to docs/code/reliability/form/FORM_linear_function_3d.py index 055d7272..2e492e0f 100644 --- a/docs/code/reliability/form/plot_FORM_linear_function_3d.py +++ b/docs/code/reliability/form/FORM_linear_function_3d.py @@ -35,13 +35,13 @@ dist3 = Normal(loc=4., scale=0.4) model = PythonModel(model_script='local_pfn.py', model_object_name="example3",) -RunModelObject3 = RunModel(model=model) +run_model = RunModel(model=model) -Z0 = FORM(distributions=[dist1, dist2, dist3], runmodel_object=RunModelObject3) -Z0.run() +form = FORM(distributions=[dist1, dist2, dist3], runmodel_object=run_model) +form.run() -print('Design point in standard normal space: %s' % Z0.design_point_u) -print('Design point in original space: %s' % Z0.design_point_x) -print('Hasofer-Lind reliability index: %s' % Z0.beta) -print('FORM probability of failure: %s' % Z0.failure_probability) +print('Design point in standard normal space: %s' % form.design_point_u) +print('Design point in original space: %s' % form.design_point_x) +print('Hasofer-Lind reliability index: %s' % form.beta) +print('FORM probability of failure: %s' % form.failure_probability) diff --git a/docs/code/reliability/sorm/local_model4.py b/docs/code/reliability/sorm/local_model4.py new file mode 100644 index 00000000..6c0808cc --- /dev/null +++ b/docs/code/reliability/sorm/local_model4.py @@ -0,0 +1,8 @@ +import numpy as np + + +def example4(samples=None): + g = np.zeros(samples.shape[0]) + for i in range(samples.shape[0]): + g[i] = samples[i, 0] * samples[i, 1] - 80 + return g \ No newline at end of file diff --git a/docs/code/reliability/sorm/local_pfn.py b/docs/code/reliability/sorm/local_pfn.py index db3584d0..2903bf25 100644 --- a/docs/code/reliability/sorm/local_pfn.py +++ b/docs/code/reliability/sorm/local_pfn.py @@ -6,14 +6,15 @@ """ import numpy as np + def example1(samples=None): g = np.zeros(samples.shape[0]) - for i in range(samples.shape[0]): + for i in range(samples.shape[0]): R = samples[i, 0] S = samples[i, 1] g[i] = R - S return g - + def example2(samples=None): import numpy as np @@ -21,18 +22,15 @@ def example2(samples=None): beta = 3.0902 g = np.zeros(samples.shape[0]) for i in range(samples.shape[0]): - g[i] = -1/np.sqrt(d) * (samples[i, 0] + samples[i, 1]) + beta + g[i] = -1 / np.sqrt(d) * (samples[i, 0] + samples[i, 1]) + beta return g def example3(samples=None): g = np.zeros(samples.shape[0]) for i in range(samples.shape[0]): - g[i] = 6.2*samples[i, 0] - samples[i, 1]*samples[i, 2]**2 + g[i] = 6.2 * samples[i, 0] - samples[i, 1] * samples[i, 2] ** 2 return g - -def example4(samples=None): - g = np.zeros(samples.shape[0]) - for i in range(samples.shape[0]): - g[i] = samples[i, 0]*samples[i, 1] - 80 - return g \ No newline at end of file + + + diff --git a/docs/code/reliability/sorm/plot_SORM_nonlinear_function.py b/docs/code/reliability/sorm/plot_SORM_nonlinear_function.py index 25538613..05b2f32d 100644 --- a/docs/code/reliability/sorm/plot_SORM_nonlinear_function.py +++ b/docs/code/reliability/sorm/plot_SORM_nonlinear_function.py @@ -34,13 +34,13 @@ dist1 = Normal(loc=20., scale=2) dist2 = Lognormal(s=s, loc=0.0, scale=scale) -model = PythonModel(model_script='local_pfn.py', model_object_name="example4",) +model = PythonModel(model_script='local_model4.py', model_object_name="example4") RunModelObject4 = RunModel(model=model) form = FORM(distributions=[dist1, dist2], runmodel_object=RunModelObject4) form.run() -Q0 = SORM(form_object=form) +sorm = SORM(form_object=form) # print results -print('SORM probability of failure: %s' % Q0.failure_probability) +print('SORM probability of failure: %s' % sorm.failure_probability)