code: def define_models(self, ic, leaves=None, N=1, index=0):
          
  
          self.clear_models()
  
          if leaves is None:
              leaves = self._get_leaves()
          elif type(leaves)==type(''):
              leaves = self.select_leaves(leaves)
  
          # Sort leaves by distance, to ensure system 0 will be assigned
          # to the main reference star.
  
  
          if np.isscalar(N):
              N = (np.ones(len(leaves))*N)
              #if np.size(index) > 1:
              #    index = [index]
          N = np.array(N).astype(int)
  
          if np.isscalar(index):
              index = (np.ones_like(N)*index)
          index = np.array(index).astype(int)
  
          # Add the appropriate number of model nodes to each
          #  star in the highest-resoluion image
          for s,n,i in zip(leaves, N, index):
              # Remove any previous model nodes (should do some checks here?)
              s.remove_children()
              s.add_model(ic, n, i)
  
          # For each system, make sure tag _0 is the brightest.
          self._fix_labels()
  
          self._N = N
          self._index = index
  
          self._clear_all_leaves()
docs: N, index are either integers or lists of integers.
  
          N : number of model stars per observed star
          index : index of physical association
  
          leaves: either a list of leaves, or a pattern by which
          the leaves are selected (via `select_leaves`)
  
          If these are lists, then they are defined individually for
          each leaf.
  
          If `index` is a list, then each entry must be either
          an integer or a list of length `N` (where `N` is the corresponding
              entry in the `N` list.)
  
          This bugs up if you call it multiple times.  If you want
          to re-do a call to this function, please re-define the tree.