Files
astaroth/analysis/python/jupyter/notebook_example.ipynb
2019-08-05 14:41:30 +08:00

131 lines
2.7 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import astar.data as ad\n",
"import astar.visual as vis\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Here we read data from the run directory"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"meshdir = \"/scratch/data/tchsu/sink_double/\"\n",
"#meshdir = \"/scratch/data/mvaisala/normaltest/\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#imesh = 30000\n",
"imesh = 1000\n",
"mesh = ad.read.Mesh(imesh, fdir=meshdir)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Auxuliary variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"uu_tot = np.sqrt(mesh.uu[0]**2.0 + mesh.uu[1]**2.0 + mesh.uu[2]**2.0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example visualization funtion call. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"vis.slices.plot_3(mesh, uu_tot, title = r'$\\|u\\|$')\n",
"vis.slices.plot_3(mesh, mesh.uu[0], title = r'$u_x$')\n",
"vis.slices.plot_3(mesh, mesh.uu[1], title = r'$u_y$')\n",
"vis.slices.plot_3(mesh, mesh.uu[2], title = r'$u_z$')\n",
"vis.slices.plot_3(mesh, mesh.lnrho, title = r'$\\ln_\\rho$')\n",
"vis.slices.plot_3(mesh, np.exp(mesh.lnrho), title = r'$\\rho$')\n",
"vis.slices.plot_3(mesh, np.exp(mesh.lnrho), title = r'$N_\\mathrm{col}$', slicetype = 'sum')\n",
"vis.slices.plot_3(mesh, mesh.ss, title = r'$s$')\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Ploting time series"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ts = ad.read.TimeSeries(fdir=meshdir)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vis.lineplot.plot_ts(ts, lnrho=1, uutot=1, uux=1, uuy=1, uuz=1, ss=1)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}