-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscript.py
More file actions
51 lines (33 loc) · 1.04 KB
/
script.py
File metadata and controls
51 lines (33 loc) · 1.04 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 14:07:08 2017
@author: pianarol
"""
import numpy as np
import math
import hypy as hp
###function cmp ###
# RPT_CMP
#
# Description:
# Internal script used for the ***_rpt functions.
# It computes the drawdown, derivative and residuals of a given model.
#
# See also: rpt_lgd, rpt_llt, rpt_plt
def cmp(p,t,s,name):
#keep only the positive time
t,s = hp.hyclean(t,s)
#define regular points to plot the calculated drawdown
tc = np.logspace(np.log10(t[0]), np.log10(t[len(t)-1]), num = len(t), endpoint = True, base = 10.0, dtype = np.float64)
#compute the drawdown with the model
string = 'hp.'+name+'.dim(p,tc)'
sc = eval(string)
#keep only the positive drawdown
tc,sc = hp.hyclean(tc,sc)
#Compute the residuals and their statistics
residuals = s - hp.ths.dim(p,t)
mr = np.mean(residuals)
sr = 2 * np.nanstd(residuals)
rms = math.sqrt(np.mean(residuals**2))
return tc,sc,mr,sr,rms