[yt-svn] commit/yt: MatthewTurk: Merged in ngoldbaum/yt/yt-3.0 (pull request #956)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Jun 18 17:14:26 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/462244d11e33/
Changeset: 462244d11e33
Branch: yt-3.0
User: MatthewTurk
Date: 2014-06-19 02:14:12
Summary: Merged in ngoldbaum/yt/yt-3.0 (pull request #956)
Updating the bootcamp
Affected #: 18 files
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/1)_Introduction.ipynb
--- a/doc/source/bootcamp/1)_Introduction.ipynb
+++ b/doc/source/bootcamp/1)_Introduction.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": ""
+ "name": "",
+ "signature": "sha256:f098e81e1851a0884440b328147d51c2cbba40bdbe4c5946b6fe3fec15189c84"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -32,9 +33,40 @@
"5. Derived Fields and Profiles (IsolatedGalaxy dataset)\n",
"6. Volume Rendering (IsolatedGalaxy dataset)"
]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The following code will download the data needed for this tutorial automatically using `curl`. It may take some time so please wait when the kernel is busy. You will need to set `download_datasets` to True before using it."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "download_datasets = True\n",
+ "if download_datasets:\n",
+ " !curl -sSO http://yt-project.org/data/enzo_tiny_cosmology.tar\n",
+ " print \"Got enzo_tiny_cosmology\"\n",
+ " !tar xf enzo_tiny_cosmology.tar\n",
+ " \n",
+ " !curl -sSO http://yt-project.org/data/Enzo_64.tar\n",
+ " print \"Got Enzo_64\"\n",
+ " !tar xf Enzo_64.tar\n",
+ " \n",
+ " !curl -sSO http://yt-project.org/data/IsolatedGalaxy.tar\n",
+ " print \"Got IsolatedGalaxy\"\n",
+ " !tar xf IsolatedGalaxy.tar\n",
+ " \n",
+ " print \"All done!\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
}
],
"metadata": {}
}
]
-}
+}
\ No newline at end of file
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/2)_Data_Inspection.ipynb
--- a/doc/source/bootcamp/2)_Data_Inspection.ipynb
+++ b/doc/source/bootcamp/2)_Data_Inspection.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:15cdc35ddb8b1b938967237e17534149f734f4e7a61ebd37d74b675f8059da20"
+ "signature": "sha256:9d67e9e4ca5ce92dcd0658025dbfbd28be47b47ca8d4531fdac16cc2c2fa038b"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -21,7 +21,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "from yt.mods import *"
+ "import yt"
],
"language": "python",
"metadata": {},
@@ -38,7 +38,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ds = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")"
+ "ds = yt.load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")"
],
"language": "python",
"metadata": {},
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/3)_Simple_Visualization.ipynb
--- a/doc/source/bootcamp/3)_Simple_Visualization.ipynb
+++ b/doc/source/bootcamp/3)_Simple_Visualization.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:eb5fbf5eb55a9c8997c687f072c8c6030e74bef0048a72b4f74a06893c11b80a"
+ "signature": "sha256:c00ba7fdbbd9ea957d06060ad70f06f629b1fd4ebf5379c1fdad2697ab0a4cd6"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -21,7 +21,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "from yt.mods import *"
+ "import yt"
],
"language": "python",
"metadata": {},
@@ -38,7 +38,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ds = load(\"enzo_tiny_cosmology/DD0046/DD0046\")\n",
+ "ds = yt.load(\"enzo_tiny_cosmology/DD0046/DD0046\")\n",
"print \"Redshift =\", ds.current_redshift"
],
"language": "python",
@@ -58,7 +58,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "p = ProjectionPlot(ds, \"y\", \"density\")\n",
+ "p = yt.ProjectionPlot(ds, \"y\", \"density\")\n",
"p.show()"
],
"language": "python",
@@ -135,7 +135,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "p = ProjectionPlot(ds, \"z\", [\"density\", \"temperature\"], weight_field=\"density\")\n",
+ "p = yt.ProjectionPlot(ds, \"z\", [\"density\", \"temperature\"], weight_field=\"density\")\n",
"p.show()"
],
"language": "python",
@@ -189,8 +189,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ds = load(\"Enzo_64/DD0043/data0043\")\n",
- "s = SlicePlot(ds, \"z\", [\"density\", \"velocity_magnitude\"], center=\"max\")\n",
+ "ds = yt.load(\"Enzo_64/DD0043/data0043\")\n",
+ "s = yt.SlicePlot(ds, \"z\", [\"density\", \"velocity_magnitude\"], center=\"max\")\n",
"s.set_cmap(\"velocity_magnitude\", \"kamae\")\n",
"s.zoom(10.0)"
],
@@ -243,7 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "s = SlicePlot(ds, \"x\", [\"density\"], center=\"max\")\n",
+ "s = yt.SlicePlot(ds, \"x\", [\"density\"], center=\"max\")\n",
"s.annotate_contour(\"temperature\")\n",
"s.zoom(2.5)"
],
@@ -272,4 +272,4 @@
"metadata": {}
}
]
-}
+}
\ No newline at end of file
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/4)_Data_Objects_and_Time_Series.ipynb
--- a/doc/source/bootcamp/4)_Data_Objects_and_Time_Series.ipynb
+++ b/doc/source/bootcamp/4)_Data_Objects_and_Time_Series.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:41293a66cd6fd5eae6da2d0343549144dc53d72e83286999faab3cf21d801f51"
+ "signature": "sha256:a46e1baa90d32045c2b524100f28bad41b3665249612c9a275ee0375a6f4be20"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -22,7 +22,8 @@
"collapsed": false,
"input": [
"%matplotlib inline\n",
- "from yt.mods import *\n",
+ "import yt\n",
+ "import numpy as np\n",
"from matplotlib import pylab\n",
"from yt.analysis_modules.halo_finding.api import HaloFinder"
],
@@ -45,7 +46,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ts = DatasetSeries(\"enzo_tiny_cosmology/*/*.hierarchy\")"
+ "ts = yt.DatasetSeries(\"enzo_tiny_cosmology/*/*.hierarchy\")"
],
"language": "python",
"metadata": {},
@@ -87,8 +88,13 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "pylab.semilogy(times, rho_ex[:,0], '-xk')\n",
- "pylab.semilogy(times, rho_ex[:,1], '-xr')"
+ "pylab.semilogy(times, rho_ex[:,0], '-xk', label='Minimum')\n",
+ "pylab.semilogy(times, rho_ex[:,1], '-xr', label='Maximum')\n",
+ "pylab.ylabel(\"Density ($g/cm^3$)\")\n",
+ "pylab.xlabel(\"Time (Gyr)\")\n",
+ "pylab.legend()\n",
+ "pylab.ylim(1e-32, 1e-21)\n",
+ "pylab.show()"
],
"language": "python",
"metadata": {},
@@ -109,13 +115,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
+ "from yt.units import Msun\n",
+ "\n",
"mass = []\n",
"zs = []\n",
"for ds in ts:\n",
" halos = HaloFinder(ds)\n",
" dd = ds.all_data()\n",
" total_mass = dd.quantities.total_quantity(\"cell_mass\").in_units(\"Msun\")\n",
- " total_in_baryons = 0.0\n",
+ " total_in_baryons = 0.0*Msun\n",
" for halo in halos:\n",
" sp = halo.get_sphere()\n",
" total_in_baryons += sp.quantities.total_quantity(\"cell_mass\").in_units(\"Msun\")\n",
@@ -137,7 +145,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "pylab.loglog(zs, mass, '-xb')"
+ "pylab.semilogx(zs, mass, '-xb')\n",
+ "pylab.xlabel(\"Redshift\")\n",
+ "pylab.ylabel(\"Mass in halos / Total mass\")\n",
+ "pylab.xlim(max(zs), min(zs))\n",
+ "pylab.ylim(-0.01, .18)"
],
"language": "python",
"metadata": {},
@@ -155,7 +167,9 @@
"\n",
"yt provides the ability to examine rays, or lines, through the domain. Note that these are not periodic, unlike most other data objects. We create a ray object and can then examine quantities of it. Rays have the special fields `t` and `dts`, which correspond to the time the ray enters a given cell and the distance it travels through that cell.\n",
"\n",
- "To create a ray, we specify the start and end points."
+ "To create a ray, we specify the start and end points.\n",
+ "\n",
+ "Note that we need to convert these arrays to numpy arrays due to a bug in matplotlib 1.3.1."
]
},
{
@@ -163,7 +177,7 @@
"collapsed": false,
"input": [
"ray = ds.ray([0.1, 0.2, 0.3], [0.9, 0.8, 0.7])\n",
- "pylab.semilogy(ray[\"t\"], ray[\"density\"])"
+ "pylab.semilogy(np.array(ray[\"t\"]), np.array(ray[\"density\"]))"
],
"language": "python",
"metadata": {},
@@ -212,10 +226,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ds = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
+ "ds = yt.load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
"v, c = ds.find_max(\"density\")\n",
"sl = ds.slice(0, c[0])\n",
- "print sl[\"index\", \"x\"], sl[\"index\", \"z\"], sl[\"pdx\"]\n",
+ "print sl[\"index\", \"x\"]\n",
+ "print sl[\"index\", \"z\"]\n",
+ "print sl[\"pdx\"]\n",
"print sl[\"gas\", \"density\"].shape"
],
"language": "python",
@@ -251,8 +267,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "write_image(np.log10(frb[\"gas\", \"density\"]), \"temp.png\")\n",
- "from IPython.core.display import Image\n",
+ "yt.write_image(np.log10(frb[\"gas\", \"density\"]), \"temp.png\")\n",
+ "from IPython.display import Image\n",
"Image(filename = \"temp.png\")"
],
"language": "python",
@@ -275,7 +291,7 @@
"collapsed": false,
"input": [
"cp = ds.cutting([0.2, 0.3, 0.5], \"max\")\n",
- "pw = cp.to_pw(fields = [\"density\"])"
+ "pw = cp.to_pw(fields = [(\"gas\", \"density\")])"
],
"language": "python",
"metadata": {},
@@ -310,7 +326,8 @@
"collapsed": false,
"input": [
"pws = sl.to_pw(fields=[\"density\"])\n",
- "pws.show()"
+ "#pws.show()\n",
+ "print pws.plots.keys()"
],
"language": "python",
"metadata": {},
@@ -362,4 +379,4 @@
"metadata": {}
}
]
-}
+}
\ No newline at end of file
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/5)_Derived_Fields_and_Profiles.ipynb
--- a/doc/source/bootcamp/5)_Derived_Fields_and_Profiles.ipynb
+++ b/doc/source/bootcamp/5)_Derived_Fields_and_Profiles.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:a19d451f3b4dcfeed448caa22c2cac35c46958e0646c19c226b1e467b76d0718"
+ "signature": "sha256:eca573e749829cacda0a8c07c6d5d11d07a5de657563a44b8c4ffff8f735caed"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -22,7 +22,9 @@
"collapsed": false,
"input": [
"%matplotlib inline\n",
- "from yt.mods import *\n",
+ "import yt\n",
+ "import numpy as np\n",
+ "from yt import derived_field\n",
"from matplotlib import pylab"
],
"language": "python",
@@ -61,7 +63,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "ds = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
+ "ds = yt.load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
"dd = ds.all_data()\n",
"print dd.quantities.keys()"
],
@@ -120,7 +122,9 @@
"bv = sp.quantities.bulk_velocity()\n",
"L = sp.quantities.angular_momentum_vector()\n",
"rho_min, rho_max = sp.quantities.extrema(\"density\")\n",
- "print bv, L, rho_min, rho_max"
+ "print bv\n",
+ "print L\n",
+ "print rho_min, rho_max"
],
"language": "python",
"metadata": {},
@@ -143,9 +147,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "prof = Profile1D(sp, \"density\", 32, rho_min, rho_max, True, weight_field=\"cell_mass\")\n",
+ "prof = yt.Profile1D(sp, \"density\", 32, rho_min, rho_max, True, weight_field=\"cell_mass\")\n",
"prof.add_fields([\"temperature\",\"dinosaurs\"])\n",
- "pylab.loglog(np.array(prof.x), np.array(prof[\"temperature\"]), \"-x\")"
+ "pylab.loglog(np.array(prof.x), np.array(prof[\"temperature\"]), \"-x\")\n",
+ "pylab.xlabel('Density $(g/cm^3)$')\n",
+ "pylab.ylabel('Temperature $(K)$')"
],
"language": "python",
"metadata": {},
@@ -162,7 +168,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "pylab.loglog(np.array(prof.x), np.array(prof[\"dinosaurs\"]), '-x')"
+ "pylab.loglog(np.array(prof.x), np.array(prof[\"dinosaurs\"]), '-x')\n",
+ "pylab.xlabel('Density $(g/cm^3)$')\n",
+ "pylab.ylabel('Dinosaurs $(K cm / s)$')"
],
"language": "python",
"metadata": {},
@@ -179,9 +187,30 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "prof = Profile1D(sp, \"density\", 32, rho_min, rho_max, True, weight_field=None)\n",
+ "prof = yt.Profile1D(sp, \"density\", 32, rho_min, rho_max, True, weight_field=None)\n",
"prof.add_fields([\"cell_mass\"])\n",
- "pylab.loglog(np.array(prof.x), np.array(prof[\"cell_mass\"].in_units(\"Msun\")), '-x')"
+ "pylab.loglog(np.array(prof.x), np.array(prof[\"cell_mass\"].in_units(\"Msun\")), '-x')\n",
+ "pylab.xlabel('Density $(g/cm^3)$')\n",
+ "pylab.ylabel('Cell mass $(M_\\odot)$')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "In addition to the low-level `ProfileND` interface, it's also quite straightforward to quickly create plots of profiles using the `ProfilePlot` class. Let's redo the last plot using `ProfilePlot`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "prof = yt.ProfilePlot(sp, 'density', 'cell_mass', weight_field=None)\n",
+ "prof.set_unit('cell_mass', 'Msun')\n",
+ "prof.show()"
],
"language": "python",
"metadata": {},
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e doc/source/bootcamp/6)_Volume_Rendering.ipynb
--- a/doc/source/bootcamp/6)_Volume_Rendering.ipynb
+++ b/doc/source/bootcamp/6)_Volume_Rendering.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:2929940fc3977b495aa124dee851f7602d61e073ed65407dd95e7cf597684b35"
+ "signature": "sha256:2a24bbe82955f9d948b39cbd1b1302968ff57f62f73afb2c7a5c4953393d00ae"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -21,8 +21,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "from yt.mods import *\n",
- "ds = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")"
+ "import yt\n",
+ "ds = yt.load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")"
],
"language": "python",
"metadata": {},
@@ -43,7 +43,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "tf = ColorTransferFunction((-28, -24))\n",
+ "tf = yt.ColorTransferFunction((-28, -24))\n",
"tf.add_layers(4, w=0.01)\n",
"cam = ds.camera([0.5, 0.5, 0.5], [1.0, 1.0, 1.0], (20, 'kpc'), 512, tf, fields=[\"density\"])\n",
"cam.show()"
@@ -80,7 +80,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "tf = ColorTransferFunction((-28, -25))\n",
+ "tf = yt.ColorTransferFunction((-28, -25))\n",
"tf.add_layers(4, w=0.03)\n",
"cam = ds.camera([0.5, 0.5, 0.5], [1.0, 1.0, 1.0], (20.0, 'kpc'), 512, tf, no_ghost=False)\n",
"cam.show(clip_ratio=4.0)"
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/analysis_modules/halo_finding/halo_objects.py
--- a/yt/analysis_modules/halo_finding/halo_objects.py
+++ b/yt/analysis_modules/halo_finding/halo_objects.py
@@ -320,8 +320,7 @@
center = self.maximum_density_location()
radius = self.maximum_radius()
# A bit of a long-reach here...
- sphere = self.data.index.sphere(
- center, radius=radius)
+ sphere = self.data.pf.sphere(center, radius=radius)
return sphere
def get_size(self):
@@ -685,7 +684,7 @@
>>> ell = halos[0].get_ellipsoid()
"""
ep = self.get_ellipsoid_parameters()
- ell = self.data.index.ellipsoid(ep[0], ep[1], ep[2], ep[3],
+ ell = self.data.pf.ellipsoid(ep[0], ep[1], ep[2], ep[3],
ep[4], ep[5])
return ell
@@ -985,7 +984,7 @@
>>> ell = halos[0].get_ellipsoid()
"""
ep = self.get_ellipsoid_parameters()
- ell = self.pf.index.ellipsoid(ep[0], ep[1], ep[2], ep[3],
+ ell = self.pf.ellipsoid(ep[0], ep[1], ep[2], ep[3],
ep[4], ep[5])
return ell
@@ -1818,7 +1817,7 @@
def __init__(self, pf, ds, dm_only=True, padding=0.0):
ParallelAnalysisInterface.__init__(self)
self.pf = pf
- self.index = pf.h
+ self.index = pf.index
self.center = (np.array(ds.right_edge) + np.array(ds.left_edge)) / 2.0
def _parse_halolist(self, threshold_adjustment):
@@ -2128,11 +2127,11 @@
self.comm.mpi_bcast(self.bucket_bounds)
my_bounds = self.bucket_bounds[self.comm.rank]
LE, RE = my_bounds[0], my_bounds[1]
- self._data_source = self.index.region([0.] * 3, LE, RE)
+ self._data_source = self.pf.region([0.] * 3, LE, RE)
# If this isn't parallel, define the region as an AMRRegionStrict so
# particle IO works.
if self.comm.size == 1:
- self._data_source = self.index.region([0.5] * 3,
+ self._data_source = self.pf.region([0.5] * 3,
LE, RE)
# get the average spacing between particles for this region
# The except is for the serial case where the full box is what we want.
@@ -2487,7 +2486,7 @@
ds_RE = np.array(subvolume.right_edge)
self.period = pf.domain_right_edge - pf.domain_left_edge
self.pf = pf
- self.index = pf.h
+ self.index = pf.index
self.redshift = pf.current_redshift
self._data_source = pf.h.all_data()
GenericHaloFinder.__init__(self, pf, self._data_source, dm_only,
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -751,16 +751,19 @@
return field
def _get_pw(self, fields, center, width, origin, plot_type):
- axis = self.axis
- self.fields = [k for k in self.field_data
- if k not in self._key_fields]
from yt.visualization.plot_window import \
get_window_parameters, PWViewerMPL
- from yt.visualization.fixed_resolution import FixedResolutionBuffer
+ from yt.visualization.fixed_resolution import FixedResolutionBuffer as frb
+ axis = self.axis
+ skip = self._key_fields
+ skip += list(set(frb._exclude_fields).difference(set(self._key_fields)))
+ self.fields = ensure_list(fields) + \
+ [k for k in self.field_data if k not in skip]
(bounds, center) = get_window_parameters(axis, center, width, self.pf)
- pw = PWViewerMPL(self, bounds, fields=list(self.fields), origin=origin,
- frb_generator=FixedResolutionBuffer,
+ pw = PWViewerMPL(self, bounds, fields=self.fields, origin=origin,
+ frb_generator=frb,
plot_type=plot_type)
+ pw._setup_plots()
return pw
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/data_objects/selection_data_containers.py
--- a/yt/data_objects/selection_data_containers.py
+++ b/yt/data_objects/selection_data_containers.py
@@ -397,8 +397,8 @@
"""
normal = self.normal
center = self.center
- self.fields = [k for k in self.field_data.keys()
- if k not in self._key_fields]
+ self.fields = ensure_list(fields) + [k for k in self.field_data.keys()
+ if k not in self._key_fields]
from yt.visualization.plot_window import get_oblique_window_parameters, PWViewerMPL
from yt.visualization.fixed_resolution import ObliqueFixedResolutionBuffer
(bounds, center_rot) = get_oblique_window_parameters(normal, center, width, self.pf)
@@ -409,6 +409,7 @@
plot_type='OffAxisSlice')
if axes_unit is not None:
pw.set_axes_unit(axes_unit)
+ pw._setup_plots()
return pw
def to_frb(self, width, resolution, height=None):
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/data_objects/tests/test_cutting_plane.py
--- a/yt/data_objects/tests/test_cutting_plane.py
+++ b/yt/data_objects/tests/test_cutting_plane.py
@@ -29,11 +29,12 @@
yield assert_equal, cut["ones"].sum(), cut["ones"].size
yield assert_equal, cut["ones"].min(), 1.0
yield assert_equal, cut["ones"].max(), 1.0
- pw = cut.to_pw()
- tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
- os.close(tmpfd)
- pw.save(name=tmpname)
- fns.append(tmpname)
+ pw = cut.to_pw(fields='density')
+ for p in pw.plots.values():
+ tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
+ os.close(tmpfd)
+ p.save(name=tmpname)
+ fns.append(tmpname)
frb = cut.to_frb((1.0, 'unitary'), 64)
for cut_field in ['ones', 'density']:
fi = pf._get_field_info("unknown", cut_field)
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/data_objects/tests/test_projection.py
--- a/yt/data_objects/tests/test_projection.py
+++ b/yt/data_objects/tests/test_projection.py
@@ -48,11 +48,12 @@
yield assert_equal, np.unique(proj["py"]), uc[yax]
yield assert_equal, np.unique(proj["pdx"]), 1.0/(dims[xax]*2.0)
yield assert_equal, np.unique(proj["pdy"]), 1.0/(dims[yax]*2.0)
- pw = proj.to_pw()
- tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
- os.close(tmpfd)
- pw.save(name=tmpname)
- fns.append(tmpname)
+ pw = proj.to_pw(fields='density')
+ for p in pw.plots.values():
+ tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
+ os.close(tmpfd)
+ p.save(name=tmpname)
+ fns.append(tmpname)
frb = proj.to_frb((1.0, 'unitary'), 64)
for proj_field in ['ones', 'density']:
fi = pf._get_field_info(proj_field)
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/data_objects/tests/test_slice.py
--- a/yt/data_objects/tests/test_slice.py
+++ b/yt/data_objects/tests/test_slice.py
@@ -59,11 +59,12 @@
yield assert_equal, np.unique(slc["py"]), uc[yax]
yield assert_equal, np.unique(slc["pdx"]), 0.5 / dims[xax]
yield assert_equal, np.unique(slc["pdy"]), 0.5 / dims[yax]
- pw = slc.to_pw()
- tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
- os.close(tmpfd)
- pw.save(name=tmpname)
- fns.append(tmpname)
+ pw = slc.to_pw(fields='density')
+ for p in pw.plots.values():
+ tmpfd, tmpname = tempfile.mkstemp(suffix='.png')
+ os.close(tmpfd)
+ p.save(name=tmpname)
+ fns.append(tmpname)
frb = slc.to_frb((1.0, 'unitary'), 64)
for slc_field in ['ones', 'density']:
fi = pf._get_field_info(slc_field)
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/utilities/parallel_tools/parallel_analysis_interface.py
--- a/yt/utilities/parallel_tools/parallel_analysis_interface.py
+++ b/yt/utilities/parallel_tools/parallel_analysis_interface.py
@@ -1081,7 +1081,7 @@
RE[yax] = y[1] * (DRE[yax]-DLE[yax]) + DLE[yax]
mylog.debug("Dimensions: %s %s", LE, RE)
- reg = self.index.region(self.center, LE, RE)
+ reg = self.pf.region(self.center, LE, RE)
return True, reg
def partition_index_3d(self, ds, padding=0.0, rank_ratio = 1):
@@ -1097,7 +1097,7 @@
return False, LE, RE, ds
if not self._distributed and subvol:
return True, LE, RE, \
- self.index.region(self.center, LE-padding, RE+padding)
+ self.pf.region(self.center, LE-padding, RE+padding)
elif ytcfg.getboolean("yt", "inline"):
# At this point, we want to identify the root grid tile to which
# this processor is assigned.
@@ -1110,7 +1110,7 @@
#raise KeyError
LE = root_grids[0].LeftEdge
RE = root_grids[0].RightEdge
- return True, LE, RE, self.index.region(self.center, LE, RE)
+ return True, LE, RE, self.pf.region(self.center, LE, RE)
cc = MPI.Compute_dims(self.comm.size / rank_ratio, 3)
mi = self.comm.rank % (self.comm.size / rank_ratio)
@@ -1124,10 +1124,10 @@
if padding > 0:
return True, \
- LE, RE, self.index.region(self.center,
+ LE, RE, self.pf.region(self.center,
LE-padding, RE+padding)
- return False, LE, RE, self.index.region(self.center, LE, RE)
+ return False, LE, RE, self.pf.region(self.center, LE, RE)
def partition_region_3d(self, left_edge, right_edge, padding=0.0,
rank_ratio = 1):
@@ -1152,10 +1152,10 @@
if padding > 0:
return True, \
- LE, RE, self.index.region(self.center, LE-padding,
+ LE, RE, self.pf.region(self.center, LE-padding,
RE+padding)
- return False, LE, RE, self.index.region(self.center, LE, RE)
+ return False, LE, RE, self.pf.region(self.center, LE, RE)
def partition_index_3d_bisection_list(self):
"""
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/visualization/base_plot_types.py
--- a/yt/visualization/base_plot_types.py
+++ b/yt/visualization/base_plot_types.py
@@ -62,8 +62,11 @@
self.axes = axes
self.canvas = FigureCanvasAgg(self.figure)
- def save(self, name, mpl_kwargs, canvas=None):
+ def save(self, name, mpl_kwargs=None, canvas=None):
"""Choose backend and save image to disk"""
+ if mpl_kwargs is None:
+ mpl_kwargs = {}
+
suffix = get_image_suffix(name)
if suffix == '':
suffix = '.png'
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -78,7 +78,8 @@
>>> print frb1["Temperature"].max()
104923.1
"""
- _exclude_fields = ('pz','pdz','dx','x','y','z')
+ _exclude_fields = ('pz','pdz','dx','x','y','z',
+ ('index','dx'),('index','x'),('index','y'),('index','z'))
def __init__(self, data_source, bounds, buff_size, antialias = True,
periodic = False):
self.data_source = data_source
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py
+++ b/yt/visualization/image_writer.py
@@ -411,8 +411,8 @@
from IPython.core.displaypub import publish_display_data
data = write_bitmap(image, None, max_val=max_val)
publish_display_data(
- 'yt.visualization.image_writer.display_in_notebook',
- {'image/png' : data}
+ data={'image/png': data},
+ source='yt.visualization.image_writer.display_in_notebook',
)
else:
raise YTNotInsideNotebook
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -291,7 +291,7 @@
else:
fields = ensure_list(fields)
self.override_fields = list(set(fields).intersection(set(skip)))
- self.fields = fields
+ self.fields = [f for f in fields if f not in skip]
super(PlotWindow, self).__init__(data_source, window_size, fontsize)
self._set_window(bounds) # this automatically updates the data and plot
self.origin = origin
@@ -300,7 +300,7 @@
range(len(self.data_source.center))
if i != self.data_source.axis]
self.set_center(center)
- for field in self.frb.data.keys():
+ for field in self.data_source._determine_fields(self.frb.data.keys()):
finfo = self.data_source.pf._get_field_info(*field)
if finfo.take_log:
self._field_transform[field] = log_transform
@@ -768,7 +768,7 @@
def _setup_plots(self):
self._colorbar_valid = True
- for f in self.data_source._determine_fields(self.fields):
+ for f in list(set(self.data_source._determine_fields(self.fields))):
axis_index = self.data_source.axis
xc, yc = self._setup_origin()
diff -r 88bcdc5ae09cfa02cca341c77bf10e457c3dccb9 -r 462244d11e3315d3098cc411cf7a9cd0b824764e yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -744,8 +744,8 @@
if clip_ratio is not None: clip_ratio *= image.std()
data = write_bitmap(image, None, clip_ratio)
publish_display_data(
- 'yt.visualization.volume_rendering.camera.Camera',
- {'image/png' : data}
+ data={'image/png': data},
+ source='yt.visualization.volume_rendering.camera.Camera',
)
else:
raise YTNotInsideNotebook
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