def __init__(self, magnitude=STANDARD_GRAVITY): """ Construct field model. @param magnitude: Magnitude of field in m/s^2. Default is standard Earth gravity. """ ConstantVectorField.__init__(self, vector(0, 0, magnitude))
def __init__(self, magnitude=50e-6, inclination=70, declination=0): """ Construct field model. Default parameters result in a field with a magnitude of 50 microTesla, a 70 degree downwards inclination and 0 degrees declination. These defaults are based on the nominal values for Edinburgh, UK, with declination set to 0 degrees so that magnetic and true North are equivalent. @param magnitude: Magnitude of the field, in Teslas. @param inclination: Inclination of the field to the horizontal, in degrees. @param declination: Delcination of the field from true North, in degrees. """ theta = math.radians(declination) ctheta = math.cos(theta) stheta = math.sin(theta) phi = math.radians(inclination) cphi = math.cos(phi) sphi = math.sin(phi) value = magnitude * vectors.vector(cphi*ctheta, cphi*stheta, sphi) ConstantVectorField.__init__(self, value)