Skip to content

Commit

Permalink
create directory for source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanny Sarrazin committed Jan 23, 2023
1 parent a39584a commit af0e182
Show file tree
Hide file tree
Showing 16 changed files with 8,641 additions and 8,641 deletions.
1,322 changes: 661 additions & 661 deletions SAFEpython/EET.py → src/EET.py

Large diffs are not rendered by default.

1,110 changes: 555 additions & 555 deletions SAFEpython/FAST.py → src/FAST.py

Large diffs are not rendered by default.

996 changes: 498 additions & 498 deletions SAFEpython/HBV.py → src/HBV.py

Large diffs are not rendered by default.

778 changes: 389 additions & 389 deletions SAFEpython/HyMod.py → src/HyMod.py

Large diffs are not rendered by default.

2,406 changes: 1,203 additions & 1,203 deletions SAFEpython/PAWN.py → src/PAWN.py

Large diffs are not rendered by default.

914 changes: 457 additions & 457 deletions SAFEpython/RSA_groups.py → src/RSA_groups.py

Large diffs are not rendered by default.

1,192 changes: 596 additions & 596 deletions SAFEpython/RSA_thres.py → src/RSA_thres.py

Large diffs are not rendered by default.

1,438 changes: 719 additions & 719 deletions SAFEpython/VBSA.py → src/VBSA.py

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions SAFEpython/__init__.py → src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 25 14:48:18 2018
@author: fs14746
"""

__version__ = "1.0.0"
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 25 14:48:18 2018
@author: fs14746
"""

__version__ = "1.0.0"
170 changes: 85 additions & 85 deletions SAFEpython/ishigami_homma.py → src/ishigami_homma.py
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
"""
Module to compute the Ishigami-Homma function
This module is part of the SAFE Toolbox by F. Pianosi, F. Sarrazin and
T. Wagener at Bristol University (2015).
SAFE is provided without any warranty and for non-commercial use only.
For more details, see the Licence file included in the root directory
of this distribution.
For any comment and feedback, or to discuss a Licence agreement for
commercial use, please contact: [email protected]
For details on how to cite SAFE in your publication, please see:
https://safetoolbox.github.io
Package version: SAFEpython_v0.1.0
References:
Saltelli et al. (2008) Global Sensitivity Analysis, The Primer, Wiley.
"""

from __future__ import division, absolute_import, print_function

import numpy as np
from numba import jit

@jit
def ishigami_homma_function(x):
"""Implements the Ishigami-Homma function, a standard benchmark function in
the Sensitivity Analysis literature (see for instance Eq. (4.34) in
Saltelli et al. (2008)).
Usage:
y, V, Si_ex, STi_ex= ishigami_homma_function(x)
Input:
x = vector of inputs x[0],x[1],x[2] - numpy.ndarray(3, )
x(i) ~ Unif(-pi,+pi) for all i
Output:
y = output - numpy.ndarray(1,)
V = output variance (*) - numpy.ndarray(1,)
Si_ex = first-order sensitivity indices (*) - numpy.ndarray(3, )
STi_ex = total-order sensitivity indices (*) - numpy.ndarray(3, )
(*) = exact value computed analytically
REFERENCES
Saltelli et al. (2008) Global Sensitivity Analysis, The Primer, Wiley.
This function is part of the SAFE Toolbox by F. Pianosi, F. Sarrazin
and T. Wagener at Bristol University (2015).
SAFE is provided without any warranty and for non-commercial use only.
For more details, see the Licence file included in the root directory
of this distribution.
For any comment and feedback, or to discuss a Licence agreement for
commercial use, please contact: [email protected]
For details on how to cite SAFE in your publication, please see:
https://www.safetoolbox.info"""

a=2
b=1
y = np.array(np.sin(x[0]) + a*(np.sin(x[1]))**2 + b*(x[2])**4*np.sin(x[0]))

# By model definition, we should get:
# VARy = VAR(Y) = 1/2 + a^2/8 + b*pi^4/5 + b^2*pi^8/18
# V1 = VAR(E(Y|X1)) = 1/2 + b*pi^4/5 + b^2*pi^8/50
# V2 = VAR(E(Y|X2)) = a^2/8
# V3 = VAR(E(Y|X3)) = 0
# V13 = VAR(E(Y|X1,X3)) = b^2*pi^4/18 - b^2*pi^8/50
# V12 = V23 = V123 = 0
# and thus:
# ST1 = S1 + S13
# ST2 = S2
# ST3 = S13

Si_ex = np.nan * np.ones((3,))
STi_ex = np.nan * np.ones((3,))
V = np.array(1/2 + a**2/8 + b*np.pi**4/5 + b**2*np.pi**8/18)
Si_ex[0] = (1/2 + b*np.pi**4/5 + b**2*np.pi**8/50)/V
Si_ex[1] = a**2/8 / V
Si_ex[2] = 0
STi_ex[0] = Si_ex[0] + (b**2*np.pi**8/18 - b**2*np.pi**8/50)/V
STi_ex[1] = Si_ex[1]
STi_ex[2] = (b**2*np.pi**8/18 - b**2*np.pi**8/50)/V

"""
Module to compute the Ishigami-Homma function
This module is part of the SAFE Toolbox by F. Pianosi, F. Sarrazin and
T. Wagener at Bristol University (2015).
SAFE is provided without any warranty and for non-commercial use only.
For more details, see the Licence file included in the root directory
of this distribution.
For any comment and feedback, or to discuss a Licence agreement for
commercial use, please contact: [email protected]
For details on how to cite SAFE in your publication, please see:
https://safetoolbox.github.io
Package version: SAFEpython_v0.1.0
References:
Saltelli et al. (2008) Global Sensitivity Analysis, The Primer, Wiley.
"""

from __future__ import division, absolute_import, print_function

import numpy as np
from numba import jit

@jit
def ishigami_homma_function(x):
"""Implements the Ishigami-Homma function, a standard benchmark function in
the Sensitivity Analysis literature (see for instance Eq. (4.34) in
Saltelli et al. (2008)).
Usage:
y, V, Si_ex, STi_ex= ishigami_homma_function(x)
Input:
x = vector of inputs x[0],x[1],x[2] - numpy.ndarray(3, )
x(i) ~ Unif(-pi,+pi) for all i
Output:
y = output - numpy.ndarray(1,)
V = output variance (*) - numpy.ndarray(1,)
Si_ex = first-order sensitivity indices (*) - numpy.ndarray(3, )
STi_ex = total-order sensitivity indices (*) - numpy.ndarray(3, )
(*) = exact value computed analytically
REFERENCES
Saltelli et al. (2008) Global Sensitivity Analysis, The Primer, Wiley.
This function is part of the SAFE Toolbox by F. Pianosi, F. Sarrazin
and T. Wagener at Bristol University (2015).
SAFE is provided without any warranty and for non-commercial use only.
For more details, see the Licence file included in the root directory
of this distribution.
For any comment and feedback, or to discuss a Licence agreement for
commercial use, please contact: [email protected]
For details on how to cite SAFE in your publication, please see:
https://www.safetoolbox.info"""

a=2
b=1
y = np.array(np.sin(x[0]) + a*(np.sin(x[1]))**2 + b*(x[2])**4*np.sin(x[0]))

# By model definition, we should get:
# VARy = VAR(Y) = 1/2 + a^2/8 + b*pi^4/5 + b^2*pi^8/18
# V1 = VAR(E(Y|X1)) = 1/2 + b*pi^4/5 + b^2*pi^8/50
# V2 = VAR(E(Y|X2)) = a^2/8
# V3 = VAR(E(Y|X3)) = 0
# V13 = VAR(E(Y|X1,X3)) = b^2*pi^4/18 - b^2*pi^8/50
# V12 = V23 = V123 = 0
# and thus:
# ST1 = S1 + S13
# ST2 = S2
# ST3 = S13

Si_ex = np.nan * np.ones((3,))
STi_ex = np.nan * np.ones((3,))
V = np.array(1/2 + a**2/8 + b*np.pi**4/5 + b**2*np.pi**8/18)
Si_ex[0] = (1/2 + b*np.pi**4/5 + b**2*np.pi**8/50)/V
Si_ex[1] = a**2/8 / V
Si_ex[2] = 0
STi_ex[0] = Si_ex[0] + (b**2*np.pi**8/18 - b**2*np.pi**8/50)/V
STi_ex[1] = Si_ex[1]
STi_ex[2] = (b**2*np.pi**8/18 - b**2*np.pi**8/50)/V

return y, V, Si_ex, STi_ex
Loading

0 comments on commit af0e182

Please sign in to comment.