7
7
8
8
logger = logging .getLogger (__name__ )
9
9
10
- class TTCCalculation (Enum ):
10
+ class ProbCalculationMethod (Enum ):
11
11
SAMPLE = 1
12
12
EXPECTED = 2
13
13
14
- def sample_ttc (probs_dict ):
15
- """Calculate the sampled value from a ttc distribution function
14
+ def sample_prob (probs_dict ):
15
+ """Calculate the sampled value from a probability distribution function
16
16
Arguments:
17
17
probs_dict - a dictionary containing the probability distribution
18
18
function that is part of a TTC
@@ -67,8 +67,8 @@ def sample_ttc(probs_dict):
67
67
f'function encountered { probs_dict ["name" ]} !' )
68
68
69
69
70
- def expected_ttc (probs_dict ):
71
- """Calculate the expected value from a ttc distribution function
70
+ def expected_prob (probs_dict ):
71
+ """Calculate the expected value from a probability distribution function
72
72
Arguments:
73
73
probs_dict - a dictionary containing the probability distribution
74
74
function that is part of a TTC
@@ -122,8 +122,8 @@ def expected_ttc(probs_dict):
122
122
f'function encountered { probs_dict ["name" ]} !' )
123
123
124
124
125
- def calculate_ttc (probs_dict : dict , method : TTCCalculation ) -> float :
126
- """Calculate the value from a ttc distribution
125
+ def calculate_prob (probs_dict : dict , method : ProbCalculationMethod ) -> float :
126
+ """Calculate the value from a probability distribution
127
127
Arguments:
128
128
probs_dict - a dictionary containing the probability distribution
129
129
corresponding to the TTC
@@ -142,8 +142,8 @@ def calculate_ttc(probs_dict: dict, method: TTCCalculation) -> float:
142
142
match (probs_dict ['type' ]):
143
143
case 'addition' | 'subtraction' | 'multiplication' | \
144
144
'division' | 'exponentiation' :
145
- lv = calculate_ttc (probs_dict ['lhs' ], method )
146
- rv = calculate_ttc (probs_dict ['rhs' ], method )
145
+ lv = calculate_prob (probs_dict ['lhs' ], method )
146
+ rv = calculate_prob (probs_dict ['rhs' ], method )
147
147
match (probs_dict ['type' ]):
148
148
case 'addition' :
149
149
return lv + rv
@@ -161,10 +161,10 @@ def calculate_ttc(probs_dict: dict, method: TTCCalculation) -> float:
161
161
162
162
case 'function' :
163
163
match (method ):
164
- case TTCCalculation .SAMPLE :
165
- return sample_ttc (probs_dict )
166
- case TTCCalculation .EXPECTED :
167
- return expected_ttc (probs_dict )
164
+ case ProbCalculationMethod .SAMPLE :
165
+ return sample_prob (probs_dict )
166
+ case ProbCalculationMethod .EXPECTED :
167
+ return expected_prob (probs_dict )
168
168
case _:
169
169
raise ValueError ('Unknown TTC Calculation method '
170
170
f'encountered { method } !' )
0 commit comments