#NEWLINE# def _do_self_dots( intrad , volume , coils , r0 , ch_type , lut , n_fact , n_jobs ) : #NEWLINE# #INDENT# "Perform the lead field dot product integrations.\n\n    Parameters\n    ----------\n    intrad : float\n        The integration radius. It is used to calculate beta as:\n        beta = (intrad * intrad) / (r1 * r2).\n    volume : bool\n        If True, perform volume integral.\n    coils : list of dict\n        The coils.\n    r0 : array, shape (3 x 1)\n        The origin of the sphere.\n    ch_type : str\n        The channel type. It can be 'meg' or 'eeg'.\n    lut : callable\n        Look-up table for evaluating Legendre polynomials.\n    n_fact : array\n        Coefficients in the integration sum.\n    n_jobs : int\n        Number of jobs to run in parallel.\n\n    Returns\n    -------\n    products : array, shape (n_coils, n_coils)\n        The integration products.\n    " #NEWLINE# if ( ch_type == 'eeg' ) : #NEWLINE# #INDENT# intrad *= 0.7 #NEWLINE# #UNINDENT# rmags = [ ( coil [ 'rmag' ] - r [ np . newaxis , : ] ) for coil in coils ] #NEWLINE# rlens = [ np . sqrt ( np . sum ( ( r * r ) , axis = 1 ) ) for r in rmags ] #NEWLINE# rmags = [ ( r / rl [ : , np . newaxis ] ) for ( r , rl ) in zip ( rmags , rlens ) ] #NEWLINE# cosmags = [ coil [ 'cosmag' ] for coil in coils ] #NEWLINE# ws = [ coil [ 'w' ] for coil in coils ] #NEWLINE# ( parallel , p_fun , _ ) = parallel_func ( _do_self_dots_subset , n_jobs ) #NEWLINE# prods = parallel ( ( p_fun ( intrad , rmags , rlens , cosmags , ws , volume , lut , n_fact , ch_type , idx ) for idx in np . array_split ( np . arange ( len ( rmags ) ) , n_jobs ) ) ) #NEWLINE# products = np . sum ( prods , axis = 0 ) #NEWLINE# return products