def getB( self, pos ): # Particular Line current B field calculation. Check RCS for getB() interface rotatedPos = rotateToCS(pos, self) return getBField( Bfield_Dipole(self.moment, rotatedPos), # The B field self) # Object Angle/Axis properties
def getB( self, pos ): # Particular Cylinder B field calculation. Check RCS for getB() interface rotatedPos = rotateToCS(pos, self) return getBField( Bfield_Cylinder(self.magnetization, rotatedPos, self.dimension, self.iterDia), # The B field self) # Object Angle/Axis properties
def getB( self, pos ): # Particular Line current B field calculation. Check RCS for getB() interface rotatedPos = rotateToCS(pos, self) return getBField( Bfield_CurrentLine(rotatedPos, self.vertices, self.current), # The B field self)
def getB( self, pos ): # Particular Circular current B field calculation. Check RCS for getB() interface rotatedPos = rotateToCS(pos, self) return getBField( Bfield_CircularCurrentLoop(self.current, self.dimension, rotatedPos), # The B field self)
def test_rotateToCS(): errMsg = "Wrong rotation for Box in CS" mockResults = array([-19., 1.2, 8.]) # Expected result for Input # Input mag = [5, 5, 5] dim = [1, 1, 1] pos = [63, .8, 2] # Run from magpylib import source b = source.magnet.Box(mag, dim, pos) result = rotateToCS([44, 2, 10], b) rounding = 4 for i in range(3): assert round(result[i], rounding) == round(mockResults[i], rounding), errMsg
def getB(self, pos): rotatedPos = rotateToCS(pos, self) return getBField( Bfield_Sphere(self.magnetization, rotatedPos, self.dimension), # The B Field self) # Object Angle/Axis properties