{ "cells": [ { "cell_type": "markdown", "id": "54b08ca7", "metadata": {}, "source": [ "# Sample Examples\n", "\n", "This Jupyter Notebook demonstrates various operations and methods involving a sample data structure using the PLAID library. It includes examples of:\n", "\n", "1. Initializing an Empty Sample and Adding Data\n", "2. Accessing and Modifying Sample Data\n", "3. Set and Get default values\n", "4. Saving and Loading Samples\n", "\n", "This notebook provides detailed examples of using the Sample class to manage and manipulate sample data structures.\n", "\n", "**Each section is documented and explained.**" ] }, { "cell_type": "code", "execution_count": null, "id": "0e20413c", "metadata": {}, "outputs": [], "source": [ "# Import required libraries\n", "from pathlib import Path\n", "\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": null, "id": "74c866b7", "metadata": {}, "outputs": [], "source": [ "# Import necessary libraries and functions\n", "import CGNS.PAT.cgnskeywords as CGK\n", "\n", "from Muscat.Bridges.CGNSBridge import MeshToCGNS\n", "from Muscat.MeshTools import MeshCreationTools as MCT\n", "\n", "from plaid import Sample\n", "from plaid.utils import cgns_helper as CGH" ] }, { "cell_type": "code", "execution_count": null, "id": "d0e30097", "metadata": {}, "outputs": [], "source": [ "# Print Sample util\n", "def show_sample(sample: Sample):\n", " print(f\"sample = {sample}\")\n", " sample.show_tree()\n", " print(f\"{sample.get_scalar_names() = }\")\n", " print(f\"{sample.get_field_names() = }\")" ] }, { "cell_type": "markdown", "id": "ca56a643", "metadata": {}, "source": [ "## Section 1: Initializing an Empty Sample and Adding Data\n", "\n", "This section demonstrates how to initialize an empty Sample and add scalars, and meshes / CGNS trees." ] }, { "cell_type": "markdown", "id": "83a5aa70", "metadata": {}, "source": [ "### Create and display CGNS tree from an unstructured mesh" ] }, { "cell_type": "code", "execution_count": null, "id": "917d799c", "metadata": {}, "outputs": [], "source": [ "# Input data\n", "points = np.array(\n", " [\n", " [0.0, 0.0],\n", " [1.0, 0.0],\n", " [1.0, 1.0],\n", " [0.0, 1.0],\n", " [0.5, 1.5],\n", " ]\n", ")\n", "\n", "triangles = np.array(\n", " [\n", " [0, 1, 2],\n", " [0, 2, 3],\n", " [2, 4, 3],\n", " ]\n", ")\n", "\n", "Mesh = MCT.CreateMeshOfTriangles(points, triangles)\n", "Mesh.nodeFields[\"test_node_field_1\"] = np.random.randn(5)\n", "Mesh.elemFields[\"test_elem_field_1\"] = np.random.randn(3)\n", "tree = MeshToCGNS(Mesh)" ] }, { "cell_type": "code", "execution_count": null, "id": "28426c79", "metadata": {}, "outputs": [], "source": [ "print(\"#---# Show CGNS Tree\")\n", "CGH.show_cgns_tree(tree)\n", "\n", "print(\"\\n#---# Summarize CGNS Tree\")\n", "CGH.summarize_cgns_tree(tree)\n", "\n", "print(\"\\n#---# Summarize CGNS Tree without additional Field Information\")\n", "CGH.summarize_cgns_tree(tree, verbose=False)" ] }, { "cell_type": "markdown", "id": "062b3183", "metadata": {}, "source": [ "### Initialize a new empty Sample and print it" ] }, { "cell_type": "code", "execution_count": null, "id": "6ac4ec99", "metadata": {}, "outputs": [], "source": [ "# Initialize an empty Sample\n", "print(\"#---# Empty Sample\")\n", "sample = Sample()\n", "\n", "print(sample, end=\"\\n\\n\")\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "ac0e7e2e", "metadata": {}, "source": [ "### Add a scalars to a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "3381a1e1", "metadata": {}, "outputs": [], "source": [ "# Add a rotation scalar to this Sample\n", "sample.add_scalar(\"rotation\", np.random.randn())\n", "\n", "show_sample(sample)" ] }, { "cell_type": "code", "execution_count": null, "id": "1fffdb30", "metadata": {}, "outputs": [], "source": [ "# Add a more scalars to this Sample\n", "sample.add_scalar(\"speed\", np.random.randn())\n", "sample.add_scalar(\"other\", np.random.randn())\n", "\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "67ffb113", "metadata": {}, "source": [ "### Add a CGNS Tree to a Sample and display it" ] }, { "cell_type": "code", "execution_count": null, "id": "b08ea584", "metadata": {}, "outputs": [], "source": [ "# Add the previously created CGNS tree to the sample\n", "sample.features.add_tree(tree)\n", "\n", "# Display the Sample CGNS tree\n", "sample.show_tree()" ] }, { "cell_type": "markdown", "id": "37983df1", "metadata": {}, "source": [ "### Set all meshes with their corresponding time step" ] }, { "cell_type": "code", "execution_count": null, "id": "622d2d70", "metadata": {}, "outputs": [], "source": [ "# Init an empty Sample\n", "new_sample_mult_mesh = Sample()\n", "\n", "# All meshes with their corresponding time step\n", "meshes_dict = {0.0: tree, 0.5: tree, 1.0: tree}\n", "\n", "# Set meshes in the Sample\n", "new_sample_mult_mesh.features.set_meshes(meshes_dict)\n", "\n", "print(f\"{new_sample_mult_mesh.get_all_time_values() = }\")" ] }, { "cell_type": "markdown", "id": "acb81076", "metadata": {}, "source": [ "## Section 2: Accessing and Modifying Sample Data\n", "\n", "This section demonstrates how to access and modify base, zone, node, scalar and field data within the Sample." ] }, { "cell_type": "markdown", "id": "fffb7595", "metadata": {}, "source": [ "### Initialize CGNS tree base" ] }, { "cell_type": "code", "execution_count": null, "id": "5274d079", "metadata": {}, "outputs": [], "source": [ "# Initialize an new empty Sample\n", "print(\"#---# Empty Sample\")\n", "sample = Sample()\n", "print(sample, end=\"\\n\\n\")\n", "\n", "# Init CGNS tree base at time 0.\n", "sample.init_base(2, 3, \"SurfaceMesh\", time=0.0)\n", "\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "154bf55d", "metadata": {}, "source": [ "### Initialize CGNS tree zone" ] }, { "cell_type": "code", "execution_count": null, "id": "35e5edf3", "metadata": {}, "outputs": [], "source": [ "# Init CGNS tree zone to a base at time 0.\n", "shape = np.array((len(points), len(triangles), 0))\n", "sample.init_zone(shape, zone_name=\"TestZoneName\", base_name=\"SurfaceMesh\", time=0.0)\n", "\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "0477c921", "metadata": {}, "source": [ "### Set the coordinates of nodes for a specified base and zone" ] }, { "cell_type": "code", "execution_count": null, "id": "4c6fc6e5", "metadata": {}, "outputs": [], "source": [ "points = np.array(\n", " [\n", " [0.0, 0.0],\n", " [1.0, 0.0],\n", " [1.0, 1.0],\n", " [0.0, 1.0],\n", " [0.5, 1.5],\n", " ]\n", ")\n", "\n", "# Set the coordinates of nodes for a specified base and zone at a given time.\n", "# set_points == set_nodes == set_vertices\n", "sample.set_nodes(points, base_name=\"SurfaceMesh\", zone_name=\"TestZoneName\", time=0.0)\n", "\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "d12fd893", "metadata": {}, "source": [ "### Add a field to a specified zone in the grid" ] }, { "cell_type": "code", "execution_count": null, "id": "992628d5", "metadata": {}, "outputs": [], "source": [ "# Add a field to a specified zone\n", "sample.add_field(\n", " \"Pressure\",\n", " np.random.randn(len(points)),\n", " base_name=\"SurfaceMesh\",\n", " zone_name=\"TestZoneName\",\n", " time=0.0,\n", ")\n", "\n", "show_sample(sample)" ] }, { "cell_type": "code", "execution_count": null, "id": "edfbc669", "metadata": {}, "outputs": [], "source": [ "# Add another field\n", "sample.add_field(\n", " \"Temperature\",\n", " np.random.randn(len(points)),\n", " base_name=\"SurfaceMesh\",\n", " zone_name=\"TestZoneName\",\n", " time=0.0,\n", ")\n", "\n", "show_sample(sample)" ] }, { "cell_type": "markdown", "id": "17469419", "metadata": {}, "source": [ "### Access scalars data in Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "ff0a8195", "metadata": {}, "outputs": [], "source": [ "# It will look for a default base if no base and zone are given\n", "print(f\"{sample.get_scalar_names() = }\")\n", "print(f\"{sample.get_scalar('omega') = }\")\n", "print(f\"{sample.get_scalar('rotation') = }\")" ] }, { "cell_type": "markdown", "id": "2c94b082", "metadata": {}, "source": [ "### Access fields data in Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "0fefdd30", "metadata": {}, "outputs": [], "source": [ "# It will look for a default base if no base and zone are given\n", "print(f\"{sample.get_field_names() = }\")\n", "print(f\"{sample.get_field('T') = }\")\n", "print(f\"{sample.get_field('Temperature') = }\")" ] }, { "cell_type": "markdown", "id": "378343e8", "metadata": {}, "source": [ "### Access to points coordinates" ] }, { "cell_type": "code", "execution_count": null, "id": "115ed407", "metadata": {}, "outputs": [], "source": [ "# It will look for a default base if no base and zone are given\n", "print(f\"{sample.get_nodes() = }\")\n", "print(f\"{sample.features.get_points() = }\") # same as get_nodes\n", "print(f\"{sample.features.get_vertices() = }\") # same as get_nodes" ] }, { "cell_type": "markdown", "id": "bd117d71", "metadata": {}, "source": [ "### Retrieve element connectivity data" ] }, { "cell_type": "code", "execution_count": null, "id": "e7ae671d", "metadata": {}, "outputs": [], "source": [ "# Create an empty Sample\n", "tmp_sample = Sample()\n", "\n", "# Add the previously created CGNS tree in the Sample\n", "tmp_sample.features.add_tree(tree)\n", "\n", "print(\"element connectivity = \\n\", f\"{tmp_sample.features.get_elements()}\")" ] }, { "cell_type": "markdown", "id": "9027acca", "metadata": {}, "source": [ "### Access the available base of the CGNS tree" ] }, { "cell_type": "code", "execution_count": null, "id": "7477ecfa", "metadata": {}, "outputs": [], "source": [ "# Get base names\n", "bases_names = sample.features.get_base_names()\n", "# Get full base path\n", "full_bases_names = sample.features.get_base_names(full_path=True)\n", "\n", "print(f\"{bases_names=}\")\n", "print(f\"{full_bases_names=}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "6254022e", "metadata": {}, "outputs": [], "source": [ "# Get the first base name\n", "base_name = sample.features.get_base_names()[0]\n", "# Get base node\n", "base_node_content = sample.features.get_base(base_name)\n", "\n", "print(f\"{base_node_content = }\")" ] }, { "cell_type": "markdown", "id": "d350d8a0", "metadata": {}, "source": [ "### Check if a base exists in a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "4e8bbaf2", "metadata": {}, "outputs": [], "source": [ "# Get the first base name\n", "base_name = sample.features.get_base_names()[0]\n", "\n", "print(f\"{sample.features.has_base(base_name) = }\")\n", "print(f\"{sample.features.has_base('unknown_base_name') = }\")" ] }, { "cell_type": "markdown", "id": "f427a43c", "metadata": {}, "source": [ "### Access the available zone from a CGNS tree base" ] }, { "cell_type": "code", "execution_count": null, "id": "2efa3650", "metadata": {}, "outputs": [], "source": [ "# Get the first base name\n", "base_name = sample.features.get_base_names()[0]\n", "\n", "# Get zones associated with the first base\n", "zones_names = sample.features.get_zone_names(base_name)\n", "# Get full path of zones associated with the first base\n", "full_zones_names = sample.features.get_zone_names(base_name, full_path=True)\n", "\n", "print(f\" - Base : {base_name}\")\n", "print(f\" - Zone(s): {zones_names}\")\n", "print(f\" - Zone(s) full path: {full_zones_names}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "1112c97d", "metadata": {}, "outputs": [], "source": [ "# Get the first zone name from a base name\n", "zone_name = zones_names[0]\n", "# Get base node\n", "zone_node_content = sample.features.get_zone(zone_name, base_name)\n", "\n", "print(f\"{zone_node_content = }\")" ] }, { "cell_type": "markdown", "id": "3f873aa9", "metadata": {}, "source": [ "### Get the zone type" ] }, { "cell_type": "code", "execution_count": null, "id": "e2e43cf3", "metadata": {}, "outputs": [], "source": [ "# Get the first zone name from a base name\n", "zone_name = zones_names[0]\n", "z_type = sample.features.get_zone_type(zone_name, base_name)\n", "\n", "print(f\"zone type = {z_type}\")" ] }, { "cell_type": "markdown", "id": "f1c47480", "metadata": {}, "source": [ "### Check if a zone exists in a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "e52235ce", "metadata": {}, "outputs": [], "source": [ "# Get the first zone name from a base name\n", "zone_name = zones_names[0]\n", "\n", "print(f\"{sample.features.has_zone(zone_name, base_name) = }\")\n", "print(f\"{sample.features.has_zone('unknown_zone_name', base_name) = }\")" ] }, { "cell_type": "markdown", "id": "7abb2107", "metadata": {}, "source": [ "### Get mesh from sample" ] }, { "cell_type": "code", "execution_count": null, "id": "fc8c00fc", "metadata": {}, "outputs": [], "source": [ "sample_mesh = sample.get_mesh()\n", "print(sample_mesh)" ] }, { "cell_type": "markdown", "id": "22f8e064", "metadata": {}, "source": [ "### Get all mesh time available in Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "c0d713d1", "metadata": {}, "outputs": [], "source": [ "# Before adding new tree\n", "print(f\"{sample.features.get_all_time_values() = }\")\n", "\n", "# Add one CGNS tree at time 1.\n", "sample.features.add_tree(tree, 1.0)\n", "\n", "# After adding new tree\n", "print(f\"{sample.features.get_all_time_values() = }\")" ] }, { "cell_type": "markdown", "id": "3b4e6b5d", "metadata": {}, "source": [ "### Creating a Sample Hierarchy with bases, zones, and associated data." ] }, { "cell_type": "code", "execution_count": null, "id": "2f4011f3", "metadata": {}, "outputs": [], "source": [ "bases_names = sample.features.get_base_names()\n", "full_bases_names = sample.features.get_base_names(full_path=True)\n", "print(f\"{bases_names = }\")\n", "print(f\"{full_bases_names = }\", end=\"\\n\\n\")\n", "\n", "for b_name in bases_names:\n", " zones_names = sample.features.get_zone_names(b_name)\n", " full_zones_names = sample.features.get_zone_names(b_name, full_path=True)\n", " print(f\" - Base : {b_name}\")\n", " for z_name, f_z_name in zip(zones_names, full_zones_names):\n", " print(\n", " f\" - {z_name} -> type: {sample.features.get_zone_type(z_name, b_name)} | full: {f_z_name}\"\n", " )" ] }, { "cell_type": "markdown", "id": "5f356805", "metadata": {}, "source": [ "## Section 3: Set and Get default values\n", "\n", "This section demonstrates how to use default CGNS values in a Sample." ] }, { "cell_type": "markdown", "id": "47f1ddc8", "metadata": {}, "source": [ "### Set and use default time in a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "2bc1fa53", "metadata": {}, "outputs": [], "source": [ "# Without a provided default time, it searches the first time available in all mesh times\n", "print(f\"{sample.features.get_all_time_values() = }\")\n", "print(f\"{sample.features.get_time_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Set default time\n", "sample.set_default_time(1.0)\n", "# Now that default time has been assigned, there's no need to specify it in function calls.\n", "print(f\"{sample.features.get_time_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Print the tree at time 1.0\n", "sample.show_tree() # == sample.show_tree(1.0)" ] }, { "cell_type": "code", "execution_count": null, "id": "2d433c10", "metadata": {}, "outputs": [], "source": [ "# If time is specified as an argument in a function, it takes precedence over the default time.\n", "sample.show_tree(0.0) # Print the tree at time 0.0 even if default time is 1.0" ] }, { "cell_type": "markdown", "id": "20ac997a", "metadata": {}, "source": [ "### Set and use default base and time in a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "269636ae", "metadata": {}, "outputs": [], "source": [ "# Reset default time\n", "sample.features._default_active_time = None\n", "\n", "# Without a provided default time, it searches the first time available in all mesh times\n", "print(f\"{sample.features.get_time_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Create new bases\n", "sample.init_base(1, 1, \"new_base\", 0.0)\n", "print(f\"{sample.features.get_topological_dim('new_base', 0.0) = }\")\n", "print(f\"{sample.features.get_physical_dim('new_base', 0.0) = }\")" ] }, { "cell_type": "code", "execution_count": null, "id": "7d6514c5", "metadata": {}, "outputs": [], "source": [ "# Attempting to get a base when the default base is not set, and there are multiple bases available.\n", "print(f\"{sample.features.get_base_names() = }\", end=\"\\n\\n\")\n", "try:\n", " sample.features.get_base_assignment()\n", "except KeyError as e:\n", " print(str(e))" ] }, { "cell_type": "code", "execution_count": null, "id": "a5a9b314", "metadata": {}, "outputs": [], "source": [ "# Set default base and time\n", "sample.set_default_base(\"SurfaceMesh\", 0.0)\n", "\n", "# Now that default base and time have been assigned, it is no longer necessary to specify them in function calls.\n", "print(f\"{sample.features.get_time_assignment() = }\")\n", "print(f\"{sample.features.get_base_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Print the topological and physical dim for the default base == 'SurfaceMesh'\n", "print(f\"{sample.features.get_topological_dim() = }\")\n", "print(f\"{sample.features.get_physical_dim() = }\")" ] }, { "cell_type": "code", "execution_count": null, "id": "56a0ade3", "metadata": {}, "outputs": [], "source": [ "# If base is specified as an argument in a function, it takes precedence over the default base.\n", "print(\n", " f\"{sample.features.get_physical_dim('new_base') = }\"\n", ") # Print the 'new_base' physical dim instead of the default base physical dim" ] }, { "cell_type": "markdown", "id": "1f0694ed", "metadata": {}, "source": [ "### Set and use default base, zone and time in a Sample" ] }, { "cell_type": "code", "execution_count": null, "id": "515f1b6f", "metadata": {}, "outputs": [], "source": [ "# Reset default base and time\n", "sample.features._default_active_time = None\n", "sample.features._default_active_base = None\n", "\n", "# Without a provided default time, it searches the first time available in all mesh times\n", "print(f\"{sample.features.get_time_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Create a new zone in 'SurfaceMesh' base\n", "sample.init_zone(\n", " zone_shape=np.array([5, 3, 0]),\n", " zone_type=CGK.Structured_s,\n", " zone_name=\"new_zone\",\n", " base_name=\"SurfaceMesh\",\n", ")\n", "print(f\"{sample.features.get_zone_type('TestZoneName', 'SurfaceMesh') = }\")\n", "print(f\"{sample.features.get_zone_type('new_zone', 'SurfaceMesh') = }\")" ] }, { "cell_type": "code", "execution_count": null, "id": "f56bf6fc", "metadata": {}, "outputs": [], "source": [ "# Set default base\n", "sample.set_default_base(\"SurfaceMesh\")\n", "\n", "# Attempting to get a zone when the default zone is not set, and there are multiple zones available in the default base.\n", "print(f\"{sample.features.get_zone_names() = }\", end=\"\\n\\n\")\n", "try:\n", " sample.features.get_zone_assignment()\n", "except KeyError as e:\n", " print(str(e))" ] }, { "cell_type": "code", "execution_count": null, "id": "669f0312", "metadata": {}, "outputs": [], "source": [ "# Reset default base and time\n", "sample.features._default_active_time = None\n", "sample.features._default_active_base = None\n", "\n", "# Set default base, zone and time\n", "sample.set_default_zone_base(\"TestZoneName\", \"SurfaceMesh\", 0.0)\n", "\n", "# Now that default base, zone and time have been assigned, it is no longer necessary to specify them in function calls.\n", "print(f\"{sample.features.get_time_assignment() = }\")\n", "print(f\"{sample.features.get_base_assignment() = }\")\n", "print(f\"{sample.features.get_zone_assignment() = }\", end=\"\\n\\n\")\n", "\n", "# Print the type of the default zone (from the default base)\n", "print(f\"{sample.features.get_zone_type() = }\")\n", "\n", "# Print the default zone content (from the default base)\n", "print(f\"{sample.features.get_zone() = }\")" ] }, { "cell_type": "code", "execution_count": null, "id": "3ae940e1", "metadata": {}, "outputs": [], "source": [ "# If zone is specified as an argument in a function, it takes precedence over the default zone.\n", "print(\n", " f\"{sample.features.get_zone_type('new_zone') = }\"\n", ") # Print the 'new_zone' type instead of the default zone type" ] }, { "cell_type": "markdown", "id": "b4b8929c", "metadata": {}, "source": [ "### More information on how default values work" ] }, { "cell_type": "code", "execution_count": null, "id": "09bc50ce", "metadata": {}, "outputs": [], "source": [ "from IPython.display import Image\n", "\n", "try:\n", " filename = (\n", " Path(__file__).parent.parent.parent\n", " / \"docs\"\n", " / \"source\"\n", " / \"images\"\n", " / \"default_value_selection.png\"\n", " )\n", "except NameError:\n", " filename = Path(\"..\") / \"..\" / \"images\" / \"default_value_selection.png\"\n", "Image(filename=filename)" ] }, { "cell_type": "markdown", "id": "a31a7217", "metadata": {}, "source": [ "## Section 4: Saving and Loading Sample\n", "\n", "This section demonstrates how to save and load a Sample from a directory." ] }, { "cell_type": "markdown", "id": "0891d56b", "metadata": {}, "source": [ "### Save Sample to as a file tree" ] }, { "cell_type": "code", "execution_count": null, "id": "f2bc9584", "metadata": {}, "outputs": [], "source": [ "test_pth = Path(\n", " f\"/tmp/test_safe_to_delete_{np.random.randint(low=1, high=2_000_000_000)}\"\n", ")\n", "test_pth.mkdir(parents=True, exist_ok=True)\n", "\n", "sample_save_fname = test_pth / \"test\"\n", "print(f\"saving path: {sample_save_fname}\")\n", "\n", "sample.save(sample_save_fname)" ] }, { "cell_type": "markdown", "id": "4b1a1f0b", "metadata": {}, "source": [ "### Load a Sample from a directory via initialization" ] }, { "cell_type": "code", "execution_count": null, "id": "8cf1c732", "metadata": {}, "outputs": [], "source": [ "new_sample = Sample(path=sample_save_fname)\n", "\n", "show_sample(new_sample)" ] }, { "cell_type": "markdown", "id": "8a7bbdc4", "metadata": {}, "source": [ "### Load a Sample from a directory via the Sample class" ] }, { "cell_type": "code", "execution_count": null, "id": "725d3f47", "metadata": {}, "outputs": [], "source": [ "new_sample_2 = Sample.load_from_dir(test_pth / \"test\")\n", "\n", "show_sample(new_sample_2)" ] }, { "cell_type": "markdown", "id": "a50b2dd5", "metadata": {}, "source": [ "### Load the Sample from a directory via a Sample instance" ] }, { "cell_type": "code", "execution_count": null, "id": "5f4861be", "metadata": {}, "outputs": [], "source": [ "new_sample = Sample()\n", "new_sample.load(sample_save_fname)\n", "\n", "show_sample(new_sample)" ] } ], "metadata": { "jupytext": { "formats": "ipynb,py:percent" }, "kernelspec": { "display_name": "plaid_dev", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }