def cartesianSolenoidModel(self, position): """ Compute field values of ideal solenoid given Cartesian co-ordinates. @param position: 3xN L{np.ndarray} of position co-ordinates. """ x, y, z = position r,phi = cartesianToPolar(x,y) Br,Bz = self.cylindricalSolenoidModel(r,phi,z) Bx,By = polarToCartesian(Br,phi) return np.vstack((Bx,By,Bz))
def checkCartesianToPolar(cartesian, polar): assert_almost_equal(transforms.cartesianToPolar(*cartesian), polar)