{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example: StatWrapper" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from opal.datasets.StatDataset import *\n", "\n", "class StatWrapper:\n", " \n", " def __init__(self, directory, fname):\n", " self._stat = StatDataset(directory, fname)\n", " \n", " def __getitem__(self, variable):\n", " return self._stat.getData(variable)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "stat = StatWrapper('RingCyclotron/', 'RingCyclotron.stat')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "stat['rms_x']" ] } ], "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 }