def MagneticDipoleFields(srcLoc, obsLoc, component, moment=1., mu = mu_0):
    """
        Calculate the vector potential of a set of magnetic dipoles
        at given locations 'ref. <http://en.wikipedia.org/wiki/Dipole#Magnetic_vector_potential>'

        :param numpy.ndarray srcLoc: Location of the source(s) (x, y, z)
        :param numpy.ndarray obsLoc: Where the potentials will be calculated (x, y, z)
        :param str component: The component to calculate - 'x', 'y', or 'z'
        :param numpy.ndarray moment: The vector dipole moment (vertical)
        :rtype: numpy.ndarray
        :return: The vector potential each dipole at each observation location
    """

    if component=='x':
        dimInd = 0
    elif component=='y':
        dimInd = 1
    elif component=='z':
        dimInd = 2
    else:
        raise ValueError('Invalid component')

    srcLoc = np.atleast_2d(srcLoc)
    obsLoc = np.atleast_2d(obsLoc)
    moment = np.atleast_2d(moment)

    nFaces = obsLoc.shape[0]
    nSrc = srcLoc.shape[0]

    m = np.array(moment).repeat(nFaces, axis=0)
    B = np.empty((nFaces, nSrc))
    for i in range(nSrc):
        dR = obsLoc - srcLoc[i, np.newaxis].repeat(nFaces, axis=0)
        r = np.sqrt((dR**2).sum(axis=1))
        if dimInd == 0:
            B[:, i] = +(mu/(4*pi)) /(r**3) * (3*dR[:,2]*r**2/dR[:,0])
        elif dimInd == 1:
            B[:, i] = +(mu/(4*pi)) /(r**3) * (3*dR[:,2]*dR[:,1]/r**2)
        elif dimInd == 2:
            B[:, i] = +(mu/(4*pi)) /(r**3) * (3*dR[:,2]**2/r**2-1)
        else:
            raise Exception("Not Implemented")
    if nSrc == 1:
        return B.flatten()
    return B
dataset/ETHPy150Open simpeg/simpeg/SimPEG/EM/Utils/AnalyticUtils.py/MagneticDipoleFields/swapped operands of `/`