You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_pages/0_documentation.rst
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -416,6 +416,7 @@ Then top level function ``displaySystem(c)`` can be used to quickly check the ge
416
416
* ``suppress=True`` for suppressing the immediate figure output when the function is called. To do so it is necessary to deactivate the interactive mode by calling ``pyplot.ioff()``. With `Spyder's <https://www.spyder-ide.org/>`_ IPython *Inline* plotting, graphs made with :meth:`~magpylib.displaySystem()` can be blank if the ``suppress=True`` option is not used. Set IPython Graphics backend to *Automatic* or *Qt5* instead of *Inline* in settings/IPython console/Graphics method to address this.
417
417
* ``direc=True`` for displaying current and magnetization directions in the figure.
418
418
* ``subplotAx=None`` for displaying the plot on a designated figure subplot instance.
419
+
* ``figsize=(8,8)`` for setting the size of the output graphic.
419
420
420
421
The following example code shows how to use ``displaySystem()``:
Copy file name to clipboardExpand all lines: docs/_pages/2_guideExamples.rst
+26-10Lines changed: 26 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,19 @@
4
4
Example Codes
5
5
*******************************
6
6
7
-
This section includes a few code examples that show how the library can be used. Detailed information about the library structure can be found in the :ref:`docu`.
7
+
This section includes a few code examples that show how the library can be used and what i can be used for. A detailed technical library documentation can be found in the :ref:`docu`.
8
+
9
+
10
+
Contents
11
+
########
12
+
13
+
* :ref:`examples-simplest`
14
+
* :ref:`examples-basic`
15
+
* :ref:`examples-sourceObjects`
16
+
* :ref:`examples-motionBasics`
17
+
* :ref:`examples-joystick`
18
+
* :ref:`examples-complexShapes`
19
+
* :ref:`examples-vector`
8
20
9
21
10
22
@@ -30,7 +42,7 @@ The simplest possible example - calculate the B-field of a cylinder with 3 lines
30
42
Basic Functionality: The Field of a Collection
31
43
###############################################
32
44
33
-
In this example the basic functionality is outlined by calculating the field of two magnets. The magnets are geometrically manipulated and the system geometry is displayed using the `displaySystem` method. The field is then calculated on a grid and displayed in the xz-plane.
45
+
In this example the basic functionality is outlined. Two magnet objects are created and geometrically manipulated. The system geometry is then displayed using the ``displaySystem`` function. Finally, the field is calculated on a grid and displayed in the xz-plane.
34
46
35
47
.. plot:: pyplots/examples/01_SimpleCollection.py
36
48
:include-source:
@@ -44,7 +56,7 @@ In this example the basic functionality is outlined by calculating the field of
44
56
The Source Objects and their Fields
45
57
###################################
46
58
47
-
In this example we define all existing source objects and display their fields. Notice that the respective magnetization vectors are chosen arbitrarily.
59
+
In this example we define all currently implemented source objects and display their fields. Notice that the respective magnetization vectors are chosen arbitrarily.
48
60
49
61
.. plot:: pyplots/examples/01b_AllSources.py
50
62
:include-source:
@@ -58,34 +70,38 @@ In this example we define all existing source objects and display their fields.
58
70
Translation, Orientation and Rotation Basics
59
71
#############################################
60
72
61
-
Translation of magnets can be realized in three ways, using the methods `move` and `setPosition`, or by directly setting the object `position` attribute.
73
+
Translation of magnets can be realized in three ways, using the methods ``move`` and ``setPosition``, or by directly setting the object ``position`` attribute.
The next example shows a cubical magnet initialized with four different orientations defined by the classical Euler angle rotations about the three Cartesian axes. Notice that the magnetization direction is defined in the INIT ORIENTATION so that different orientations results in a rotation of the magnetization vector.
80
+
81
+
Initialize magnets with different orientations defined by classical Euler angle rotations about the three Cartesian axes. Notice that the magnetization direction is fixed with respect to the **init orientation** of the magnet and will rotate together with the magnet.
The following example shows a general form of orientation for different angles about an axis (1,-1,1). The upper three boxes are initialized with different orientations. The lower three boxes are all initialized with INIT ORIENTATION and are then rotated (about themselves) to achieve the same result as above.
88
+
89
+
The following example shows functionality beyond Euler angle rotation. This means rotation about an arbitrary axis of choice, here ``(1,-1,1)``. The upper three boxes are initialized with different orientations. The lower three boxes are all initialized with **init orientation** and are then rotated (about themselves) to achieve the same result as above.
The following example shows rotations with designated anchor-axis combinations. Here we distinguish between pivot points (the closest point on the rotation axis to the magnet) and anchor points which are simply required to define an axis in 3D space (together with the direction).
96
+
97
+
The following example shows rotations with designated anchor-axis combinations. Here we distinguish between pivot points (the closest point on the rotation axis to the magnet) and anchor points which are simply required to define an axis in 3D space (together with a direction).
Collections can be manipulated using the previous logic as well. Notice how objects can be grouped into collections and sub-collections for common manipulation. For rotations keep in mind that if an anchor is not provided, all objects will rotate relative to their own center.
90
106
91
107
.. plot:: pyplots/examples/00e_ColTransRot.py
@@ -100,9 +116,9 @@ Collections can be manipulated using the previous logic as well. Notice how obje
100
116
Magnet Motion: Simulating a Magnetic Joystick
101
117
##############################################
102
118
103
-
In this example a joystick is simulated. A magnetic joystick is realized by a rod that can tilt freely (two degrees of freedom) about a center of tilt. The upper part of the rod is the joystick handle. At the bottom of the rod a cylindrical magnet (dimension *D/H*) with axial magnetization (amplitude *M0*) is fixed. The magnet lies at a distance *d* below the center of tilt. The system is constructed such that, when the joystick is in the center position a sensor lies at distance *gap* below the magnet and in the origin of a Cartesian coordinate system. The magnet thus moves with the joystick above the fixed sensor.
119
+
In this example a joystick is simulated. A magnetic joystick is realized by a rod that can tilt freely (two degrees of freedom) about a center of tilt. The upper part of the rod is the joystick handle. At the bottom of the rod a cylindrical magnet (``dim=(D,H)``) with axial magnetization ```mag=[0,0,M0]`` is fixed. The magnet lies at a distance ``d`` below the center of tilt. The system is constructed such that, when the joystick is in the center position a sensor lies at distance ``gap`` below the magnet and in the origin of a Cartesian coordinate system. The magnet thus moves with the joystick above the fixed sensor.
104
120
105
-
In the following program the magnetic field is calculated for all degrees of freedom. Different tilt angles are set by rotation about the center of tilt by the angle *th* (different colors). Then the tilt direction is varied from 0 to 360 degrees by simulating the magnet 'motion' as rotation about the z-axis, see also the following sketch.
121
+
In the following program the magnetic field is calculated for all degrees of freedom. Different tilt angles are set by rotation about the center of tilt by the angle ``th`` (different colors). Then the tilt direction is varied from 0 to 360 degrees by simulating the magnet motion as rotation about the z-axis, see also the following sketch.
@@ -120,7 +136,7 @@ In the following program the magnetic field is calculated for all degrees of fre
120
136
Complex Magnet Shapes: Hollow Cylinder
121
137
###########################################
122
138
123
-
The superposition principle allows us to calculate complex magnet shapes by 'addition' and 'subtraction' operations. A common application for this is the field of an axially magnetized hollow cylinder. The hollow part is cut out of the first cylinder by placing a second, smaller cylinder inside with opposite magnetization. Unfortunately the `displaySystem` method cannot properly display such objects intersecting with each other.
139
+
The superposition principle allows us to calculate complex magnet shapes by *addition* and *subtraction* operations. An example application for this is the field of an axially magnetized hollow cylinder. The hollow part is cut out from the outer cylinder by placing a second, smaller cylinder inside with opposite magnetization. Unfortunately the ``displaySystem`` method cannot properly display such objects intersecting with each other.
0 commit comments