{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exporting data\n", "\n", "There are fundamentally two different data types:\n", "\n", "- spatially averaged data (as in the `odt` [OOMMF Data Table] file)\n", "- spatially resolved data (as in the `omf`, `omv` files)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Access the raw OOMMF output files\n", "\n", "When Jupyter OOMMF needs a micromagnetic calculation to be carried out, it is writing a `mif` file, and then asks OOMMF to execute that miffile, and export data to the file system.\n", "\n", "It it thus possible to read the output files from the disk as one would normally with OOMMF. This allows re-use of all existing tools to analyse OOMMF data (including muview, ovf2vtk, ...)\n", "\n", "Example" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2018/6/26 12:2: Calling OOMMF (example-macrospin/example-macrospin.mif) ... [0.7s]\n" ] } ], "source": [ "import oommfc as oc\n", "system = oc.examples.macrospin()\n", "td = oc.TimeDriver()\n", "td.drive(system, t=0.1e-9, n=5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From the last output line, we can see that the OOMMF data is stored in the directory `example-macrospin`. We can display the content:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "example-macrospin.mif\r\n", "example-macrospin.odt\r\n", "example-macrospin-Oxs_TimeDriver-Magnetization-00-0000036.omf\r\n", "example-macrospin-Oxs_TimeDriver-Magnetization-01-0000066.omf\r\n", "example-macrospin-Oxs_TimeDriver-Magnetization-02-0000092.omf\r\n", "example-macrospin-Oxs_TimeDriver-Magnetization-03-0000113.omf\r\n", "example-macrospin-Oxs_TimeDriver-Magnetization-04-0000130.omf\r\n", "m0.omf\r\n" ] } ], "source": [ "!ls example-macrospin/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exporting the OOMMF Data Table\n", "The file `example-macrospin.odt` is automatically read and available as a pandas data table in the `system.dt` object. We can thus use all the export functionality that pandas supports. For example" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | E | \n", "Ecount | \n", "max_dm/dt | \n", "dE/dt | \n", "deltaE | \n", "E_Zeeman | \n", "iteration | \n", "stage_iteration | \n", "stage | \n", "mx | \n", "my | \n", "mz | \n", "last_time_step | \n", "t | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "-5.033171e-18 | \n", "217.0 | \n", "37867.797392 | \n", "-1.241326e-07 | \n", "-4.522273e-20 | \n", "-5.033171e-18 | \n", "36.0 | \n", "36.0 | \n", "0.0 | \n", "-0.597360 | \n", "-0.038383 | \n", "0.801054 | \n", "3.586075e-13 | \n", "2.000000e-11 | \n", "
1 | \n", "-6.131373e-18 | \n", "392.0 | \n", "13822.238704 | \n", "-1.653875e-08 | \n", "-6.256125e-21 | \n", "-6.131373e-18 | \n", "66.0 | \n", "29.0 | \n", "1.0 | \n", "0.216713 | \n", "0.027838 | \n", "0.975838 | \n", "3.708125e-13 | \n", "4.000000e-11 | \n", "
2 | \n", "-6.266081e-18 | \n", "543.0 | \n", "4664.609034 | \n", "-1.883547e-09 | \n", "-1.210170e-21 | \n", "-6.266081e-18 | \n", "92.0 | \n", "25.0 | \n", "2.0 | \n", "-0.072403 | \n", "-0.013953 | \n", "0.997278 | \n", "6.216520e-13 | \n", "6.000000e-11 | \n", "
3 | \n", "-6.281233e-18 | \n", "664.0 | \n", "1577.051840 | \n", "-2.152969e-10 | \n", "-2.059347e-22 | \n", "-6.281233e-18 | \n", "113.0 | \n", "20.0 | \n", "3.0 | \n", "0.024163 | \n", "0.006131 | \n", "0.999689 | \n", "9.181643e-13 | \n", "8.000000e-11 | \n", "
4 | \n", "-6.282947e-18 | \n", "761.0 | \n", "550.439309 | \n", "-2.622797e-11 | \n", "-3.440007e-23 | \n", "-6.282947e-18 | \n", "130.0 | \n", "16.0 | \n", "4.0 | \n", "-0.008347 | \n", "-0.002458 | \n", "0.999962 | \n", "1.290222e-12 | \n", "1.000000e-10 | \n", "