{ "cells": [ { "cell_type": "markdown", "id": "1d7df404", "metadata": {}, "source": [ "# Downloadable examples\n", "\n", "This Jupyter Notebook show how to easily retrieve advanced examples online.\n", "\n", "1. Datasets\n", "2. Samples" ] }, { "cell_type": "code", "execution_count": null, "id": "1c0472be", "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\", message=\".*IProgress not found.*\")" ] }, { "cell_type": "markdown", "id": "a0a7c5e5", "metadata": {}, "source": [ "## Section 1: Datasets" ] }, { "cell_type": "markdown", "id": "285f1c33", "metadata": {}, "source": [ "Retrieving advanded datasets examples is as easy as:" ] }, { "cell_type": "code", "execution_count": null, "id": "178d8987", "metadata": {}, "outputs": [], "source": [ "from plaid.examples import AVAILABLE_EXAMPLES\n", "\n", "print(AVAILABLE_EXAMPLES)" ] }, { "cell_type": "code", "execution_count": null, "id": "928400ce", "metadata": {}, "outputs": [], "source": [ "from plaid.examples import datasets\n", "import time\n", "\n", "start = time.perf_counter()\n", "print(datasets.tensile2d)\n", "end = time.perf_counter()\n", "print(f\"First dataset retrieval duration: {end - start:.6f} seconds\")" ] }, { "cell_type": "code", "execution_count": null, "id": "43b8ccd8", "metadata": { "lines_to_next_cell": 2 }, "outputs": [], "source": [ "start = time.perf_counter()\n", "print(datasets.tensile2d)\n", "end = time.perf_counter()\n", "print(f\"Second dataset retrieval duration: {end - start:.6f} seconds\")" ] }, { "cell_type": "markdown", "id": "0d57a8df", "metadata": {}, "source": [ "## Section 2: Samples" ] }, { "cell_type": "code", "execution_count": null, "id": "ea313e86", "metadata": {}, "outputs": [], "source": [ "from plaid.examples import samples\n", "\n", "start = time.perf_counter()\n", "print(samples.vki_ls59)\n", "\n", "end = time.perf_counter()\n", "print(f\"First sample retrieval duration: {end - start:.6f} seconds\")\n", "assert(len(samples.vki_ls59.get_scalar_names())==8)" ] }, { "cell_type": "code", "execution_count": null, "id": "3e43c0a0", "metadata": {}, "outputs": [], "source": [ "from plaid.examples import samples\n", "\n", "start = time.perf_counter()\n", "print(samples.tensile2d)\n", "\n", "end = time.perf_counter()\n", "print(f\"The tensile2d dataset being already loaded: sample retrieval duration: {end - start:.6f} seconds\")\n", "assert(len(samples.tensile2d.get_scalar_names())==10)" ] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent" }, "kernelspec": { "display_name": "plaid-dev", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }