Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
def test_getBField():
    errMsg = "Wrong field for Box in CS"
    mockResults = array([-4.72365793e-05, 1.35515955e-05, -7.13360174e-05])

    # Input
    mockField = array([1.40028858e-05, -4.89208175e-05, -7.01030695e-05])
    axis = [1, 1, 1]
    angle = 90

    class MockSource:  ## Mock a Source object with two attributes.
        def __init__(self, axis, angle):
            self.axis = axis
            self.angle = angle

    mockSource = MockSource(axis, angle)

    # Run
    result = getBField(mockField, mockSource)

    rounding = 4
    for i in range(3):
        assert round(result[i], rounding) == round(mockResults[i],
                                                   rounding), errMsg
Exemplo n.º 6
0
 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