def _do_inf_pots(mri_rr, bem_rr, mri_Q, sol):
 bounds = np.concatenate([np.arange(0, len(mri_rr), 200), [len(mri_rr)]])
 B = np.empty(((len(mri_rr) * 3), sol.shape[1]))
 for bi in range((len(bounds) - 1)):
  v0s = _bem_inf_pots(mri_rr[bounds[bi]:bounds[(bi + 1)]], bem_rr, mri_Q)
  v0s.shape = ((v0s.shape[0] * 3), v0s.shape[2])
  B[(3 * bounds[bi]):(3 * bounds[(bi + 1)])] = np.dot(v0s, sol)
 return B

def _do_inf_pots ( mri_rr , bem_rr , mri_Q , sol ) : bounds = np . concatenate ( [ np . arange ( 0 , len ( mri_rr ) , 200 ) , [ len ( mri_rr ) ] ] ) B = np . empty ( ( ( len ( mri_rr ) * 3 ) , sol . shape [ 1 ] ) ) for bi in range ( ( len ( bounds ) - 1 ) ) : v0s = _bem_inf_pots ( mri_rr [ bounds [ bi ] : bounds [ ( bi + 1 ) ] ] , bem_rr , mri_Q ) v0s . shape = ( ( v0s . shape [ 0 ] * 3 ) , v0s . shape [ 2 ] ) B [ ( 3 * bounds [ bi ] ) : ( 3 * bounds [ ( bi + 1 ) ] ) ] = np . dot ( v0s , sol ) return B
calculate infinite potentials for meg or eeg sensors using chunks .