nodes: 0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, identifier:clf; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# obtain a 3D array with accuracy numbers; 14, expression_statement; 15, comment:# get result tuple list from the volume; 16, expression_statement; 17, expression_statement; 18, if_statement; 19, return_statement; 20, comment:""" run activity-based voxel selection
  
          Sort the voxels based on the cross-validation accuracy
          of their activity vectors within the searchlight
  
          Parameters
          ----------
          clf: classification function
              the classifier to be used in cross validation
  
          Returns
          -------
          result_volume: 3D array of accuracy numbers
              contains the voxelwise accuracy numbers obtained via Searchlight
          results: list of tuple (voxel_id, accuracy)
              the accuracy numbers of all voxels, in accuracy descending order
              the length of array equals the number of voxels
          """; 21, assignment; 22, comparison_operator:rank == 0; 23, block; 24, call; 25, call; 26, comparison_operator:rank == 0; 27, block; 28, assignment; 29, assignment; 30, assignment; 31, comparison_operator:rank == 0; 32, block; 33, expression_list; 34, identifier:rank; 35, call; 36, identifier:rank; 37, integer:0; 38, expression_statement; 39, attribute; 40, argument_list; 41, attribute; 42, argument_list; 43, identifier:rank; 44, integer:0; 45, expression_statement; 46, identifier:result_volume; 47, call; 48, identifier:result_list; 49, subscript; 50, identifier:results; 51, list; 52, identifier:rank; 53, integer:0; 54, for_statement; 55, comment:# Sort the voxels; 56, expression_statement; 57, expression_statement; 58, identifier:result_volume; 59, identifier:results; 60, attribute; 61, argument_list; 62, call; 63, attribute; 64, identifier:distribute; 65, list; 66, attribute; 67, attribute; 68, identifier:broadcast; 69, tuple; 70, call; 71, attribute; 72, argument_list; 73, identifier:result_volume; 74, attribute; 75, pattern_list; 76, call; 77, block; 78, call; 79, call; 80, attribute; 81, identifier:Get_rank; 82, attribute; 83, argument_list; 84, identifier:self; 85, identifier:sl; 86, attribute; 87, identifier:self; 88, identifier:mask; 89, identifier:self; 90, identifier:sl; 91, attribute; 92, attribute; 93, identifier:clf; 94, attribute; 95, argument_list; 96, attribute; 97, identifier:run_searchlight; 98, identifier:_sfn; 99, identifier:self; 100, identifier:mask; 101, identifier:idx; 102, identifier:value; 103, identifier:enumerate; 104, argument_list; 105, if_statement; 106, expression_statement; 107, attribute; 108, argument_list; 109, attribute; 110, argument_list; 111, identifier:MPI; 112, identifier:COMM_WORLD; 113, identifier:logger; 114, identifier:info; 115, string; 116, identifier:self; 117, identifier:data; 118, identifier:self; 119, identifier:labels; 120, identifier:self; 121, identifier:num_folds; 122, identifier:logger; 123, identifier:info; 124, string; 125, identifier:self; 126, identifier:sl; 127, identifier:result_list; 128, comparison_operator:value is None; 129, block; 130, call; 131, identifier:results; 132, identifier:sort; 133, keyword_argument; 134, keyword_argument; 135, identifier:logger; 136, identifier:info; 137, string; 138, string_content:running activity-based voxel selection via Searchlight; 139, string_content:data preparation done; 140, identifier:value; 141, None; 142, expression_statement; 143, attribute; 144, argument_list; 145, identifier:key; 146, lambda; 147, identifier:reverse; 148, True; 149, string_content:activity-based voxel selection via Searchlight is done; 150, assignment; 151, identifier:results; 152, identifier:append; 153, tuple; 154, lambda_parameters; 155, subscript; 156, identifier:value; 157, integer:0; 158, identifier:idx; 159, identifier:value; 160, identifier:tup; 161, identifier:tup; 162, integer:1
code: def run(self, clf):
          """ run activity-based voxel selection
  
          Sort the voxels based on the cross-validation accuracy
          of their activity vectors within the searchlight
  
          Parameters
          ----------
          clf: classification function
              the classifier to be used in cross validation
  
          Returns
          -------
          result_volume: 3D array of accuracy numbers
              contains the voxelwise accuracy numbers obtained via Searchlight
          results: list of tuple (voxel_id, accuracy)
              the accuracy numbers of all voxels, in accuracy descending order
              the length of array equals the number of voxels
          """
          rank = MPI.COMM_WORLD.Get_rank()
          if rank == 0:
              logger.info(
                  'running activity-based voxel selection via Searchlight'
              )
          self.sl.distribute([self.data], self.mask)
          self.sl.broadcast((self.labels, self.num_folds, clf))
          if rank == 0:
              logger.info(
                  'data preparation done'
              )
  
          # obtain a 3D array with accuracy numbers
          result_volume = self.sl.run_searchlight(_sfn)
          # get result tuple list from the volume
          result_list = result_volume[self.mask]
          results = []
          if rank == 0:
              for idx, value in enumerate(result_list):
                  if value is None:
                      value = 0
                  results.append((idx, value))
              # Sort the voxels
              results.sort(key=lambda tup: tup[1], reverse=True)
              logger.info(
                  'activity-based voxel selection via Searchlight is done'
              )
          return result_volume, results