forked from aidanbharath/TPL_assessment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroupScoreTemplates.py
72 lines (60 loc) · 1.88 KB
/
groupScoreTemplates.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from numpy import sqrt, sum, product
def investOp(x, name):
capOp, others = [], []
for idx in x.loc[name].index:
if 'CAPEX' in idx or 'OPEX' in idx:
capOp.append(x.loc[name,'Input Score'][idx])
else:
others.append(x.loc[name,'Input Score'][idx])
result = [sum(capOp)]+others
return product(result)**(1/len(result))
def pnc(x,name):
return x.loc[name[0],'Input Score'].product()**(1/x.loc[name[0],'Input Score'].shape[0])
def baseEQ(x,name):
return x.loc[name,'Input Score'].product()**(1/x.loc[name,'Input Score'].shape[0])
gst = {
'Cost of Energy':{
'Performance': baseEQ
},
'Investment Opportunity':{
'Investment Opportunity': investOp
},
'Permitting and Certification':{
'Area Use Conflicts': pnc,
'Ecological Impacts': pnc,
'Environmental Impacts': pnc
},
'Safety and Function':{
'Be Survivable': baseEQ
},
'Be Deployable Globally':{
'Be Deployable Globally': baseEQ
}
}
def coe_third_level(x,name,capexScale=0.7,opexScale=0.3):
cap, op, others = [], [], []
X = x.loc[name]
for idx,_ in X.index:
if 'CAPEX' in idx:
cap = X.loc[idx,'Net'].mean()
elif 'OPEX' in idx:
op = X.loc[idx,'Net'].mean()
else:
others.append(X.loc[idx,'Net'].mean())
weirds = [1/((capexScale/cap)+(opexScale/op))]
result = weirds+others
return product(result)**(1/len(result))
def safe(x,name):
values = []
X = x.loc[name]
for idx in X.index.get_level_values(0).unique():
values.append(X.loc[idx,'Net'].mean())
return product(values)**(1/len(values))
def io(x,name):
return x.loc[name,'Net'].mean()
hst = {
'Cost of Energy': coe_third_level,
'Permitting and Certification': baseEQ,
'Safety and Function': safe,
'Investment Opportunity': io
}