code: def _do_prim_curr(rr, coils):
      """Calculate primary currents in a set of MEG coils.
  
      See Mosher et al., 1999 Section II for discussion of primary vs. volume
      currents.
  
      Parameters
      ----------
      rr : ndarray, shape (n_dipoles, 3)
          3D dipole source positions in head coordinates
      coils : list of dict
          List of MEG coils where each element contains coil specific information
  
      Returns
      -------
      pc : ndarray, shape (n_sources, n_MEG_sensors)
          Primary current for set of MEG coils due to all sources
      """
      rmags, cosmags, ws, bins = _triage_coils(coils)
      n_coils = bins[-1] + 1
      del coils
      pc = np.empty((len(rr) * 3, n_coils))
      for start, stop in _rr_bounds(rr, chunk=1):
          pp = _bem_inf_fields(rr[start:stop], rmags, cosmags)
          pp *= ws
          pp.shape = (3 * (stop - start), -1)
          pc[3 * start : 3 * stop] = [
              bincount(bins, this_pp, bins[-1] + 1) for this_pp in pp
          ]
      return pc
  
imports: from copy import deepcopy
  import numpy
  from .._fiff.constants import FIFF
  from ..bem import _import_openmeeg, _make_openmeeg_geometry
  from ..fixes import bincount, jit
  from ..parallel import parallel_func
  from ..surface import _jit_cross, _project_onto_surface
  from ..transforms import apply_trans, invert_transform
  from ..utils import _check_option, _pl, fill_doc, logger, verbose, warn
label_desc: Use image node_id 11 for calling a global function with example usage: _do_prim_curr(rr, coils) and returns: pc