Skip to content

Commit da304a7

Browse files
authored
Merge pull request #228 from neutrinoceros/cleanup_ppvcube_nb
BUG: fix a couple bugs in PPVCube notebook
2 parents 31b1a27 + 548227d commit da304a7

File tree

1 file changed

+35
-46
lines changed

1 file changed

+35
-46
lines changed

doc/source/PPVCube.ipynb

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
},
1616
"outputs": [],
1717
"source": [
18-
"from yt.config import ytcfg\n",
19-
"\n",
2018
"import yt\n",
2119
"import numpy as np\n",
2220
"from yt.extensions.astro_analysis.ppv_cube.api import PPVCube\n",
@@ -125,11 +123,11 @@
125123
"name": "stderr",
126124
"output_type": "stream",
127125
"text": [
128-
"yt : [INFO ] 2017-08-10 16:21:34,359 Parameters: current_time = 0.0\n",
129-
"yt : [INFO ] 2017-08-10 16:21:34,360 Parameters: domain_dimensions = [64 64 64]\n",
130-
"yt : [INFO ] 2017-08-10 16:21:34,362 Parameters: domain_left_edge = [-0.5 -0.5 -0.5]\n",
131-
"yt : [INFO ] 2017-08-10 16:21:34,363 Parameters: domain_right_edge = [ 0.5 0.5 0.5]\n",
132-
"yt : [INFO ] 2017-08-10 16:21:34,364 Parameters: cosmological_simulation = 0.0\n"
126+
"yt : [INFO ] 2023-10-02 09:48:06,889 Parameters: current_time = 0.0\n",
127+
"yt : [INFO ] 2023-10-02 09:48:06,891 Parameters: domain_dimensions = [64 64 64]\n",
128+
"yt : [INFO ] 2023-10-02 09:48:06,892 Parameters: domain_left_edge = [-0.5 -0.5 -0.5]\n",
129+
"yt : [INFO ] 2023-10-02 09:48:06,893 Parameters: domain_right_edge = [0.5 0.5 0.5]\n",
130+
"yt : [INFO ] 2023-10-02 09:48:06,894 Parameters: cosmological_simulation = 0\n"
133131
]
134132
}
135133
],
@@ -153,7 +151,7 @@
153151
},
154152
{
155153
"cell_type": "code",
156-
"execution_count": 5,
154+
"execution_count": 7,
157155
"metadata": {
158156
"collapsed": false
159157
},
@@ -162,28 +160,33 @@
162160
"name": "stderr",
163161
"output_type": "stream",
164162
"text": [
165-
"yt : [INFO ] 2017-08-10 16:21:34,863 xlim = -0.500000 0.500000\n",
166-
"yt : [INFO ] 2017-08-10 16:21:34,864 ylim = -0.500000 0.500000\n",
167-
"yt : [INFO ] 2017-08-10 16:21:34,866 xlim = -0.500000 0.500000\n",
168-
"yt : [INFO ] 2017-08-10 16:21:34,867 ylim = -0.500000 0.500000\n",
169-
"yt : [INFO ] 2017-08-10 16:21:34,875 Making a fixed resolution buffer of (('gas', 'density')) 800 by 800\n",
170-
"yt : [INFO ] 2017-08-10 16:21:34,885 Making a fixed resolution buffer of (('gas', 'velocity_x')) 800 by 800\n",
171-
"yt : [INFO ] 2017-08-10 16:21:34,893 Making a fixed resolution buffer of (('gas', 'velocity_y')) 800 by 800\n",
172-
"yt : [INFO ] 2017-08-10 16:21:34,899 Making a fixed resolution buffer of (('gas', 'velocity_magnitude')) 800 by 800\n",
173-
"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",
174-
"yt : [WARNING ] 2017-08-10 16:21:34,921 Switching to symlog colorbar scaling unless linear scaling is specified later\n",
175-
"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",
176-
"yt : [WARNING ] 2017-08-10 16:21:35,688 Switching to symlog colorbar scaling unless linear scaling is specified later\n"
163+
"yt : [INFO ] 2023-10-02 09:51:15,566 xlim = -0.500000 0.500000\n",
164+
"yt : [INFO ] 2023-10-02 09:51:15,567 ylim = -0.500000 0.500000\n",
165+
"yt : [INFO ] 2023-10-02 09:51:15,571 xlim = -0.500000 0.500000\n",
166+
"yt : [INFO ] 2023-10-02 09:51:15,573 ylim = -0.500000 0.500000\n",
167+
"yt : [INFO ] 2023-10-02 09:51:15,575 Making a fixed resolution buffer of (('gas', 'velocity_magnitude')) 800 by 800\n",
168+
"yt : [INFO ] 2023-10-02 09:51:15,795 Making a fixed resolution buffer of (('gas', 'density')) 800 by 800\n",
169+
"yt : [INFO ] 2023-10-02 09:51:16,011 Making a fixed resolution buffer of (('gas', 'velocity_y')) 800 by 800\n",
170+
"yt : [INFO ] 2023-10-02 09:51:16,235 Making a fixed resolution buffer of (('gas', 'velocity_x')) 800 by 800\n"
177171
]
178172
}
179173
],
180174
"source": [
181-
"slc = yt.SlicePlot(ds, \"z\", [\"density\",\"velocity_x\",\"velocity_y\",\"velocity_magnitude\"])"
175+
"slc = yt.SlicePlot(\n",
176+
" ds,\n",
177+
" \"z\",\n",
178+
" fields=[\n",
179+
" (\"gas\", \"density\"),\n",
180+
" (\"gas\", \"velocity_x\"),\n",
181+
" (\"gas\", \"velocity_y\"),\n",
182+
" (\"gas\", \"velocity_magnitude\"),\n",
183+
" ]\n",
184+
")"
182185
]
183186
},
184187
{
185188
"cell_type": "code",
186-
"execution_count": 6,
189+
"execution_count": 8,
187190
"metadata": {
188191
"collapsed": false,
189192
"scrolled": false
@@ -203,10 +206,10 @@
203206
}
204207
],
205208
"source": [
206-
"slc.set_log(\"velocity_x\", False)\n",
207-
"slc.set_log(\"velocity_y\", False)\n",
208-
"slc.set_log(\"velocity_magnitude\", False)\n",
209-
"slc.set_unit(\"velocity_magnitude\", \"km/s\")\n",
209+
"slc.set_log((\"gas\", \"velocity_x\"), False)\n",
210+
"slc.set_log((\"gas\", \"velocity_y\"), False)\n",
211+
"slc.set_log((\"gas\", \"velocity_magnitude\"), False)\n",
212+
"slc.set_unit((\"gas\", \"velocity_magnitude\"), \"km/s\")\n",
210213
"slc.show()"
211214
]
212215
},
@@ -219,7 +222,7 @@
219222
},
220223
{
221224
"cell_type": "code",
222-
"execution_count": 7,
225+
"execution_count": 9,
223226
"metadata": {
224227
"collapsed": false
225228
},
@@ -238,7 +241,7 @@
238241
},
239242
{
240243
"cell_type": "code",
241-
"execution_count": 8,
244+
"execution_count": 10,
242245
"metadata": {
243246
"collapsed": false,
244247
"scrolled": true
@@ -265,7 +268,7 @@
265268
},
266269
{
267270
"cell_type": "code",
268-
"execution_count": 9,
271+
"execution_count": 11,
269272
"metadata": {
270273
"collapsed": false
271274
},
@@ -274,10 +277,7 @@
274277
"name": "stderr",
275278
"output_type": "stream",
276279
"text": [
277-
"yt : [INFO ] 2017-08-10 16:21:43,375 Making a FITS image of field density\n",
278-
"yt : [WARNING ] 2017-08-10 16:21:43,389 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
279-
"yt : [WARNING ] 2017-08-10 16:21:43,390 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
280-
"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"
280+
"yt : [INFO ] 2023-10-02 09:51:37,535 Making a FITS image of field density\n"
281281
]
282282
}
283283
],
@@ -294,22 +294,11 @@
294294
},
295295
{
296296
"cell_type": "code",
297-
"execution_count": 10,
297+
"execution_count": 12,
298298
"metadata": {
299299
"collapsed": false
300300
},
301-
"outputs": [
302-
{
303-
"name": "stderr",
304-
"output_type": "stream",
305-
"text": [
306-
"yt : [INFO ] 2017-08-10 16:21:43,619 Making a FITS image of field density\n",
307-
"yt : [WARNING ] 2017-08-10 16:21:43,629 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
308-
"yt : [WARNING ] 2017-08-10 16:21:43,629 update_all_headers is deprecated. Use update_header('all', key, value) instead.\n",
309-
"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"
310-
]
311-
}
312-
],
301+
"outputs": [],
313302
"source": [
314303
"sky_scale = (1.0, \"arcsec/kpc\")\n",
315304
"sky_center = (30., 45.) # RA, Dec in degrees\n",

0 commit comments

Comments
 (0)