{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide-output" ] }, "outputs": [], "source": [ "!pip install aiohttp matplotlib pandas pyarrow requests \"xarray[io]\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 139 }, "id": "cpiv_WAPGfrY", "outputId": "11e0d328-c765-4382-fbe7-64cc5adba404" }, "outputs": [], "source": [ "import pandas as pd\n", "URL = 'https://mastapp.site'" ] }, { "cell_type": "markdown", "metadata": { "id": "Hu8S8IvjI4sj" }, "source": [ "# Quickstart\n", "This notebook shows some very simple example of getting started." ] }, { "cell_type": "markdown", "metadata": { "id": "l8ci7WglJJPb" }, "source": [ "#### List All Shots" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 721 }, "id": "yNJv-2FfF2zb", "outputId": "2eaafdfa-6e1d-491d-bc62-3c98d42cae77" }, "outputs": [], "source": [ "shots_df = pd.read_parquet(f'{URL}/parquet/level2/shots')\n", "shots_df" ] }, { "cell_type": "markdown", "metadata": { "id": "S4ZTGisaJQUm" }, "source": [ "#### List All Sources" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "eI3YpqABGQ_K", "outputId": "046933be-b3ef-42fb-c8f2-f9c3dab2ce28" }, "outputs": [], "source": [ "sources_df = pd.read_parquet(f\"{URL}/parquet/level2/sources\")\n", "sources_df" ] }, { "cell_type": "markdown", "metadata": { "id": "qW5VOYWyJR5t" }, "source": [ "#### List all signals Given a Shot Number" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 424 }, "id": "oyuHeNgkGOab", "outputId": "06e3ecb7-b177-4817-a265-1b2d81e234e7" }, "outputs": [], "source": [ "signals_df = pd.read_parquet(f\"{URL}/parquet/level2/signals?shot_id=30421\")\n", "signals_df" ] }, { "cell_type": "markdown", "metadata": { "id": "kLR6H5S-JVsD" }, "source": [ "#### Open and plot shot data. \n", "\n", "Here we are visualising some plasma current data." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 447 }, "id": "AXaJ1a9GGbtW", "outputId": "76ac54b6-8210-484a-847b-6b7acea96399" }, "outputs": [], "source": [ "import xarray as xr\n", "import matplotlib.pyplot as plt\n", "\n", "\n", "dataset = xr.open_zarr(\n", " \"https://s3.echo.stfc.ac.uk/mast/level2/shots/30421.zarr\",\n", " group='summary'\n", ")\n", "\n", "dataset['ip'].plot()\n", "plt.show()" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": ".venv", "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.13.3" } }, "nbformat": 4, "nbformat_minor": 0 }