def get_per_sample_average_diversities(rarefaction_data, depth=None):
 if (depth is None):
  depth = array(rarefaction_data[3])[:, 0].max()
 rare_mat = array([row for row in rarefaction_data[3] if (row[0] == depth)])
 rare_mat = rare_mat.mean(0)[2:]
 sids = rarefaction_data[0][3:]
 return dict(izip(sids, rare_mat))

def get_per_sample_average_diversities ( rarefaction_data , depth = None ) : if ( depth is None ) : depth = array ( rarefaction_data [ 3 ] ) [ : , 0 ] . max ( ) rare_mat = array ( [ row for row in rarefaction_data [ 3 ] if ( row [ 0 ] == depth ) ] ) rare_mat = rare_mat . mean ( 0 ) [ 2 : ] sids = rarefaction_data [ 0 ] [ 3 : ] return dict ( izip ( sids , rare_mat ) )
extract data rows from rarefaction data matrix .