parameters: ( self, start_nodes, max_distance, threshold, backtrace )
return_statement: return sorted(connected)
docstring: ignore all connections less than threshold
docstring_summary: ignore all connections less than threshold
docstring_tokens: ignore all connections less than threshold
function: def k_distance_from( self, start_nodes, max_distance, threshold, backtrace ):
  		'''ignore all connections less than threshold'''
  		assert max_distance >= 1, "max_distance must be >= 1"
  
  		# if we passed a single int, make a list of it.
  		if type(start_nodes) is int:
  			start_nodes = [ start_nodes ]
  
  		assert 0 <= min(start_nodes) <= max(start_nodes) <= self.num_neurons, "start_nodes weren't within [0,num_neurons]"
  
  
  
  #		print self.cxnmatrix
  
  		m = matrix( abs(self.cxnmatrix) > threshold, dtype=int )
  
  		# if going backwards, invert the matrix and then look forward
  		if backtrace:
  			m = m.T
  
  		v = zeros( (m.shape[0],1), dtype=int ); v[start_nodes] = 1
  		connected = []
  
  		for i in range(max_distance):
  #			print "depth %s START:\t %s" % (i+1, v.T )
  			v = m*v
  			indices = v.nonzero()[0].tolist()
  
  #			print "depth %s END:  \t %s -- adding indices=%s" % (i+1, v.T, indices)
  
  			# append to our list of connected_nodes, uniqueify
  			connected = list(set( connected+indices ))
  
  
  #		print "returning: ", connected
  		return sorted(connected)
function_tokens: def k_distance_from ( self , start_nodes , max_distance , threshold , backtrace ) : assert max_distance >= 1 , "max_distance must be >= 1" # if we passed a single int, make a list of it. if type ( start_nodes ) is int : start_nodes = [ start_nodes ] assert 0 <= min ( start_nodes ) <= max ( start_nodes ) <= self . num_neurons , "start_nodes weren't within [0,num_neurons]" #		print self.cxnmatrix m = matrix ( abs ( self . cxnmatrix ) > threshold , dtype = int ) # if going backwards, invert the matrix and then look forward if backtrace : m = m . T v = zeros ( ( m . shape [ 0 ] , 1 ) , dtype = int ) v [ start_nodes ] = 1 connected = [ ] for i in range ( max_distance ) : #			print "depth %s START:\t %s" % (i+1, v.T ) v = m * v indices = v . nonzero ( ) [ 0 ] . tolist ( ) #			print "depth %s END:  \t %s -- adding indices=%s" % (i+1, v.T, indices) # append to our list of connected_nodes, uniqueify connected = list ( set ( connected + indices ) ) #		print "returning: ", connected return sorted ( connected )