Compute the map construction products. Parameters ---------- intrad : float The integration radius. It is used to calculate beta as: beta = (intrad * intrad) / (r1 * r2) volume : bool If True, compute a volume integral. coils : list of dict The co
(
intrad, volume, coils, surf, sel, r0, ch_type, lut, n_fact, n_jobs
)
| 456 | |
| 457 | @fill_doc |
| 458 | def _do_surface_dots( |
| 459 | intrad, volume, coils, surf, sel, r0, ch_type, lut, n_fact, n_jobs |
| 460 | ): |
| 461 | """Compute the map construction products. |
| 462 | |
| 463 | Parameters |
| 464 | ---------- |
| 465 | intrad : float |
| 466 | The integration radius. It is used to calculate beta as: |
| 467 | beta = (intrad * intrad) / (r1 * r2) |
| 468 | volume : bool |
| 469 | If True, compute a volume integral. |
| 470 | coils : list of dict |
| 471 | The coils. |
| 472 | surf : dict |
| 473 | The surface on which the field is interpolated. |
| 474 | sel : array |
| 475 | Indices of the surface vertices to select. |
| 476 | r0 : array, shape (3 x 1) |
| 477 | The origin of the sphere. |
| 478 | ch_type : str |
| 479 | The channel type. It can be 'meg' or 'eeg'. |
| 480 | lut : callable |
| 481 | Look-up table for Legendre polynomials. |
| 482 | n_fact : array |
| 483 | Coefficients in the integration sum. |
| 484 | %(n_jobs)s |
| 485 | |
| 486 | Returns |
| 487 | ------- |
| 488 | products : array, shape (n_coils, n_coils) |
| 489 | The integration products. |
| 490 | """ |
| 491 | # convert to normalized distances from expansion center |
| 492 | rmags = [coil["rmag"] - r0[np.newaxis, :] for coil in coils] |
| 493 | rlens = [np.sqrt(np.sum(r * r, axis=1)) for r in rmags] |
| 494 | rmags = [r / rl[:, np.newaxis] for r, rl in zip(rmags, rlens)] |
| 495 | cosmags = [coil["cosmag"] for coil in coils] |
| 496 | ws = [coil["w"] for coil in coils] |
| 497 | rref = None |
| 498 | refl = None |
| 499 | # virt_ref = False |
| 500 | if ch_type == "eeg": |
| 501 | intrad = intrad * 0.7 |
| 502 | # The virtual ref code is untested and unused, so it is |
| 503 | # commented out for now |
| 504 | # if virt_ref: |
| 505 | # rref = virt_ref[np.newaxis, :] - r0[np.newaxis, :] |
| 506 | # refl = np.sqrt(np.sum(rref * rref, axis=1)) |
| 507 | # rref /= refl[:, np.newaxis] |
| 508 | |
| 509 | rsurf = surf["rr"][sel] - r0[np.newaxis, :] |
| 510 | lsurf = np.sqrt(np.sum(rsurf * rsurf, axis=1)) |
| 511 | rsurf /= lsurf[:, np.newaxis] |
| 512 | this_nn = surf["nn"][sel] |
| 513 | |
| 514 | # loop over the coils |
| 515 | parallel, p_fun, n_jobs = parallel_func(_do_surface_dots_subset, n_jobs) |
no test coverage detected