{ "cells": [ { "cell_type": "markdown", "id": "f245a59e-8392-442a-a459-96107a0ab974", "metadata": {}, "source": [ "# Interactive plots\n", "\n", "This notebook show how to use `Holoviews` based plotting methods to create interactive plots of the magnetisation or derived quantities. The interface is the same as in `discretisedfield.Field.hv`. For details on the different plotting methods refer to the documentation of `Holoviews` based plotting in `discretisedfield`." ] }, { "cell_type": "code", "execution_count": 1, "id": "6d659f47-0b71-4d24-9569-1ab184a0d6b2", "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "import discretisedfield as df\n", "\n", "import micromagneticdata as md" ] }, { "cell_type": "markdown", "id": "03810fe1-104f-4992-a784-caf6ae78a567", "metadata": {}, "source": [ "We have a set of example simulations stored in the test directory of `micromagneticdata` that we use to demonstrate its functionality." ] }, { "cell_type": "code", "execution_count": 2, "id": "8d2278a8-60c2-4836-aa3d-fd5585c2d06d", "metadata": {}, "outputs": [], "source": [ "dirname = os.path.join(\"..\", \"micromagneticdata\", \"tests\", \"test_sample\")" ] }, { "cell_type": "markdown", "id": "d8fa2f81-4b23-4ad9-beaf-8f3d071c11fa", "metadata": {}, "source": [ "## `Data`\n", "First, we creata a `Data` object. We need to pass the name of the `micromagneticmodel.System` that we used to run the simulation and optionally an additional path to the base directory." ] }, { "cell_type": "code", "execution_count": 3, "id": "5af03d40-d939-4f9b-844d-11ad1228524e", "metadata": {}, "outputs": [], "source": [ "data = md.Data(name=\"system_name\", dirname=dirname)" ] }, { "cell_type": "markdown", "id": "b4021879-d04f-4043-bafb-f391a6c1aeee", "metadata": {}, "source": [ "The `Data` object contains all simulation runs of the `System`. These are called drives." ] }, { "cell_type": "code", "execution_count": 4, "id": "c9d42e40-d3f4-4b75-95dd-9f95aaafaba5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | drive_number | \n", "date | \n", "time | \n", "driver | \n", "t | \n", "n | \n", "Hmin | \n", "Hmax | \n", "
|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "2022-02-11 | \n", "12:51:44 | \n", "TimeDriver | \n", "2.500000e-11 | \n", "25.0 | \n", "NaN | \n", "NaN | \n", "
| 1 | \n", "1 | \n", "2022-02-11 | \n", "12:51:45 | \n", "TimeDriver | \n", "1.500000e-11 | \n", "15.0 | \n", "NaN | \n", "NaN | \n", "
| 2 | \n", "2 | \n", "2022-02-11 | \n", "12:51:45 | \n", "TimeDriver | \n", "5.000000e-12 | \n", "10.0 | \n", "NaN | \n", "NaN | \n", "
| 3 | \n", "3 | \n", "2022-02-11 | \n", "12:51:46 | \n", "MinDriver | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
| 4 | \n", "4 | \n", "2022-02-11 | \n", "12:51:46 | \n", "TimeDriver | \n", "5.000000e-12 | \n", "5.0 | \n", "NaN | \n", "NaN | \n", "
| 5 | \n", "5 | \n", "2022-02-11 | \n", "12:51:46 | \n", "MinDriver | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
| 6 | \n", "6 | \n", "2022-02-11 | \n", "12:51:47 | \n", "HysteresisDriver | \n", "NaN | \n", "21.0 | \n", "[0, 0, 1000000.0] | \n", "[0, 0, -1000000.0] | \n", "
| 7 | \n", "7 | \n", "2022-06-19 | \n", "16:15:06 | \n", "RelaxDriver | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
| 8 | \n", "8 | \n", "2022-06-19 | \n", "16:15:07 | \n", "MinDriver | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
| 9 | \n", "9 | \n", "2022-06-19 | \n", "16:15:08 | \n", "TimeDriver | \n", "5.000000e-09 | \n", "10.0 | \n", "NaN | \n", "NaN | \n", "