viroconwebcontour.compute_interface module

Interface between viroconweb and the package viroconcom.

The package viroconcom handles the statistical computations and is imported in this module.

class contour.compute_interface.ComputeInterface[source]

Bases: object

static fit_curves(fit_settings, var_number)[source]

Interface to fit a probabilistic model to a measurement file with the viroconcom package.

Parameters:
  • mfm_item (MeasureFileModel,) – Contains the measured data, which should be evaluated.
  • fit_settings (?,) – The settings how the fit should be performed. Here, the distribution, which should be fitted to the data, is specified.
  • var_number (int,) – Number of random variables that the probabilistic model should have.
Returns:

fit – The fit contains the probabilistic model, which was fitted to the measurement data, as well as data describing how well the fit worked.

Return type:

Fit,

static hdc(return_period, state_duration, limits, deltas)[source]

Interface to viroconcom to compute an highest density contour (HDC).

Parameters:
  • probabilistic_model (ProbabilisticModel,) – The probabilistic model, i.e. the joint distribution function, which should be evaluated.
  • return_period (float,) – The return period of the contour in years.
  • state_duration (float,) – The sea state’s or more general the environmental state’s duration in hours.
  • limits (list of tuple,) – One 2-element tuple per dimension in mul_var_distribution, containing min and max limits for calculation ((min, max)). The smaller value is always assumed minimum.
  • deltas (float or list of float,) – The grid cell size used for the calculation. If a single float is supplied it is used for all dimensions. If a list of float is supplied it has to be of the same length as there are dimensions in mul_var_dist.
Returns:

contour_coordinates – Contains the coordinates of points on the contour. The outer list contains can hold multiple contour paths if the distribution is multimodal. The inner list contains multiple numpy arrays of the same length, one per dimension. The values of the arrays are the coordinates in the corresponding dimension.

Return type:

list of list of numpy.ndarray,

static iform(return_period, state_duration, n_points)[source]

Interface to viroconcom to compute an IFORM contour.

Parameters:
  • probabilistic_model (ProbabilisticModel,) – The probabilistic model, i.e. the joint distribution function, which should be evaluated.
  • return_period (float,) – The return period of the contour in years.
  • state_duration (float,) – The sea state’s or more general the environmental state’s duration in hours.
  • n_points (int,) – Number of points along the contour that should be calculated.
Returns:

contour_coordinates – Contains the coordinates of points on the contour. The outer list contains can hold multiple contour paths if the distribution is multimodal. The inner list contains multiple numpy arrays of the same length, one per dimension. The values of the arrays are the coordinates in the corresponding dimension.

Return type:

list of list of numpy.ndarray,

contour.compute_interface.adjust(var)[source]

Adjusts the variables types of values, which correspond to viroconweb’s models, which are associated to a database, to variable types compatible with the viroconcom package.

contour.compute_interface.setup_mul_dist(probabilistic_model: contour.models.ProbabilisticModel)[source]

Generates a MultiVariateDistribution from a ProbabilisticModel.

MultiVariateDistribution objects are used to perform the statistical computations in the viroconcom package. ProbabilisticModel objects are used in the viroconweb package to be saved in the data base.

Parameters:probabilistic_model (ProbabilisticModel,) – The probabilistic model, which should be converted.
Returns:mutivar_distribution – The object, which can be used in the viroconcom package.
Return type:MultivariateDistribution,