.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gen/examples/output_parsing/plot_field_quality.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gen_examples_output_parsing_plot_field_quality.py: Field quality plots =================== Use the output of a harmonic coil and show the Field quality Download Input files * :download:`dipole_2d.data <../../../../../examples/input_files/dipole_2d.data>` * :download:`dipole_2d.post.xml <../../../../../examples/input_files/dipole_2d.post.xml>` .. GENERATED FROM PYTHON SOURCE LINES 14-18 Setting up ---------- Standard Loading of input, Parsing and Initializing RoxiePlotOutputs object .. GENERATED FROM PYTHON SOURCE LINES 18-24 .. code-block:: Python from roxieapi.output.plots import RoxiePlotOutputs plots = RoxiePlotOutputs( "../input_files/dipole_2d.post.xml", "../input_files/dipole_2d.data" ) .. GENERATED FROM PYTHON SOURCE LINES 25-30 Field quality tables -------------------- Field quality tables are parsed and accessible in the parser. To load, we select the Harmonic coil id and get it from the parser. .. GENERATED FROM PYTHON SOURCE LINES 30-36 .. code-block:: Python harmonic_coil = plots.output.get_harmonic_coil(1) assert ( harmonic_coil is not None ) # We assume the input file is correct and harmonic coils are defined dfs = plots.tables.print_harmonic_coil(harmonic_coil) .. GENERATED FROM PYTHON SOURCE LINES 37-39 The output returns 3 Tables: - Coil definites .. GENERATED FROM PYTHON SOURCE LINES 39-41 .. code-block:: Python dfs[0] .. raw:: html
type reference radius (mm) x position (mm) y position (mm)
0 Cylindrical 17.0 0.0 0.0


.. GENERATED FROM PYTHON SOURCE LINES 42-43 - Field information .. GENERATED FROM PYTHON SOURCE LINES 43-45 .. code-block:: Python dfs[1] .. raw:: html
main field (T) reference magnet strength (T) error of harmonic analysis of br
0 -7.169634072777 -7.169634072777 0.0003159894656828


.. GENERATED FROM PYTHON SOURCE LINES 46-47 - Harmonics table .. GENERATED FROM PYTHON SOURCE LINES 47-49 .. code-block:: Python dfs[2] .. raw:: html
Order bn an
0 1 1.000000e+04 1.986444e-12
1 2 7.947441e-13 7.458240e-13
2 3 2.456824e+00 -1.330748e-13
3 4 1.161683e-12 -2.706258e-12
4 5 -4.926023e+00 -2.231423e-12
5 6 -1.054013e-12 1.504351e-12
6 7 1.787194e+00 2.314897e-12
7 8 5.846220e-13 -7.246530e-13
8 9 1.380537e-01 -1.520078e-12
9 10 8.335324e-13 1.977976e-12
10 11 6.914776e-01 8.256689e-13
11 12 7.313067e-13 3.205894e-13
12 13 5.154286e-02 -1.034959e-12
13 14 3.502288e-13 -8.002637e-13
14 15 4.286381e-02 -1.639240e-12
15 16 3.381311e-13 -1.618674e-12
16 17 -5.466254e-02 1.075487e-12
17 18 -2.703234e-12 8.475658e-12
18 19 -1.079437e-03 1.327724e-12
19 20 6.151687e-13 -1.265663e-11


.. GENERATED FROM PYTHON SOURCE LINES 50-53 Plotting as bar graph --------------------- Alternatively, the Harmonics can be plotted as bar graph: .. GENERATED FROM PYTHON SOURCE LINES 53-55 .. code-block:: Python figure = plots.graphs.plot_harmonics(harmonic_coil) figure .. raw:: html


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.106 seconds) .. _sphx_glr_download_gen_examples_output_parsing_plot_field_quality.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_field_quality.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_field_quality.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_field_quality.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_