def test_thresholded_brownian_probability(self): """Brownian prob should return dict of state probabilities""" #x = thresholded_brownian_probability(2.2755, 1001**0.5, 0.03, min_val = 0.0,increment = 1.00,trait_prob_cutoff = 1e-4) #lines = ["\t".join(map(str,[k,x[k]]))+"\n" for k in sorted(x.keys())] #for line in lines: # print line #print "Total prob:", sum(x.values()) start_state = 3.0 var = 30.00 d = 0.03 min_val = 0.0 increment = 1.0 trait_prob_cutoff = 1e-200 obs = thresholded_brownian_probability(start_state,d,var,min_val,\ increment,trait_prob_cutoff) #TODO: Need to calculate exact values for this minimal case #with the Larson & Farber Z tables, by hand. #For now test for sanity #Test that no probabilities below threshold are included self.assertTrue(min(obs.values()) > trait_prob_cutoff) #Test that start values +1 or -1 are equal self.assertEqual(obs[2.0],obs[4.0]) #Test that the start state is the highest prob value self.assertEqual(max(obs.values()),obs[start_state])