{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Probe files" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from opal import load_dataset\n", "\n", "ds = load_dataset('./RingCyclotron/', fname='RRI2.h5')\n", "\n", "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": {}, "outputs": [], "source": [ "plt = ds.plot_probe_histogram(bins=300)\n", "plt.show()\n", "plt.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from opal.analysis.cyclotron import eval_radius\n", "import matplotlib.pyplot as plt\n", "\n", "t = ds.getData('turn')\n", "\n", "x = ds.getData('x')\n", "y = ds.getData('y')\n", "\n", "# second peak of above figure\n", "x = x[t == 1]\n", "y = y[t == 1]\n", "\n", "r = eval_radius(x, y)\n", "\n", "plt.hist(r, bins=400)\n", "plt.show()\n", "plt.close()" ] } ], "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 }