{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Field quality plots\n\nUse the output of a harmonic coil and show the Field quality\n\nDownload Input files\n\n* :download:`dipole_2d.data <../../../../../examples/input_files/dipole_2d.data>`\n* :download:`dipole_2d.post.xml <../../../../../examples/input_files/dipole_2d.post.xml>`\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting up\nStandard Loading of input, Parsing and Initializing RoxiePlotOutputs object\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from roxieapi.output.plots import RoxiePlotOutputs\n\nplots = RoxiePlotOutputs(\n \"../input_files/dipole_2d.post.xml\", \"../input_files/dipole_2d.data\"\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Field quality tables\nField quality tables are parsed and accessible in the parser.\nTo load, we select the Harmonic coil id and get it from the parser.\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "harmonic_coil = plots.output.get_harmonic_coil(1)\nassert (\n harmonic_coil is not None\n) # We assume the input file is correct and harmonic coils are defined\ndfs = plots.tables.print_harmonic_coil(harmonic_coil)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The output returns 3 Tables:\n- Coil definites\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dfs[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Field information\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dfs[1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Harmonics table\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dfs[2]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plotting as bar graph\nAlternatively, the Harmonics can be plotted as bar graph:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "figure = plots.graphs.plot_harmonics(harmonic_coil)\nfigure" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.19" } }, "nbformat": 4, "nbformat_minor": 0 }