{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example: RingCyclotron" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the RingCyclotron.stat file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from opal import load_dataset\n", "\n", "ds = load_dataset('./RingCyclotron/', fname='RingCyclotron.stat')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print ( ds )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Set the plotting style" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from opal.visualization.styles import load_style\n", "\n", "load_style('jupyter')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_profile1D('time', 'rms_x', xsci=True)\n", " \n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_profile1D('time', 'Bx_ref', xsci=True)\n", " \n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the RingCyclotron.h5 file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = load_dataset('./RingCyclotron/', fname='RingCyclotron.h5')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_phase_space('x', 'y', xsci=True, ysci=True)\n", "\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_phase_space('x', 'y', xsci=True, ysci=True)\n", " \n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_density('x', 'y', xsci=True, ysci=True, bins=(100, 100))\n", " \n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some statistics on data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "try:\n", " print ( \"Central moment: \" + str(ds.moment('x', k=1)) )\n", " \n", " print ( \"Arithmetic mean: \" + str(ds.mean('x')) )\n", " \n", " print ( \"Skewness: \" + str(ds.skew('x')) )\n", " \n", " print ( \"Kurtosis: \" + str(ds.kurtosis('x')) )\n", " \n", "except Exception as e:\n", " print ( e )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the RingCyclotron.mem file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = load_dataset('./RingCyclotron/', fname='RingCyclotron.mem')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_total_memory()\n", " \n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_memory_summary()\n", " \n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the RingCyclotron.lbal file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = load_dataset('./RingCyclotron/', fname='RingCyclotron.lbal')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_lbal_summary()\n", "\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_lbal_histogram()\n", "\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load the RingCyclotron-trackOrbit file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = load_dataset('./RingCyclotron/', fname='RingCyclotron-trackOrbit.dat')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_orbits()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load timing.dat file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ds = load_dataset('./RingCyclotron/', fname ='timing.dat')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Do some plotting ..." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "plt = ds.plot_pie_chart(prop='cpu max', first=7)\n", "\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt = ds.plot_time_summary(prop='cpu', grid=True)\n", "\n", "plt.show()" ] } ], "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.5.2" } }, "nbformat": 4, "nbformat_minor": 2 }