Project#
This module contains all the basic functionality for a project.
A project forms the foundation for performing analyses, such as reliability, uncertainty or sensitivity analyses. In addition to reliability analyses, additional functionalities are available to combine or upscale reliability results.
A model can be assigned to a project, which can be either a Python script or a model run by the PTK (the ptk wheel is required for this). When a model is assigned, stochastic variables and a correlation matrix are automatically generated.
- class CombineProject[source]#
Bases:
FrozenObjectProject for combining design points. This is the main entry point for performing combining design points.
The design points to be combined should be added to the list of design_points.
To run the combination, use the run method. This results in a design_point, where the reliability index reflects the combined reliability index. The original design_points are added to the probabilistic_library.reliability.DesignPoint.contributing_design_points of the resulting design point.
- property correlation_matrix: SelfCorrelationMatrix#
Auto correlation matrix, holds correlations between same named variables in the design_points
- property design_point: DesignPoint#
The resulting combined design point, invoked by run Is empty when the run failed. The original design_points are added to the probabilistic_library.reliability.DesignPoint.contributing_design_point
- property design_points: list[DesignPoint]#
List of design points to be combined
- run()[source]#
Performs the combination of the design point. Results in a design_point, which is part of this project. When failed, the design_point is empty.
- property settings: CombineSettings#
Settings for the combination algorithm
- class ExcludingCombineProject[source]#
Bases:
FrozenObjectProject for combining design points exclusively or, otherwise stated, design points calculated for a scenario. This is the main entry point for this operation.
Excluding design points refer to design points generated for a scenario. Each scenario has a probability too, but scenarios are mutually exclusive. Probabilities of scenarios should add up to 1.
The design points to be combined should be added to the list of design_points. The list of scenarios should correspond with the list of design_points.
To run the combination, use the run method. This results in a design_point, where the reliability index reflects the combined reliability index. The original design_points are added to the probabilistic_library.reliability.DesignPoint.contributing_design_points of the resulting design point.
- property design_point#
The resulting excluding combined design point, invoked by run. Is empty when the run failed. The original design_points are added to the contributing_design_points
- property design_points: list[DesignPoint]#
List of design points to be combined
- run()[source]#
Performs the excluding combination of the design point. Results in a design point, which is part of this project. When failed, the design_point is empty.
- property scenarios: list[Scenario]#
List of scenarios corresponding with design points to be combined
- property settings: ExcludingCombineSettings#
Settings for the combine algorithm
- class LengthEffectProject[source]#
Bases:
FrozenObjectProject for applying the length effect to a design point, also known as upscaling in space. This is the main entry point for applying the length effect.
When a design point is valid for a certain section or cross section, it can be useful to make it applicable to a longer section. This operation takes into account the length effect or upscaling. Each input variable is valid for a certain length. These lengths are stored in the correlation_lengths list. The length effect applied to the design point results in a design point valid for the requested length.
To run the combination, use the LengthEffectProject.run method. This results in a design_point, where the reliability index reflects the length effect applied reliability index. The original LengthEffectProject.design_point_cross_section is added to the probabilistic_library.reliability.DesignPoint.contributing_design_points of the resulting design point.
- class LengthEffectProject{
+design_point_cross_section DesignPoint +design_point DesignPoint +run()
}
class Stochast{} class SelfCorrelationMatrix{} class Stochast{}
DesignPoint “input” <– LengthEffectProject DesignPoint “result” <– LengthEffectProject SelfCorrelationMatrix <– LengthEffectProject Stochast “*” <– SelfCorrelationMatrix
- property correlation_lengths: list[float]#
List of lengths of the input variables, should match with the input variables
- property correlation_matrix: SelfCorrelationMatrix#
Auto correlation matrix, holds correlations of variables in the design_point_cross_section
- property design_point: DesignPoint#
The length effect applied design point, invoked by run Is empty when the run failed. The original design_point_cross_section is added to the DesignPoint.contributing_design_point
- property design_point_cross_section: DesignPoint#
The design point to which the length effect will be applied
- property length: float#
Length to be applied to the design point. The resulting design point will be applicable to this length
- class ModelParameter(id=None)[source]#
Bases:
FrozenObjectInput or output parameter of a model
A model parameter is part of a ZModel, as one of its input or output parameters. It is generated when a ZModel is created. By reflection and type hints as much as possible information about the parameter is provided.
- property array_size: int#
Array size, in case the parameter is an array
- property default_value: float#
Default value of the parameter
- property index: int#
Sequence number of the parameter in the list of input or output parameters of a ZModel
- property is_array: bool#
Indicates whether the parameter is an array
- property name: str#
Name of the parameter
- class ModelProject[source]#
Bases:
FrozenObjectBase class for projects, which contain a model
When a model is set to model, the model input parameters and output parameters are updated. Based on these parameters, variables, correlation matrix and settings and settings per variable are generated in this class.
- property copulas: CopulaCorrelation#
Correlation copula based on the input parameters of the model
- property correlation_matrix: CorrelationMatrix#
Correlation matrix based on the input parameters of the model
- property correlation_type: CorrelationType#
- property model: ZModel#
Method which serves as a model. A model is a function which calculates real world results based on real world input data (or is an academic function). It often relates to physical processes and is deterministic (it does not use uncertainty)
When a model is set, it accepts a python function or python class method. Alternatively, a string defining a function is accepted too. The model should accept a number of input values (floats) or array of input values and returns a single value (float), an array of floats or a tuple of floats.
When set, the function/method/string is wrapped in a ZModel. The ZModel has information about its input and output parameters (derived from the function signature). When the model is retrieved, the ZModel object is returned.
It is also possible to set a ZModelContainer, which can provide a ZModel. PTK models are set with a ZModelContainer (using ptk.whl)
- class ReliabilityProject[source]#
Bases:
ModelProjectProject for reliability analysis. This is the main entry point for performing a reliability analysis.
This class is based on the ModelProject class. The model to use is defined in this class in ModelProject.model. When a model is set, variables, correlation matrix and settings and settings per variable are generated.
To run a reliability analysis, use the run method. This results in a design_point, where the reliability index, alpha values and, if specified in the settings, an overview of performed realizations and generated messages.
- property design_point: DesignPoint#
The resulting design point of a reliability analysis, invoked by run Is empty when the run failed
- property limit_state_function: LimitStateFunction#
Defines the transformation of the model output to a z-value By default, the first value in the model output is used as z-value
- run()[source]#
Performs the reliability analysis Results in a design_point, which is part of this project. When failed, the design_point is empty.
- property total_model_runs: int#
Total model runs performed by the last run
- class RunProject[source]#
Bases:
ModelProjectProject for a running a model. This is the main entry point for running a model.
This class is based on the ModelProject class. The model to use is defined in this class in ModelProject.model. When a model is set, variables and settings are generated.
To run the model, use the run method. This results are stored in realization.
- property realization: Evaluation#
Realization of the performed model run
- property settings: RunProjectSettings#
Settings for running a model
- class RunProjectSettings[source]#
Bases:
FrozenObjectSettings for a model run
- property reuse_calculations: bool#
Indicates whether previous model results will be reused by the model run.
- property run_values_type: RunValuesType#
Defines which value to extract from the stochastic variables
- class RunValuesType(value)[source]#
Bases:
EnumEnumeration which defines which value to use from a stochastic variable
- design_values = 'design_values'#
- mean_values = 'mean_values'#
- median_values = 'median_values'#
- class SensitivityProject[source]#
Bases:
ModelProjectProject for a sensitivity analysis. This is the main entry point for performing a sensitivity analysis.
This class is based on the ModelProject class. The model to use is defined in this class in ModelProject.model. When a model is set, variables, correlation matrix and settings and settings per variable are generated.
To run a sensitivity analysis, use the run method. This results are stored in a list of results, where each result corresponds with an output parameter. A shortcut is provided in result, which corresponds with the first output parameter.
- property parameter: str#
Output parameter for which the sensitivity analysis should be performed, if left blank it will be performed for all output parameters
- property result: SensitivityResult#
Sensitivity result corresponding with the output parameters
- property results: list[SensitivityResult]#
List of sensitivity results, corresponding with the output parameters
- run()[source]#
Performs the sensitivity analysis Results will be stored in results, for the first output parameter in result.
- property settings: SensitivitySettings#
Settings for the sensitivity algorithm
- property total_model_runs: int#
Total model runs performed by the last run
- class UncertaintyProject[source]#
Bases:
ModelProjectProject for an uncertainty analysis. This is the main entry point for performing an uncertainty analysis.
This class is based on the ModelProject class. The model to use is defined in this class in ‘ModelProject.model’. When a model is set, variables, correlation matrix and settings and settings per variable are generated.
The uncertainty analysis calculates the uncertainty for the output parameter selected in ‘parameter’. If left blank, uncertainty analyses are performed for each output parameter.
To run an uncertainty analysis, use the run method. This results in a list of results. Each result contains the uncertainty for a certain output parameter. Part of the result is a stochast, which contains the distribution of the output parameter. A shortcut to the stochasts is available via stochasts. The first output parameter result can also be accessed by result and stochast.
If correlation between output parameters is requested via the settings, the resulting correlation matrix can be found in output_correlation_matrix.
- property output_correlation_matrix: CorrelationMatrix#
Correlation matrix between output parameters and possibly with input parameters Depends on settings UncertaintySettings.calculate_correlations and UncertaintySettings.calculate_input_correlations whether this correlation matrix is generated
- property parameter: str#
Output parameter for which the uncertainty analysis should be performed, if left blank it will be performed for all output parameters
- property result: UncertaintyResult#
Uncertainty result of the first output parameter
- property results: list[UncertaintyResult]#
List of uncertainty results, corresponding with the output parameters
- run()[source]#
Performs the uncertainty analysis Results will be stored in results, for the first output parameter in result. The stochasts in the results are available directly in stochasts and stochast
- property settings: UncertaintySettings#
Settings for the uncertainty algorithm
- property stochasts: list[Stochast]#
List of probability distributions, corresponding with the output parameters
- property total_model_runs: int#
Total model runs performed by the last run
- class ZModel(callback=None, output_parameter_size=1)[source]#
Bases:
FrozenObjectWrapper around a python function or method.
This class is created by a ModelProject when its model is set.
The ZModel provides additional information about its input and output parameters. This is based on reflection when the ZModel is created.
- initialize_for_run()[source]#
Method to be called before the first run (this method is used internally by ModelProject)
- property input_parameters: list[ModelParameter]#
List of input parameters
- property name: str#
Name of the model
- property output_parameters: list[ModelParameter]#
List of output parameters
- run_multiple(samples)[source]#
Performs the execution of multiple samples by the model (used internally)