def _dipole_gof(uu, sing, vv, B, B2):
 ncomp = (3 if ((sing[2] / sing[0]) > 0.2) else 2)
 one = np.dot(vv[:ncomp], B)
 Bm2 = np.sum((one * one))
 gof = (Bm2 / B2)
 return (gof, one)

def _dipole_gof ( uu , sing , vv , B , B2 ) : ncomp = ( 3 if ( ( sing [ 2 ] / sing [ 0 ] ) > 0.2 ) else 2 ) one = np . dot ( vv [ : ncomp ] , B ) Bm2 = np . sum ( ( one * one ) ) gof = ( Bm2 / B2 ) return ( gof , one )
calculate the goodness of fit from the forward svd .