def _bem_pot_or_field(rr, mri_rr, mri_Q, coils, solution, bem_rr, n_jobs, coil_type):
 (parallel, p_fun, _) = parallel_func(_do_inf_pots, n_jobs)
 nas = np.array_split
 B = np.sum(parallel((p_fun(mri_rr, sr.copy(), mri_Q, sol.copy()) for (sr, sol) in zip(nas(bem_rr, n_jobs), nas(solution.T, n_jobs)))), axis=0)
 if (coil_type == 'meg'):
  (parallel, p_fun, _) = parallel_func(_do_prim_curr, n_jobs)
  pcc = np.concatenate(parallel((p_fun(rr, c) for c in nas(coils, n_jobs))), axis=1)
  B += pcc
  B *= _MAG_FACTOR
 return B

def _bem_pot_or_field ( rr , mri_rr , mri_Q , coils , solution , bem_rr , n_jobs , coil_type ) : ( parallel , p_fun , _ ) = parallel_func ( _do_inf_pots , n_jobs ) nas = np . array_split B = np . sum ( parallel ( ( p_fun ( mri_rr , sr . copy ( ) , mri_Q , sol . copy ( ) ) for ( sr , sol ) in zip ( nas ( bem_rr , n_jobs ) , nas ( solution . T , n_jobs ) ) ) ) , axis = 0 ) if ( coil_type == 'meg' ) : ( parallel , p_fun , _ ) = parallel_func ( _do_prim_curr , n_jobs ) pcc = np . concatenate ( parallel ( ( p_fun ( rr , c ) for c in nas ( coils , n_jobs ) ) ) , axis = 1 ) B += pcc B *= _MAG_FACTOR return B
calculate the magnetic field or electric potential forward solution .