Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix a couple bugs in PPVCube notebook #228

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 35 additions & 46 deletions doc/source/PPVCube.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
},
"outputs": [],
"source": [
"from yt.config import ytcfg\n",
"\n",
"import yt\n",
"import numpy as np\n",
"from yt.extensions.astro_analysis.ppv_cube.api import PPVCube\n",
Expand Down Expand Up @@ -125,11 +123,11 @@
"name": "stderr",
"output_type": "stream",
"text": [
"yt : [INFO ] 2017-08-10 16:21:34,359 Parameters: current_time = 0.0\n",
"yt : [INFO ] 2017-08-10 16:21:34,360 Parameters: domain_dimensions = [64 64 64]\n",
"yt : [INFO ] 2017-08-10 16:21:34,362 Parameters: domain_left_edge = [-0.5 -0.5 -0.5]\n",
"yt : [INFO ] 2017-08-10 16:21:34,363 Parameters: domain_right_edge = [ 0.5 0.5 0.5]\n",
"yt : [INFO ] 2017-08-10 16:21:34,364 Parameters: cosmological_simulation = 0.0\n"
"yt : [INFO ] 2023-10-02 09:48:06,889 Parameters: current_time = 0.0\n",
"yt : [INFO ] 2023-10-02 09:48:06,891 Parameters: domain_dimensions = [64 64 64]\n",
"yt : [INFO ] 2023-10-02 09:48:06,892 Parameters: domain_left_edge = [-0.5 -0.5 -0.5]\n",
"yt : [INFO ] 2023-10-02 09:48:06,893 Parameters: domain_right_edge = [0.5 0.5 0.5]\n",
"yt : [INFO ] 2023-10-02 09:48:06,894 Parameters: cosmological_simulation = 0\n"
]
}
],
Expand All @@ -153,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -162,28 +160,33 @@
"name": "stderr",
"output_type": "stream",
"text": [
"yt : [INFO ] 2017-08-10 16:21:34,863 xlim = -0.500000 0.500000\n",
"yt : [INFO ] 2017-08-10 16:21:34,864 ylim = -0.500000 0.500000\n",
"yt : [INFO ] 2017-08-10 16:21:34,866 xlim = -0.500000 0.500000\n",
"yt : [INFO ] 2017-08-10 16:21:34,867 ylim = -0.500000 0.500000\n",
"yt : [INFO ] 2017-08-10 16:21:34,875 Making a fixed resolution buffer of (('gas', 'density')) 800 by 800\n",
"yt : [INFO ] 2017-08-10 16:21:34,885 Making a fixed resolution buffer of (('gas', 'velocity_x')) 800 by 800\n",
"yt : [INFO ] 2017-08-10 16:21:34,893 Making a fixed resolution buffer of (('gas', 'velocity_y')) 800 by 800\n",
"yt : [INFO ] 2017-08-10 16:21:34,899 Making a fixed resolution buffer of (('gas', 'velocity_magnitude')) 800 by 800\n",
"yt : [WARNING ] 2017-08-10 16:21:34,920 Plot image for field ('gas', 'velocity_x') has both positive and negative values. Min = -16485822.496297, Max = 16485822.496296.\n",
"yt : [WARNING ] 2017-08-10 16:21:34,921 Switching to symlog colorbar scaling unless linear scaling is specified later\n",
"yt : [WARNING ] 2017-08-10 16:21:35,687 Plot image for field ('gas', 'velocity_y') has both positive and negative values. Min = -16485822.496296, Max = 16485822.496297.\n",
"yt : [WARNING ] 2017-08-10 16:21:35,688 Switching to symlog colorbar scaling unless linear scaling is specified later\n"
"yt : [INFO ] 2023-10-02 09:51:15,566 xlim = -0.500000 0.500000\n",
"yt : [INFO ] 2023-10-02 09:51:15,567 ylim = -0.500000 0.500000\n",
"yt : [INFO ] 2023-10-02 09:51:15,571 xlim = -0.500000 0.500000\n",
"yt : [INFO ] 2023-10-02 09:51:15,573 ylim = -0.500000 0.500000\n",
"yt : [INFO ] 2023-10-02 09:51:15,575 Making a fixed resolution buffer of (('gas', 'velocity_magnitude')) 800 by 800\n",
"yt : [INFO ] 2023-10-02 09:51:15,795 Making a fixed resolution buffer of (('gas', 'density')) 800 by 800\n",
"yt : [INFO ] 2023-10-02 09:51:16,011 Making a fixed resolution buffer of (('gas', 'velocity_y')) 800 by 800\n",
"yt : [INFO ] 2023-10-02 09:51:16,235 Making a fixed resolution buffer of (('gas', 'velocity_x')) 800 by 800\n"
]
}
],
"source": [
"slc = yt.SlicePlot(ds, \"z\", [\"density\",\"velocity_x\",\"velocity_y\",\"velocity_magnitude\"])"
"slc = yt.SlicePlot(\n",
" ds,\n",
" \"z\",\n",
" fields=[\n",
" (\"gas\", \"density\"),\n",
" (\"gas\", \"velocity_x\"),\n",
" (\"gas\", \"velocity_y\"),\n",
" (\"gas\", \"velocity_magnitude\"),\n",
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {
"collapsed": false,
"scrolled": false
Expand All @@ -203,10 +206,10 @@
}
],
"source": [
"slc.set_log(\"velocity_x\", False)\n",
"slc.set_log(\"velocity_y\", False)\n",
"slc.set_log(\"velocity_magnitude\", False)\n",
"slc.set_unit(\"velocity_magnitude\", \"km/s\")\n",
"slc.set_log((\"gas\", \"velocity_x\"), False)\n",
"slc.set_log((\"gas\", \"velocity_y\"), False)\n",
"slc.set_log((\"gas\", \"velocity_magnitude\"), False)\n",
"slc.set_unit((\"gas\", \"velocity_magnitude\"), \"km/s\")\n",
"slc.show()"
]
},
Expand All @@ -219,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {
"collapsed": false
},
Expand All @@ -238,7 +241,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {
"collapsed": false,
"scrolled": true
Expand All @@ -265,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {
"collapsed": false
},
Expand All @@ -274,10 +277,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"yt : [INFO ] 2017-08-10 16:21:43,375 Making a FITS image of field density\n",
"yt : [WARNING ] 2017-08-10 16:21:43,389 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
"yt : [WARNING ] 2017-08-10 16:21:43,390 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
"WARNING: AstropyDeprecationWarning: \"clobber\" was deprecated in version 1.3 and will be removed in a future version. Use argument \"overwrite\" instead. [astropy.utils.decorators]\n"
"yt : [INFO ] 2023-10-02 09:51:37,535 Making a FITS image of field density\n"
]
}
],
Expand All @@ -294,22 +294,11 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"yt : [INFO ] 2017-08-10 16:21:43,619 Making a FITS image of field density\n",
"yt : [WARNING ] 2017-08-10 16:21:43,629 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
"yt : [WARNING ] 2017-08-10 16:21:43,629 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
"WARNING: AstropyDeprecationWarning: \"clobber\" was deprecated in version 1.3 and will be removed in a future version. Use argument \"overwrite\" instead. [astropy.utils.decorators]\n"
]
}
],
"outputs": [],
"source": [
"sky_scale = (1.0, \"arcsec/kpc\")\n",
"sky_center = (30., 45.) # RA, Dec in degrees\n",
Expand Down