Skip to content

Commit

Permalink
Added Type Hints to GSI module
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Bhustali committed May 23, 2022
1 parent 3584406 commit 9fcda77
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/UQpy/sensitivity/generalised_sobol.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@

import numpy as np

from typing import Union
from beartype import beartype

from UQpy.sensitivity.baseclass.sensitivity import Sensitivity
from UQpy.sensitivity.baseclass.pickfreeze import generate_pick_freeze_samples
from UQpy.utilities.UQpyLoggingFormatter import UQpyLoggingFormatter
from UQpy.utilities.ValidationTypes import (
PositiveFloat,
PositiveInteger,
NumpyFloatArray,
NumpyIntArray,
)


class GeneralisedSobol(Sensitivity):
Expand Down Expand Up @@ -80,11 +89,12 @@ def __init__(
self.num_vars = None
"Number of model input variables, :class:`int`"

@beartype
def run(
self,
n_samples=1_000,
num_bootstrap_samples=None,
confidence_level=0.95,
n_samples: PositiveInteger = 1_000,
num_bootstrap_samples: PositiveInteger = None,
confidence_level: PositiveFloat = 0.95,
):

"""
Expand Down Expand Up @@ -247,8 +257,11 @@ def run(
return computed_indices

@staticmethod
@beartype
def compute_first_order_generalised_sobol_indices(
A_model_evals, B_model_evals, C_i_model_evals
A_model_evals: Union[NumpyFloatArray, NumpyIntArray],
B_model_evals: Union[NumpyFloatArray, NumpyIntArray],
C_i_model_evals: Union[NumpyFloatArray, NumpyIntArray],
):

"""
Expand Down Expand Up @@ -313,8 +326,11 @@ def compute_first_order_generalised_sobol_indices(
return gen_sobol_i

@staticmethod
@beartype
def compute_total_order_generalised_sobol_indices(
A_model_evals, B_model_evals, C_i_model_evals
A_model_evals: Union[NumpyFloatArray, NumpyIntArray],
B_model_evals: Union[NumpyFloatArray, NumpyIntArray],
C_i_model_evals: Union[NumpyFloatArray, NumpyIntArray],
):

"""
Expand Down

0 comments on commit 9fcda77

Please sign in to comment.