Pystra 1.2.3__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {Pystra-1.2.3/src/Pystra.egg-info → pystra-1.3.0}/PKG-INFO +1 -1
  2. {Pystra-1.2.3 → pystra-1.3.0/src/Pystra.egg-info}/PKG-INFO +1 -1
  3. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/__init__.py +1 -1
  4. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/calibration.py +651 -2
  5. {Pystra-1.2.3 → pystra-1.3.0}/LICENSE +0 -0
  6. {Pystra-1.2.3 → pystra-1.3.0}/README.rst +0 -0
  7. {Pystra-1.2.3 → pystra-1.3.0}/pyproject.toml +0 -0
  8. {Pystra-1.2.3 → pystra-1.3.0}/setup.cfg +0 -0
  9. {Pystra-1.2.3 → pystra-1.3.0}/setup.py +0 -0
  10. {Pystra-1.2.3 → pystra-1.3.0}/src/Pystra.egg-info/SOURCES.txt +0 -0
  11. {Pystra-1.2.3 → pystra-1.3.0}/src/Pystra.egg-info/dependency_links.txt +0 -0
  12. {Pystra-1.2.3 → pystra-1.3.0}/src/Pystra.egg-info/requires.txt +0 -0
  13. {Pystra-1.2.3 → pystra-1.3.0}/src/Pystra.egg-info/top_level.txt +0 -0
  14. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/analysis.py +0 -0
  15. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/correlation.py +0 -0
  16. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/__init__.py +0 -0
  17. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/beta.py +0 -0
  18. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/chisquare.py +0 -0
  19. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/distribution.py +0 -0
  20. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/gamma.py +0 -0
  21. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/gumbel.py +0 -0
  22. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/lognormal.py +0 -0
  23. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/maximum.py +0 -0
  24. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/normal.py +0 -0
  25. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/parent.py +0 -0
  26. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/scipydist.py +0 -0
  27. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/shiftedexponential.py +0 -0
  28. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/shiftedrayleigh.py +0 -0
  29. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/typeiiismallestvalue.py +0 -0
  30. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/typeiilargestvalue.py +0 -0
  31. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/typeilargestvalue.py +0 -0
  32. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/typeismallestvalue.py +0 -0
  33. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/uniform.py +0 -0
  34. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/weibull.py +0 -0
  35. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/distributions/zeroinflated.py +0 -0
  36. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/form.py +0 -0
  37. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/integration.py +0 -0
  38. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/loadcomb.py +0 -0
  39. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/mc.py +0 -0
  40. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/model.py +0 -0
  41. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/quadrature.py +0 -0
  42. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/sensitivity.py +0 -0
  43. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/sorm.py +0 -0
  44. {Pystra-1.2.3 → pystra-1.3.0}/src/pystra/transformation.py +0 -0
  45. {Pystra-1.2.3 → pystra-1.3.0}/tests/test_basic.py +0 -0
  46. {Pystra-1.2.3 → pystra-1.3.0}/tests/test_calibration.py +0 -0
  47. {Pystra-1.2.3 → pystra-1.3.0}/tests/test_ddm.py +0 -0
  48. {Pystra-1.2.3 → pystra-1.3.0}/tests/test_distribution.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Pystra
3
- Version: 1.2.3
3
+ Version: 1.3.0
4
4
  Summary: Python Structural Reliability Analysis
5
5
  Author-email: Colin Caprani <colin.caprani@monash.edu>, "M. Shihab Khan" <shihab.khan@monash.edu>, Jürgen Hackl <hackl.science@gmail.com>
6
6
  License: Apache 2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Pystra
3
- Version: 1.2.3
3
+ Version: 1.3.0
4
4
  Summary: Python Structural Reliability Analysis
5
5
  Author-email: Colin Caprani <colin.caprani@monash.edu>, "M. Shihab Khan" <shihab.khan@monash.edu>, Jürgen Hackl <hackl.science@gmail.com>
6
6
  License: Apache 2.0
@@ -3,7 +3,7 @@ Structural Reliability Analysis with Python.
3
3
 
4
4
  """
5
5
 
6
- __version__ = "1.2.3"
6
+ __version__ = "1.3.0"
7
7
 
8
8
  # Distributions
9
9
  from .distributions import *
@@ -4,10 +4,13 @@ import numpy as np
4
4
  import pandas as pd
5
5
  from scipy.optimize import fsolve
6
6
  from .distributions import Constant
7
+ from .model import LimitState, StochasticModel
8
+ from .form import Form
9
+ import matplotlib.pyplot as plt
7
10
 
8
11
 
9
12
  class Calibration:
10
- r"""Class for calibrating partial and comination factors.
13
+ r"""Class for calibrating partial and combination factors.
11
14
 
12
15
  The factors are: :math:`\\phi`, :math:`\\gamma`, and :math:`\\psi`
13
16
  factors for a given load combination instance and target reliability.
@@ -29,7 +32,7 @@ class Calibration:
29
32
  df_gamma : DataFrame
30
33
  A dataframe of partial factors for loads
31
34
  df_psi : DataFrame
32
- A dataframe of load combiantion factors
35
+ A dataframe of load combination factors
33
36
  dict_nom : dict
34
37
  Dictionary of nominal values
35
38
  est_method : str
@@ -977,3 +980,649 @@ class Calibration:
977
980
  print("\ngamma =", "\n", self.df_gamma.round(precision))
978
981
  print("\npsi = ", "\n", self.df_psi.round(precision))
979
982
  print("=" * n)
983
+
984
+
985
+ class GenericModel:
986
+ """
987
+ A probability model for generic calibration.
988
+ """
989
+
990
+ def __init__(self):
991
+ """
992
+ Initialize the class which holds all the probability model info.
993
+
994
+ Returns
995
+ -------
996
+ None.
997
+
998
+ """
999
+ self.phi = None
1000
+ self.gamma_g = None
1001
+ self.gamma_q = None
1002
+ self.gamma_p = None
1003
+ self.wR = None
1004
+ self.wS = None
1005
+ self.R = None
1006
+ self.G = None
1007
+ self.P = None
1008
+ self.Q = None
1009
+ self.Rk = None
1010
+ self.Gk = None
1011
+ self.Pk = None
1012
+ self.Qk = None
1013
+
1014
+ def set_factors(self, phi, gamma_g, gamma_p, gamma_q):
1015
+ """
1016
+ Assign the partial factors to the generic probability model.
1017
+
1018
+ Parameters
1019
+ ----------
1020
+ phi : float
1021
+ Capacity reduction factor.
1022
+ gamma_g : float
1023
+ Dead load factor.
1024
+ gamma_p : float
1025
+ Permanent load factor.
1026
+ gamma_q : float
1027
+ Live load factor.
1028
+
1029
+ Returns
1030
+ -------
1031
+ None.
1032
+
1033
+ """
1034
+ self.phi = phi
1035
+ self.gamma_g = gamma_g
1036
+ self.gamma_p = gamma_p
1037
+ self.gamma_q = gamma_q
1038
+
1039
+ def set_distributions(self, wR, wS, R, G, P, Q):
1040
+ """
1041
+ Assign the PySTRA distribution objects
1042
+
1043
+ Parameters
1044
+ ----------
1045
+ wR : PySTRA distribution object
1046
+ Model error for resistance.
1047
+ wS : PySTRA distribution object
1048
+ Model error for loading/analysis.
1049
+ R : PySTRA distribution object
1050
+ Resistance distribution.
1051
+ G : PySTRA distribution object
1052
+ Dead load distribution.
1053
+ P : PySTRA distribution object
1054
+ Permanent load distribution.
1055
+ Q : PySTRA distribution object
1056
+ Live load distribution.
1057
+
1058
+ Returns
1059
+ -------
1060
+ None.
1061
+
1062
+ """
1063
+ self.wR = wR
1064
+ self.wS = wS
1065
+ self.R = R
1066
+ self.G = G
1067
+ self.P = P
1068
+ self.Q = Q
1069
+
1070
+ def set_nominals(self, Rk, Gk, Pk, Qk):
1071
+ """
1072
+ Set the nominal values of the parameters for use in design.
1073
+
1074
+ Parameters
1075
+ ----------
1076
+ Rk : float
1077
+ Characteristic value of resistance.
1078
+ Gk : float
1079
+ Characteristic value of dead load.
1080
+ Pk : float
1081
+ Characteristic value of permanent load.
1082
+ Qk : float
1083
+ Characteristic value of live load.
1084
+
1085
+ Returns
1086
+ -------
1087
+ None.
1088
+
1089
+ """
1090
+ self.Rk = Rk
1091
+ self.Gk = Gk
1092
+ self.Pk = Pk
1093
+ self.Qk = Qk
1094
+
1095
+ def set_model_errors(self, wR, wS):
1096
+ """
1097
+ Set the model errors
1098
+
1099
+ Parameters
1100
+ ----------
1101
+ wR : PySTRA distribution object
1102
+ Model error for resistance.
1103
+ wS : PySTRA distribution object
1104
+ Model error for loading/analysis.
1105
+
1106
+ Returns
1107
+ -------
1108
+ None.
1109
+
1110
+ """
1111
+
1112
+ self.wR = wR
1113
+ self.wS = wS
1114
+
1115
+ def set_resistance_params(self, R, Rk, phi):
1116
+ """
1117
+ Set the resistance model parameters.
1118
+
1119
+ Parameters
1120
+ ----------
1121
+ R : PySTRA distribution object
1122
+ Resistance distribution.
1123
+ Rk : float
1124
+ Characteristic value of resistance.
1125
+ phi : float
1126
+ Capacity reduction factor.
1127
+
1128
+ Returns
1129
+ -------
1130
+ None.
1131
+
1132
+ """
1133
+
1134
+ self.R = R
1135
+ self.Rk = Rk
1136
+ self.phi = phi
1137
+
1138
+ def set_dead_params(self, G, Gk, gamma_g):
1139
+ """
1140
+ Set the dead load model parameters.
1141
+
1142
+ Parameters
1143
+ ----------
1144
+ G : PySTRA distribution object
1145
+ Dead load distribution.
1146
+ Gk : float
1147
+ Characteristic value of dead load.
1148
+ gamma_g : float
1149
+ Partial factor for dead load.
1150
+
1151
+ Returns
1152
+ -------
1153
+ None.
1154
+
1155
+ """
1156
+
1157
+ self.G = G
1158
+ self.Gk = Gk
1159
+ self.gamma_g = gamma_g
1160
+
1161
+ def set_permanent_params(self, P, Pk, gamma_p):
1162
+ """
1163
+ Set the permanent load model parameters.
1164
+
1165
+ Parameters
1166
+ ----------
1167
+ P : PySTRA distribution object
1168
+ Permanent load distribution.
1169
+ Pk : float
1170
+ Characteristic value of permanent load.
1171
+ gamma_p : float
1172
+ Partial factor for permanent load.
1173
+
1174
+ Returns
1175
+ -------
1176
+ None.
1177
+
1178
+ """
1179
+
1180
+ self.P = P
1181
+ self.Pk = Pk
1182
+ self.gamma_p = gamma_p
1183
+
1184
+ def set_live_params(self, Q, Qk, gamma_q):
1185
+ """
1186
+ Set the dead load model parameters.
1187
+
1188
+ Parameters
1189
+ ----------
1190
+ Q : PySTRA distribution object
1191
+ Live load distribution.
1192
+ Qk : float
1193
+ Characteristic value of live load.
1194
+ gamma_q : float
1195
+ Partial factor for live load.
1196
+
1197
+ Returns
1198
+ -------
1199
+ None.
1200
+
1201
+ """
1202
+
1203
+ self.Q = Q
1204
+ self.Qk = Qk
1205
+ self.gamma_q = gamma_q
1206
+
1207
+ def get(self):
1208
+ """
1209
+ Return a tuple of all the probability model parameters
1210
+
1211
+ Returns
1212
+ -------
1213
+ phi : float
1214
+ Capacity reduction factor.
1215
+ gamma_g : float
1216
+ Dead load factor.
1217
+ gamma_p : float
1218
+ Permanent load factor.
1219
+ gamma_q : float
1220
+ Live load factor.
1221
+ wR : PySTRA distribution object
1222
+ Model error for resistance.
1223
+ wS : PySTRA distribution object
1224
+ Model error for loading/analysis.
1225
+ R : PySTRA distribution object
1226
+ Resistance distribution.
1227
+ G : PySTRA distribution object
1228
+ Dead load distribution.
1229
+ P : PySTRA distribution object
1230
+ Permanent load distribution.
1231
+ Q : PySTRA distribution object
1232
+ Live load distribution.
1233
+ Rk : float
1234
+ Characteristic value of resistance.
1235
+ Gk : float
1236
+ Characteristic value of dead load.
1237
+ Pk : float
1238
+ Characteristic value of permanent load.
1239
+ Qk : float
1240
+ Characteristic value of live load.
1241
+
1242
+ """
1243
+ return (
1244
+ self.phi,
1245
+ self.gamma_g,
1246
+ self.gamma_p,
1247
+ self.gamma_q,
1248
+ self.wR,
1249
+ self.wS,
1250
+ self.R,
1251
+ self.G,
1252
+ self.P,
1253
+ self.Q,
1254
+ self.Rk,
1255
+ self.Gk,
1256
+ self.Pk,
1257
+ self.Qk,
1258
+ )
1259
+
1260
+
1261
+ class GenericCalibration:
1262
+ """
1263
+ A generic code calibration
1264
+ """
1265
+
1266
+ def __init__(self, aq_points, ag_points):
1267
+ """
1268
+ Initialize the generic code calibration class with the calculation points.
1269
+
1270
+ Parameters
1271
+ ----------
1272
+ q_points : nd.array
1273
+ The grid of points to use for the live load ratio.
1274
+ g_points : nd.array
1275
+ The grid of points to use for the dead load ratio.
1276
+
1277
+ Returns
1278
+ -------
1279
+ None.
1280
+
1281
+ """
1282
+ self.aq_points = aq_points
1283
+ self.ag_points = ag_points
1284
+ self.prob_models = []
1285
+ self.is_analysed = False
1286
+
1287
+ def add_model(self, model, color, label):
1288
+ """
1289
+ Add a probability model to the calibration.
1290
+
1291
+ Parameters
1292
+ ----------
1293
+ model : GenericModel object
1294
+ A probability model.
1295
+ color : str
1296
+ Matplotlib string representation of a colour for plotting.
1297
+ label : str
1298
+ Label for use in plot legend.
1299
+
1300
+ Returns
1301
+ -------
1302
+ None.
1303
+
1304
+ """
1305
+ self.is_analysed = False
1306
+ model_dict = {"model": model, "betas": None, "color": color, "label": label}
1307
+ self.prob_models.append(model_dict)
1308
+
1309
+ def lsf(self, z, aq, ag, wR, R, wS, G, P, Q):
1310
+ """
1311
+ Limit state function for the generic code calibration problem.
1312
+
1313
+ Parameters
1314
+ ----------
1315
+ z : float
1316
+ Design parameter.
1317
+ aq : float
1318
+ Ratio of dead to total dead and permanent load.
1319
+ ag : float
1320
+ Ratio of live to total loads.
1321
+ wR : float
1322
+ Model error for resistance.
1323
+ R : float
1324
+ Normalized resistance.
1325
+ wS : float
1326
+ Model error for loading/analysis.
1327
+ G : float
1328
+ Normalized dead load.
1329
+ P : float
1330
+ Normalized permanent load.
1331
+ Q : float
1332
+ Normalized live load.
1333
+
1334
+ Returns
1335
+ -------
1336
+ float
1337
+ Evaluation of the limit state.
1338
+
1339
+ """
1340
+ return z * wR * R - wS * ((1 - aq) * (ag * G + (1 - ag) * P) + aq * Q)
1341
+
1342
+ def design(self, aq, ag, phi, gamma_g, gamma_p, gamma_q, Rk, Gk, Pk, Qk):
1343
+ """
1344
+ Do a structural design for z, the design parameter, based on the code rules.
1345
+
1346
+ Parameters
1347
+ ----------
1348
+ aq : float
1349
+ Ratio of dead to total dead and permanent load.
1350
+ ag : float
1351
+ Ratio of live to total loads.
1352
+ phi : float
1353
+ Capacity reduction factor.
1354
+ gamma_g : float
1355
+ Dead load factor.
1356
+ gamma_p : float
1357
+ Permanent load factor.
1358
+ gamma_q : float
1359
+ Live load factor.
1360
+ Rk : float
1361
+ Characteristic value of resistance.
1362
+ Gk : float
1363
+ Characteristic value of dead load.
1364
+ Pk : float
1365
+ Characteristic value of permanent load.
1366
+ Qk : float
1367
+ Characteristic value of live load.
1368
+
1369
+ Returns
1370
+ -------
1371
+ z : float
1372
+ Design parameter.
1373
+
1374
+ """
1375
+ z = (1 / (phi * Rk)) * (
1376
+ (1 - aq) * (ag * gamma_g * Gk + (1 - ag) * gamma_p * Pk) + aq * gamma_q * Qk
1377
+ )
1378
+ return z
1379
+
1380
+ def analyse_design(self, z, aq, ag, wR, R, wS, G, P, Q):
1381
+ """
1382
+ Reliability analysis of the design according to the code rules.
1383
+
1384
+ Parameters
1385
+ ----------
1386
+ z : float
1387
+ Design parameter.
1388
+ aq : float
1389
+ Ratio of dead to total dead and permanent load.
1390
+ ag : float
1391
+ Ratio of live to total loads.
1392
+ wR : float
1393
+ Model error for resistance.
1394
+ R : float
1395
+ Normalized resistance.
1396
+ wS : float
1397
+ Model error for loading/analysis.
1398
+ G : float
1399
+ Normalized dead load.
1400
+ P : float
1401
+ Normalized permanent load.
1402
+ Q : float
1403
+ Normalized live load.
1404
+
1405
+ Returns
1406
+ -------
1407
+ float
1408
+ The reliability index, beta.
1409
+
1410
+ """
1411
+ limit_state = LimitState(self.lsf)
1412
+
1413
+ stochastic_model = StochasticModel()
1414
+ stochastic_model.addVariable(wR)
1415
+ stochastic_model.addVariable(R)
1416
+ stochastic_model.addVariable(wS)
1417
+ stochastic_model.addVariable(G)
1418
+ stochastic_model.addVariable(P)
1419
+ stochastic_model.addVariable(Q)
1420
+
1421
+ stochastic_model.addVariable(Constant("z", z))
1422
+ stochastic_model.addVariable(Constant("aq", aq))
1423
+ stochastic_model.addVariable(Constant("ag", ag))
1424
+
1425
+ form = Form(
1426
+ stochastic_model=stochastic_model,
1427
+ limit_state=limit_state,
1428
+ )
1429
+ form.run()
1430
+ return form.getBeta()
1431
+
1432
+ def get_reliabilities(self, Aq, Ag, model):
1433
+ """
1434
+ Determine the reliabilities across the full range of dead and live load ratios.
1435
+
1436
+ Parameters
1437
+ ----------
1438
+ Aq : nd.array
1439
+ The grid of live load ratio points.
1440
+ Ag : nd.array
1441
+ The grid of dead load ratio points.
1442
+ model : GenericModel
1443
+ Probability model and code rules for analysis.
1444
+
1445
+ Returns
1446
+ -------
1447
+ beta : nd.array
1448
+ Reliability indices at each dead and live load ratio grid point.
1449
+
1450
+ """
1451
+ beta = np.zeros((Ag.size, Aq.size))
1452
+ for i, ag in enumerate(Ag):
1453
+ for j, aq in enumerate(Aq):
1454
+ (
1455
+ phi,
1456
+ gamma_g,
1457
+ gamma_p,
1458
+ gamma_q,
1459
+ wR,
1460
+ wS,
1461
+ R,
1462
+ G,
1463
+ P,
1464
+ Q,
1465
+ Rk,
1466
+ Gk,
1467
+ Pk,
1468
+ Qk,
1469
+ ) = model.get()
1470
+ z = self.design(aq, ag, phi, gamma_g, gamma_p, gamma_q, Rk, Gk, Pk, Qk)
1471
+ beta[i, j] = self.analyse_design(z, aq, ag, wR, R, wS, G, P, Q)
1472
+ return beta
1473
+
1474
+ def analyse(self):
1475
+ """
1476
+ Analyse the code calibration problem given the probability models.
1477
+
1478
+ Raises
1479
+ ------
1480
+ ValueError
1481
+ If there are no probability models assigned.
1482
+
1483
+ Returns
1484
+ -------
1485
+ None.
1486
+
1487
+ """
1488
+ if not self.prob_models:
1489
+ raise ValueError("No probability models assigned")
1490
+
1491
+ for pm in self.prob_models:
1492
+ pm["betas"] = self.get_reliabilities(
1493
+ self.aq_points, self.ag_points, pm["model"]
1494
+ )
1495
+
1496
+ self.is_analysed = True
1497
+
1498
+ def add_range(self, ax, xl, xu, ytext, text, alpha):
1499
+ def range_text(ax, x1, y1, x2, y2, text):
1500
+ ax.annotate(
1501
+ text="",
1502
+ xy=(x1, y1),
1503
+ xytext=(x2, y2),
1504
+ arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0),
1505
+ )
1506
+ ax.text(
1507
+ x1 + (x2 - x1) / 2,
1508
+ 1.01 * y1 + (y2 - y1) / 2,
1509
+ text,
1510
+ ha="center",
1511
+ va="bottom",
1512
+ )
1513
+
1514
+ ax.axvspan(xl, xu, facecolor="k", alpha=alpha)
1515
+ range_text(ax, xl, ytext, xu, ytext, text)
1516
+
1517
+ def plot_region(self, ax, x, beta, facecolor, label):
1518
+ """
1519
+ Plots a region of reliability indices, and adds a line for the smallest
1520
+ dead load ratio.
1521
+
1522
+ Parameters
1523
+ ----------
1524
+ ax : Matplotlib Axes object
1525
+ The axes to plot on.
1526
+ x : nd.array
1527
+ Vector of live load ratio points.
1528
+ beta : nd.array
1529
+ Matrix of reliability indices correspond go the dead and live ratios grid.
1530
+ facecolor : str
1531
+ Matplotlib string description of a colour.
1532
+ label : str
1533
+ Label for the plot legend.
1534
+
1535
+ Returns
1536
+ -------
1537
+ None.
1538
+
1539
+ """
1540
+ ax.fill_between(
1541
+ x,
1542
+ beta.min(axis=0),
1543
+ beta.max(axis=0),
1544
+ alpha=0.5,
1545
+ facecolor=facecolor,
1546
+ label=label,
1547
+ )
1548
+ ax.plot(x, beta[-1], color=facecolor, ls=":")
1549
+
1550
+ def beta_region_plot(self, Aq, data, beta_t, ranges, figsize=(12, 9), **kwargs):
1551
+ """
1552
+ The main plotting function.
1553
+
1554
+ Parameters
1555
+ ----------
1556
+ Aq : nd.array
1557
+ Vector of live load ratio points..
1558
+ data : List[Dict{GemericModel}]
1559
+ List of dictionaries of GenericModels, plotting info, and results.
1560
+ beta_t : float
1561
+ Target reliability index.
1562
+ ranges : Dict
1563
+ A dictionary of range information with the following keys:
1564
+ xl, xu, ytext, text, alpha
1565
+ defining the lower and upper aq values, the position of the text, the text,
1566
+ and the alpha of the range colouring.
1567
+ figsize : Tuple(float), optional
1568
+ The figure size in inches. The default is (12, 9).
1569
+
1570
+ Returns
1571
+ -------
1572
+ fig : Matplotlib Figure object
1573
+ The figure.
1574
+ ax : Matplotlib Axes object
1575
+ The axes.
1576
+
1577
+ """
1578
+ x = Aq
1579
+
1580
+ fig, ax = plt.subplots(figsize=figsize, **kwargs)
1581
+ ax.set_axisbelow(True)
1582
+ ax.grid(which="both", ls=":", color="k")
1583
+
1584
+ if ranges:
1585
+ for r in ranges:
1586
+ self.add_range(ax, **r)
1587
+
1588
+ for d in data:
1589
+ self.plot_region(ax, x, d["betas"], d["color"], d["label"])
1590
+ ax.axhline(beta_t, color="k", ls="--")
1591
+ t = ax.text(0.01, 0.99 * beta_t, rf"$\beta_T = {beta_t}$", ha="left", va="top")
1592
+ t.set_bbox(dict(edgecolor="w", facecolor="w", alpha=0.8, pad=0))
1593
+ ax.set_xlabel(r"Variable load ratio, $a_q = Q/(G+P+Q)$")
1594
+ ax.set_ylabel(r"Reliability index, $\beta$")
1595
+ ax.legend(loc="upper left")
1596
+ return fig, ax
1597
+
1598
+ def plot(self, beta_t=4.7, ranges=None, **kwargs):
1599
+ """
1600
+ Plot the region for each probability model with their descriptions.
1601
+
1602
+ Parameters
1603
+ ----------
1604
+ beta_t : float
1605
+ Target reliability index.
1606
+ ranges : Dict
1607
+ A dictionary of range information with the following keys:
1608
+ xl, xu, ytext, text, alpha
1609
+ defining the lower and upper aq values, the position of the text, the text,
1610
+ and the alpha of the range colouring.
1611
+
1612
+ Raises
1613
+ ------
1614
+ ValueError
1615
+ If there are no analysis results.
1616
+
1617
+ Returns
1618
+ -------
1619
+ fig,ax : Tuple(Matplotlib Figure, Matplotlib Axes)
1620
+ The figure and axes.
1621
+
1622
+ """
1623
+ if not self.is_analysed:
1624
+ raise ValueError("Must be analysed before plotting")
1625
+
1626
+ return self.beta_region_plot(
1627
+ self.aq_points, self.prob_models, beta_t, ranges, **kwargs
1628
+ )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes