code: def _make_sparse_stc(
      X,
      active_set,
      forward,
      tmin,
      tstep,
      active_is_idx=False,
      pick_ori=None,
      verbose=None,
  ):
      source_nn = forward["source_nn"]
      vector = False
      if not is_fixed_orient(forward):
          if pick_ori != "vector":
              logger.info("combining the current components...")
              X = combine_xyz(X)
          else:
              vector = True
              source_nn = np.reshape(source_nn, (-1, 3, 3))
  
      if not active_is_idx:
          active_idx = np.where(active_set)[0]
      else:
          active_idx = active_set
  
      n_dip_per_pos = 1 if is_fixed_orient(forward) else 3
      if n_dip_per_pos > 1:
          active_idx = np.unique(active_idx // n_dip_per_pos)
  
      src = forward["src"]
      vertices = []
      n_points_so_far = 0
      for this_src in src:
          this_n_points_so_far = n_points_so_far + len(
              this_src["vertno"]
          )
          this_active_idx = active_idx[
              (n_points_so_far <= active_idx)
              & (active_idx < this_n_points_so_far)
          ]
          this_active_idx -= n_points_so_far
          this_vertno = this_src["vertno"][this_active_idx]
          n_points_so_far = this_n_points_so_far
          vertices.append(this_vertno)
      source_nn = source_nn[active_idx]
      return _make_stc(
          X,
          vertices,
          src.kind,
          tmin,
          tstep,
          src[0]["subject_his_id"],
          vector=vector,
          source_nn=source_nn,
      )
  
imports: import numpy
  from .._fiff.proj import deactivate_proj
  from ..dipole import Dipole
  from ..fixes import _safe_svd
  from ..forward import is_fixed_orient
  from ..minimum_norm.inverse import _check_reference, _log_exp_var, _prepare_forward, combine_xyz
  from ..source_estimate import SourceEstimate, _BaseSourceEstimate, _make_stc
  from ..utils import _check_depth, _check_option, _validate_type, check_random_state, logger, sum_squared, verbose, warn
  from .mxne_optim import _Phi, groups_norm2, iterative_mixed_norm_solver, iterative_tf_mixed_norm_solver, mixed_norm_solver, norm_epsilon_inf, norm_l2inf, tf_mixed_norm_solver
label_desc: Use image node_id 6 for calling a global function with example usage: _make_sparse_stc(X, active_set, forward, tmin, tstep, active_is_idx, pick_ori, verbose) and returns: _make_stc