-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogn_params.py
More file actions
executable file
·34 lines (30 loc) · 833 Bytes
/
logn_params.py
File metadata and controls
executable file
·34 lines (30 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 26 15:32:13 2020
This script contains a function for calculating the equivalent normal
parameters of a lognormally distributed random variable
@author: shihab
"""
import numpy as np
def logn_params(mean=0.0, cov=0.1):
"""
This function calculates the equivalent normal
parameters of a lognormally distributed random variable
Parameters
----------
mean : float, optional
mean of RV. The default is 0.
cov : float, optional
Coefficient of variation of RV. The default is 0.1.
Returns
-------
list
[ln0, lns, lnv, lncv].
"""
std = mean*cov
ln0 = np.log(mean/np.sqrt(1+cov**2))
lnv = np.log(1+cov**2)
lns = np.sqrt(lnv)
lncv = lns/ln0
return [ln0, lns, lnv, lncv]