Skip to content

Commit

Permalink
Merge pull request #30 from nvaytet/new_test_data
Browse files Browse the repository at this point in the history
Update notebooks for new test data
  • Loading branch information
nvaytet authored Oct 2, 2021
2 parents e9064a8 + 17b9155 commit d1b6670
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 72 deletions.
16 changes: 9 additions & 7 deletions docs/basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"source": [
"## Reading a RAMSES output\n",
"\n",
"Import the `osyris` module and load the output of your choice (this will be output number `71` in this example)."
"Import the `osyris` module and load the output of your choice.\n",
"We are loading output number `8` from a simulation of a collapsing system of gas,\n",
"that is forming young stars in its core."
]
},
{
Expand Down Expand Up @@ -53,7 +55,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\")"
"data = osyris.Dataset(8, scale=\"au\", path=\"osyrisdata/starformation\")"
]
},
{
Expand Down Expand Up @@ -127,9 +129,9 @@
"\n",
"## Creating a 2D histogram\n",
"\n",
"We now wish to plot a 2d histogram of the logarithm of density versus logarithm of gas temperature,\n",
"We now wish to plot a 2d histogram of the logarithm of density versus logarithm of magnetic field magnitude,\n",
"for all the cells inside the computational domain.\n",
"We also use a logarithmic colormap which represents the cell counts in the $(\\rho,T)$ plane"
"We also use a logarithmic colormap which represents the cell counts in the $(\\rho,B)$ plane"
]
},
{
Expand All @@ -138,7 +140,7 @@
"metadata": {},
"outputs": [],
"source": [
"osyris.histogram(data[\"hydro\"][\"density\"], data[\"hydro\"][\"temperature\"],\n",
"osyris.histogram(data[\"hydro\"][\"density\"], data[\"hydro\"][\"B_field\"],\n",
" norm=\"log\", loglog=True)"
]
},
Expand All @@ -148,7 +150,7 @@
"source": [
"## Simple cut plane\n",
"\n",
"The goal here is to create a 2D gas density slice, 100 au wide, through the plane normal to `z`,\n",
"The goal here is to create a 2D gas density slice, 2000 au wide, through the plane normal to `z`,\n",
"that passes through the center of the young star forming system.\n",
"\n",
"We first need to define where the center of the system is.\n",
Expand Down Expand Up @@ -180,7 +182,7 @@
"outputs": [],
"source": [
"osyris.plane({\"data\": data[\"hydro\"][\"density\"], \"norm\": \"log\"},\n",
" dx=100 * osyris.units('au'),\n",
" dx=2000 * osyris.units('au'),\n",
" origin=center,\n",
" direction=\"z\")"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/data_structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load()"
"data = osyris.Dataset(8, scale=\"au\", path=\"osyrisdata/starformation\").load()"
]
},
{
Expand Down
37 changes: 19 additions & 18 deletions docs/loading_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load()"
"path = \"osyrisdata/starformation\"\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load()"
]
},
{
Expand Down Expand Up @@ -62,7 +63,7 @@
"\n",
"It is possible to load only a subset of the cells, by using custom functions to perform the selection.\n",
"\n",
"As an example, to load all the cells with $\\rho > 10^{-13}~{\\rm g~cm}^{-3}$, we use a selection criterion"
"As an example, to load all the cells with $\\rho > 10^{-15}~{\\rm g~cm}^{-3}$, we use a selection criterion"
]
},
{
Expand All @@ -71,8 +72,8 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
" select={\"hydro\": {\"density\": lambda d : d > 1.0e-13 * osyris.units('g/cm**3')}})"
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"hydro\": {\"density\": lambda d : d > 1.0e-15 * osyris.units('g/cm**3')}})"
]
},
{
Expand Down Expand Up @@ -105,9 +106,9 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
" select={\"hydro\": {\"density\": lambda d : d > 1.0e-13 * osyris.units('g/cm**3')},\n",
" \"amr\": {\"xyz_x\": lambda x : x > 5500. * osyris.units('au')}})"
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"hydro\": {\"density\": lambda d : d > 1.0e-16 * osyris.units('g/cm**3')},\n",
" \"amr\": {\"xyz_x\": lambda x : x > 1500. * osyris.units('au')}})"
]
},
{
Expand All @@ -117,7 +118,7 @@
"outputs": [],
"source": [
"osyris.plane({\"data\": data[\"hydro\"][\"density\"], \"norm\": \"log\"},\n",
" dx=200 * osyris.units('au'),\n",
" dx=1000 * osyris.units('au'),\n",
" origin=data[\"amr\"][\"xyz\"][np.argmax(data[\"hydro\"][\"density\"]).values],\n",
" direction='z')"
]
Expand All @@ -137,7 +138,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"hydro\": {\"density\": False}})\n",
"\"density\" in data[\"hydro\"]"
]
Expand All @@ -158,7 +159,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"hydro\": False})\n",
"data"
]
Expand All @@ -184,16 +185,16 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
" select={\"amr\": {\"level\": lambda l : l < 10}})\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"amr\": {\"level\": lambda l : l < 7}})\n",
"data[\"amr\"][\"level\"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"will only read levels 1 to 9, while"
"will only read levels 1 to 6, while"
]
},
{
Expand All @@ -202,16 +203,16 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
" select={\"amr\": {\"level\": lambda l : np.logical_and(l > 9, l < 13)}})\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" select={\"amr\": {\"level\": lambda l : np.logical_and(l > 5, l < 9)}})\n",
"data[\"amr\"][\"level\"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"will read levels 1 to 12, but will then discard all cells with `level` < 10.\n",
"will read levels 1 to 8, but will then discard all cells with `level` < 6.\n",
"\n",
"### Loading only selected CPU outputs\n",
"\n",
Expand All @@ -224,7 +225,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = osyris.Dataset(71, scale=\"au\", path=\"osyrisdata\").load(\n",
"data = osyris.Dataset(8, scale=\"au\", path=path).load(\n",
" cpu_list=[1, 2, 10, 4, 5])"
]
},
Expand All @@ -235,7 +236,7 @@
"outputs": [],
"source": [
"osyris.plane({\"data\": data[\"hydro\"][\"density\"], \"norm\": \"log\"},\n",
" dx=400 * osyris.units(\"au\"),\n",
" dx=2000 * osyris.units(\"au\"),\n",
" origin=data[\"amr\"][\"xyz\"][np.argmax(data[\"hydro\"][\"density\"]).values],\n",
" direction='z')"
]
Expand Down
Loading

0 comments on commit d1b6670

Please sign in to comment.