def _filterLikelihoods(likelihoods, redThreshold=0.99999, yellowThreshold=0.999):
 redThreshold = (1.0 - redThreshold)
 yellowThreshold = (1.0 - yellowThreshold)
 filteredLikelihoods = [likelihoods[0]]
 for (i, v) in enumerate(likelihoods[1:]):
  if (v <= redThreshold):
   if (likelihoods[i] > redThreshold):
    filteredLikelihoods.append(v)
   else:
    filteredLikelihoods.append(yellowThreshold)
  else:
   filteredLikelihoods.append(v)
 return filteredLikelihoods

def _filterLikelihoods ( likelihoods , redThreshold = 0.99999 , yellowThreshold = 0.999 ) : redThreshold = ( 1.0 - redThreshold ) yellowThreshold = ( 1.0 - yellowThreshold ) filteredLikelihoods = [ likelihoods [ 0 ] ] for ( i , v ) in enumerate ( likelihoods [ 1 : ] ) : if ( v <= redThreshold ) : if ( likelihoods [ i ] > redThreshold ) : filteredLikelihoods . append ( v ) else : filteredLikelihoods . append ( yellowThreshold ) else : filteredLikelihoods . append ( v ) return filteredLikelihoods
filter the list of raw likelihoods so that we only preserve sharp increases in likelihood .