def _fit_dipole_fixed(min_dist_to_inner_skull, B_orig, t, guess_rrs, guess_data, fwd_data, whitener, proj_op, fmin_cobyla, ori):
 B = np.dot(whitener, B_orig)
 B2 = np.dot(B, B)
 if (B2 == 0):
  warn(('Zero field found for time %s' % t))
  return (np.zeros(3), 0, np.zeros(3), 0)
 (Q, gof, residual) = _fit_Q(guess_data, whitener, proj_op, B, B2, B_orig, rd=None, ori=ori)
 if (ori is None):
  amp = np.sqrt(np.dot(Q, Q))
  norm = (1.0 if (amp == 0.0) else amp)
  ori = (Q / norm)
 else:
  amp = np.dot(Q, ori)
 return (guess_rrs[0], amp, ori, gof, residual)

def _fit_dipole_fixed ( min_dist_to_inner_skull , B_orig , t , guess_rrs , guess_data , fwd_data , whitener , proj_op , fmin_cobyla , ori ) : B = np . dot ( whitener , B_orig ) B2 = np . dot ( B , B ) if ( B2 == 0 ) : warn ( ( 'Zero field found for time %s' % t ) ) return ( np . zeros ( 3 ) , 0 , np . zeros ( 3 ) , 0 ) ( Q , gof , residual ) = _fit_Q ( guess_data , whitener , proj_op , B , B2 , B_orig , rd = None , ori = ori ) if ( ori is None ) : amp = np . sqrt ( np . dot ( Q , Q ) ) norm = ( 1.0 if ( amp == 0.0 ) else amp ) ori = ( Q / norm ) else : amp = np . dot ( Q , ori ) return ( guess_rrs [ 0 ] , amp , ori , gof , residual )
fit a data using a fixed position .