[yt-svn] commit/yt: jzuhone: Merged in ngoldbaum/yt (pull request #2262)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Jul 20 09:05:19 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/b3f018f29a22/
Changeset: b3f018f29a22
Branch: yt
User: jzuhone
Date: 2016-07-20 16:04:42+00:00
Summary: Merged in ngoldbaum/yt (pull request #2262)
Update volume rendering example in generic array data notebook. Closes #1234
Affected #: 1 file
diff -r 1559e804fe54bb109f60e4af6e983be68b10c1f6 -r b3f018f29a22e04e36c41ba6537accd8c167f11c doc/source/examining/Loading_Generic_Array_Data.ipynb
--- a/doc/source/examining/Loading_Generic_Array_Data.ipynb
+++ b/doc/source/examining/Loading_Generic_Array_Data.ipynb
@@ -41,7 +41,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import yt\n",
@@ -58,7 +60,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"arr = np.random.random(size=(64,64,64))"
@@ -74,7 +78,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"data = dict(density = (arr, \"g/cm**3\"))\n",
@@ -118,7 +124,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds, \"z\", [\"density\"])\n",
@@ -140,7 +148,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"posx_arr = np.random.uniform(low=-1.5, high=1.5, size=10000)\n",
@@ -167,7 +177,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds, \"z\", [\"density\"])\n",
@@ -193,7 +205,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import h5py\n",
@@ -213,7 +227,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"print (f.keys())"
@@ -229,7 +245,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"units = [\"gauss\",\"gauss\",\"gauss\", \"g/cm**3\", \"erg/cm**3\", \"K\", \n",
@@ -246,7 +264,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"data = {k:(v.value,u) for (k,v), u in zip(f.items(),units)}\n",
@@ -256,7 +276,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"ds = yt.load_uniform_grid(data, data[\"Density\"][0].shape, length_unit=250.*cm_per_kpc, bbox=bbox, nprocs=8, \n",
@@ -273,7 +295,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"prj = yt.ProjectionPlot(ds, \"z\", [\"z-velocity\",\"Temperature\",\"Bx\"], weight_field=\"Density\")\n",
@@ -299,7 +323,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"#Find the min and max of the field\n",
@@ -313,29 +339,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Create a Transfer Function that goes from the minimum to the maximum of the data:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "tf = yt.ColorTransferFunction((mi, ma), grey_opacity=False)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
"Define the properties and size of the `camera` viewport:"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"# Choose a vector representing the viewing direction.\n",
@@ -358,24 +370,41 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
- "cam = ds.camera(c, L, W, Npixels, tf, fields=['Temperature'],\n",
- " north_vector=[0,0,1], steady_north=True, \n",
- " sub_samples=5, log_fields=[False])\n",
+ "sc = yt.create_scene(ds, 'Temperature')\n",
+ "dd = ds.all_data()\n",
"\n",
- "cam.transfer_function.map_to_colormap(mi,ma, \n",
- " scale=15.0, colormap='algae')"
+ "source = sc[0]\n",
+ "\n",
+ "source.log_field = False\n",
+ "\n",
+ "tf = yt.ColorTransferFunction((mi, ma), grey_opacity=False)\n",
+ "tf.map_to_colormap(mi, ma, scale=15.0, colormap='algae')\n",
+ "\n",
+ "source.set_transfer_function(tf)\n",
+ "\n",
+ "sc.add_source(source)\n",
+ "\n",
+ "cam = sc.add_camera()\n",
+ "cam.width = W\n",
+ "cam.center = c\n",
+ "cam.normal_vector = L\n",
+ "cam.north_vector = [0, 0, 1]"
]
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
- "cam.show()"
+ "sc.show(sigma_clip=4)"
]
},
{
@@ -395,7 +424,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import astropy.io.fits as pyfits\n",
@@ -412,7 +443,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"f = pyfits.open(data_dir+\"/UnigridData/velocity_field_20.fits\")\n",
@@ -429,7 +462,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"data = {}\n",
@@ -449,7 +484,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"data[\"velocity_x\"] = data.pop(\"x-velocity\")\n",
@@ -467,7 +504,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"ds = yt.load_uniform_grid(data, data[\"velocity_x\"][0].shape, length_unit=(1.0,\"Mpc\"))\n",
@@ -495,7 +534,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"grid_data = [\n",
@@ -520,7 +561,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"for g in grid_data: \n",
@@ -538,7 +581,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"grid_data[0][\"number_of_particles\"] = 0 # Set no particles in the top-level grid\n",
@@ -561,7 +606,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"ds = yt.load_amr_grids(grid_data, [32, 32, 32])"
@@ -577,7 +624,9 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [],
"source": [
"slc = yt.SlicePlot(ds, \"z\", [\"density\"])\n",
@@ -613,7 +662,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
- "version": 3.0
+ "version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
@@ -625,4 +674,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
-}
\ No newline at end of file
+}
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list