def _find_clusters_1dir_parts(x, x_in, connectivity, max_step, partitions, t_power, ndimage):
 if (partitions is None):
  (clusters, sums) = _find_clusters_1dir(x, x_in, connectivity, max_step, t_power, ndimage)
 else:
  clusters = list()
  sums = list()
  for p in range((np.max(partitions) + 1)):
   x_i = np.logical_and(x_in, (partitions == p))
   out = _find_clusters_1dir(x, x_i, connectivity, max_step, t_power, ndimage)
   clusters += out[0]
   sums.append(out[1])
  sums = np.concatenate(sums)
 return (clusters, sums)

def _find_clusters_1dir_parts ( x , x_in , connectivity , max_step , partitions , t_power , ndimage ) : if ( partitions is None ) : ( clusters , sums ) = _find_clusters_1dir ( x , x_in , connectivity , max_step , t_power , ndimage ) else : clusters = list ( ) sums = list ( ) for p in range ( ( np . max ( partitions ) + 1 ) ) : x_i = np . logical_and ( x_in , ( partitions == p ) ) out = _find_clusters_1dir ( x , x_i , connectivity , max_step , t_power , ndimage ) clusters += out [ 0 ] sums . append ( out [ 1 ] ) sums = np . concatenate ( sums ) return ( clusters , sums )
deal with partitions .