convert yield to method
@@ -534,12 +534,10 @@ class Sim(cvb.BaseSim):
return
+
def compute_results(self, verbose=None):
''' Perform final calculations on the results '''
- n_diags = self.results['new_diagnoses'].values
- n_tests = self.results['new_tests'].values
- inds = cvu.true(n_tests) # Pull out non-zero numbers of tests
- self.results['test_yield'].values[inds] = n_diags[inds]/n_tests[inds]
+ self.compute_yield()
self.compute_doubling()
self.compute_r_eff()
self.compute_likelihood()
@@ -547,6 +545,15 @@ class Sim(cvb.BaseSim):
return
+ def compute_yield(self):
+ ''' Compute test yield -- number of positive tests divided by the total number of tests '''
+ n_diags = self.results['new_diagnoses'].values # Number of positive tests
+ n_tests = self.results['new_tests'].values # Total number of tests
+ inds = cvu.true(n_tests) # Pull out non-zero numbers of tests
+ self.results['test_yield'].values[inds] = n_diags[inds]/n_tests[inds] # Calculate the yield
+ return
+
+
def compute_doubling(self, window=3, max_doubling_time=30):
'''
Calculate doubling time using exponential approximation -- a more detailed
