def correlation_row_generator(bt, pmf, category):
 data = array([i for i in bt.iter_data(axis='observation')])
 try:
  cat_vect = array([pmf[s][category] for s in bt.ids()], dtype=float)
  return ((row, cat_vect) for row in data)
 except ValueError:
  raise ValueError(("Mapping file category contained data that couldn't " + "be converted to float. Can't continue."))

def correlation_row_generator ( bt , pmf , category ) : data = array ( [ i for i in bt . iter_data ( axis = 'observation' ) ] ) try : cat_vect = array ( [ pmf [ s ] [ category ] for s in bt . ids ( ) ] , dtype = float ) return ( ( row , cat_vect ) for row in data ) except ValueError : raise ValueError ( ( "Mapping file category contained data that couldn't " + "be converted to float. Can't continue." ) )
produce a generator that feeds lists of arrays to any gradient test .