#NEWLINE# def _fit_dipoles( fun , min_dist_to_inner_skull , data , times , guess_rrs , guess_data , fwd_data , whitener , proj_op , ori , n_jobs ) : #NEWLINE# #INDENT# 'Fit a single dipole to the given whitened, projected data' #NEWLINE# from scipy.optimize import fmin_cobyla #NEWLINE# ( parallel , p_fun , _ ) = parallel_func ( fun , n_jobs ) #NEWLINE# res = parallel ( ( p_fun ( min_dist_to_inner_skull , B , t , guess_rrs , guess_data , fwd_data , whitener , proj_op , fmin_cobyla , fun ) for ( B , t ) in zip ( data . T , times ) ) ) #NEWLINE# pos = np . array ( [ r [ 0 ] for r in res ] ) #NEWLINE# amp = np . array ( [ r [ 1 ] for r in res ] ) #NEWLINE# ori = np . array ( [ r [ 2 ] for r in res ] ) #NEWLINE# gof = ( np . array ( [ r [ 3 ] for r in res ] ) * 100 ) #NEWLINE# residual = np . array ( [ r [ 4 ] for r in res ] ) . T #NEWLINE# return ( pos , amp , ori , gof , residual )