[yt-svn] commit/yt: 15 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Mar 25 12:42:35 PDT 2014
15 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/a32e594142e4/
Changeset: a32e594142e4
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:01:08
Summary: Suppress astropy warnings when we attempt to load non-FITS files.
Affected #: 1 file
diff -r bc7abe74aa1e1bc01d6cbf0697733fd70ffe9cdd -r a32e594142e43e025b3b5e79d0712fa203dd9780 yt/frontends/fits/data_structures.py
--- a/yt/frontends/fits/data_structures.py
+++ b/yt/frontends/fits/data_structures.py
@@ -19,6 +19,7 @@
import stat
import numpy as np
import weakref
+import warnings
from yt.config import ytcfg
from yt.funcs import *
@@ -250,7 +251,9 @@
except:
pass
try:
- fileh = pyfits.open(args[0])
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=UserWarning, append=True)
+ fileh = pyfits.open(args[0])
for h in fileh:
if h.is_image and h.data is not None:
fileh.close()
https://bitbucket.org/yt_analysis/yt/commits/2c013e8a48a8/
Changeset: 2c013e8a48a8
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:50:40
Summary: Updating the sphinx extensions for runipy 0.0.8
Affected #: 2 files
diff -r a32e594142e43e025b3b5e79d0712fa203dd9780 -r 2c013e8a48a8d3b542b039a65dc26c19b898cb20 doc/extensions/notebook_sphinxext.py
--- a/doc/extensions/notebook_sphinxext.py
+++ b/doc/extensions/notebook_sphinxext.py
@@ -1,9 +1,10 @@
-import os, shutil, string, glob
+import os, shutil, string, glob, re
from sphinx.util.compat import Directive
from docutils import nodes
from docutils.parsers.rst import directives
from IPython.nbconvert import html, python
-from runipy.notebook_runner import NotebookRunner
+from IPython.nbformat.current import read, write
+from runipy.notebook_runner import NotebookRunner, NotebookError
class NotebookDirective(Directive):
"""Insert an evaluated notebook into a document
@@ -57,12 +58,8 @@
skip_exceptions = 'skip_exceptions' in self.options
- try:
- evaluated_text = evaluate_notebook(nb_abs_path, dest_path_eval,
- skip_exceptions=skip_exceptions)
- except:
- # bail
- return []
+ evaluated_text = evaluate_notebook(nb_abs_path, dest_path_eval,
+ skip_exceptions=skip_exceptions)
# Create link to notebook and script files
link_rst = "(" + \
@@ -138,11 +135,20 @@
# Create evaluated version and save it to the dest path.
# Always use --pylab so figures appear inline
# perhaps this is questionable?
- nb_runner = NotebookRunner(nb_path, pylab=False)
- nb_runner.run_notebook(skip_exceptions=skip_exceptions)
+ notebook = read(open(nb_path), 'json')
+ nb_runner = NotebookRunner(notebook, pylab=False)
+ try:
+ nb_runner.run_notebook(skip_exceptions=skip_exceptions)
+ except NotebookError as e:
+ print ''
+ print e
+ # Return the traceback, filtering out ANSI color codes.
+ # http://stackoverflow.com/questions/13506033/filtering-out-ansi-escape-sequences
+ return 'Notebook conversion failed with the following traceback: \n%s' % \
+ re.sub(r'\\033[\[\]]([0-9]{1,2}([;@][0-9]{0,2})*)*[mKP]?', '', str(e))
if dest_path is None:
dest_path = 'temp_evaluated.ipynb'
- nb_runner.save_notebook(dest_path)
+ write(nb_runner.nb, open(dest_path, 'w'), 'json')
ret = nb_to_html(dest_path)
if dest_path is 'temp_evaluated.ipynb':
os.remove(dest_path)
diff -r a32e594142e43e025b3b5e79d0712fa203dd9780 -r 2c013e8a48a8d3b542b039a65dc26c19b898cb20 doc/extensions/notebookcell_sphinxext.py
--- a/doc/extensions/notebookcell_sphinxext.py
+++ b/doc/extensions/notebookcell_sphinxext.py
@@ -35,12 +35,7 @@
skip_exceptions = 'skip_exceptions' in self.options
- try:
- evaluated_text = \
- evaluate_notebook('temp.ipynb', skip_exceptions=skip_exceptions)
- except:
- # bail
- return []
+ evaluated_text = evaluate_notebook('temp.ipynb', skip_exceptions=skip_exceptions)
# create notebook node
attributes = {'format': 'html', 'source': 'nb_path'}
https://bitbucket.org/yt_analysis/yt/commits/ea4deebebefd/
Changeset: ea4deebebefd
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:51:22
Summary: Updating python-script recipe in data object docs.
Affected #: 1 file
diff -r 2c013e8a48a8d3b542b039a65dc26c19b898cb20 -r ea4deebebefd8910c7c6feb323a66ed18174717b doc/source/analyzing/objects.rst
--- a/doc/source/analyzing/objects.rst
+++ b/doc/source/analyzing/objects.rst
@@ -242,15 +242,15 @@
.. notebook-cell::
from yt.mods import *
- pf = load("enzo_tiny_cosmology/DD0046/DD0046")
- ad = pf.h.all_data()
- total_mass = ad.quantities["TotalQuantity"]("cell_mass")
+ ds = load("enzo_tiny_cosmology/DD0046/DD0046")
+ ad = ds.all_data()
+ total_mass = ad.quantities.total_mass()
# now select only gas with 1e5 K < T < 1e7 K.
new_region = ad.cut_region(['obj["temperature"] > 1e5',
'obj["temperature"] < 1e7'])
- cut_mass = new_region.quantities["TotalQuantity"]("cell_mass")
+ cut_mass = new_region.quantities.total_mass()
print "The fraction of mass in this temperature range is %f." % \
- (cut_mass[0] / total_mass[0])
+ (cut_mass / total_mass)
The ``cut_region`` function generates a new object containing only the cells
that meet all of the specified criteria. The sole argument to ``cut_region``
https://bitbucket.org/yt_analysis/yt/commits/3b1297a2a208/
Changeset: 3b1297a2a208
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:53:01
Summary: Fixing docs notebooks and bringing them up to date.
Affected #: 4 files
diff -r ea4deebebefd8910c7c6feb323a66ed18174717b -r 3b1297a2a2086185eb452c3df57a1e17d95f523c doc/source/bootcamp/3)_Simple_Visualization.ipynb
--- a/doc/source/bootcamp/3)_Simple_Visualization.ipynb
+++ b/doc/source/bootcamp/3)_Simple_Visualization.ipynb
@@ -243,7 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "s = SlicePlot(pf, \"x\", [\"density\"], center=\"max\")\n",
+ "s = 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 ea4deebebefd8910c7c6feb323a66ed18174717b -r 3b1297a2a2086185eb452c3df57a1e17d95f523c 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
@@ -68,7 +68,7 @@
"for ds in ts:\n",
" dd = ds.all_data()\n",
" rho_ex.append(dd.quantities.extrema(\"density\"))\n",
- " times.append(pf.current_time.in_units(\"Gyr\"))\n",
+ " times.append(ds.current_time.in_units(\"Gyr\"))\n",
"rho_ex = np.array(rho_ex)"
],
"language": "python",
@@ -211,7 +211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "pf = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
+ "ds = 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",
@@ -361,4 +361,4 @@
"metadata": {}
}
]
-}
\ No newline at end of file
+}
diff -r ea4deebebefd8910c7c6feb323a66ed18174717b -r 3b1297a2a2086185eb452c3df57a1e17d95f523c doc/source/cookbook/embedded_javascript_animation.ipynb
--- a/doc/source/cookbook/embedded_javascript_animation.ipynb
+++ b/doc/source/cookbook/embedded_javascript_animation.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:578ca4fbc3831e9093489f06939abce9cde845b6cf75d901a3c429abc270f550"
+ "signature": "sha256:4f7d409d15ecc538096d15212923312e2cb4a911ebf5a9cf7edc9bd63a8335e9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -47,7 +47,8 @@
"import matplotlib.pyplot as plt\n",
"from matplotlib.backends.backend_agg import FigureCanvasAgg\n",
"\n",
- "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'mpccm'))\n",
+ "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'Mpccm'))\n",
+ "prj.set_figure_size(5)\n",
"prj.set_zlim('density',1e-32,1e-26)\n",
"fig = prj.plots['density'].figure\n",
"fig.canvas = FigureCanvasAgg(fig)\n",
diff -r ea4deebebefd8910c7c6feb323a66ed18174717b -r 3b1297a2a2086185eb452c3df57a1e17d95f523c doc/source/cookbook/embedded_webm_animation.ipynb
--- a/doc/source/cookbook/embedded_webm_animation.ipynb
+++ b/doc/source/cookbook/embedded_webm_animation.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:67844f8c2c184fc51aa62440cc05623ee85f252edde6faaa0d7b6617c3f33dfe"
+ "signature": "sha256:0090176ae6299b2310bf613404cbfbb42a54e19a03d1469d1429a01170a63aa0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -96,7 +96,7 @@
"import matplotlib.pyplot as plt\n",
"from matplotlib.backends.backend_agg import FigureCanvasAgg\n",
"\n",
- "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'mpccm'))\n",
+ "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'Mpccm'))\n",
"prj.set_zlim('density',1e-32,1e-26)\n",
"fig = prj.plots['density'].figure\n",
"fig.canvas = FigureCanvasAgg(fig)\n",
https://bitbucket.org/yt_analysis/yt/commits/1b8b4513074b/
Changeset: 1b8b4513074b
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:54:16
Summary: Removing or fixing modules that are no longer in 3.0 or were misnamed in the API docs.
Affected #: 1 file
diff -r 3b1297a2a2086185eb452c3df57a1e17d95f523c -r 1b8b4513074bc864fbd9c570bac1d8465be7a5a3 doc/source/reference/api/api.rst
--- a/doc/source/reference/api/api.rst
+++ b/doc/source/reference/api/api.rst
@@ -604,13 +604,12 @@
~yt.data_objects.derived_quantities.DerivedQuantity
~yt.data_objects.derived_quantities.DerivedQuantityCollection
- ~yt.data_objects.derived_quantities.WeightedAverage
- ~yt.data_objects.derived_quantities.TotalValue
+ ~yt.data_objects.derived_quantities.WeightedAverageQuantity
+ ~yt.data_objects.derived_quantities.TotalQuantity
~yt.data_objects.derived_quantities.TotalMass
~yt.data_objects.derived_quantities.CenterOfMass
~yt.data_objects.derived_quantities.BulkVelocity
~yt.data_objects.derived_quantities.AngularMomentumVector
- ~yt.data_objects.derived_quantities.ParticleAngularMomentumVector
~yt.data_objects.derived_quantities.Extrema
~yt.data_objects.derived_quantities.MaxLocation
~yt.data_objects.derived_quantities.MinLocation
@@ -719,12 +718,11 @@
~yt.config.YTConfigParser
~yt.utilities.parameter_file_storage.ParameterFileStore
- ~yt.data_objects.data_containers.FakeGridForParticles
~yt.utilities.parallel_tools.parallel_analysis_interface.ObjectIterator
~yt.utilities.parallel_tools.parallel_analysis_interface.ParallelAnalysisInterface
~yt.utilities.parallel_tools.parallel_analysis_interface.ParallelObjectIterator
- ~yt.analysis_modules.index_subset.index_subset.ConstructedRootGrid
- ~yt.analysis_modules.index_subset.index_subset.ExtractedHierarchy
+ ~yt.analysis_modules.hierarchy_subset.hierarchy_subset.ConstructedRootGrid
+ ~yt.analysis_modules.hierarchy_subset.hierarchy_subset.ExtractedHierarchy
Testing Infrastructure
https://bitbucket.org/yt_analysis/yt/commits/8cd5965195c1/
Changeset: 8cd5965195c1
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:54:44
Summary: Updating the visualization docs.
Affected #: 4 files
diff -r 1b8b4513074bc864fbd9c570bac1d8465be7a5a3 -r 8cd5965195c17904ffc420cfdfdbf430befbc312 doc/source/visualizing/_cb_docstrings.inc
--- a/doc/source/visualizing/_cb_docstrings.inc
+++ b/doc/source/visualizing/_cb_docstrings.inc
@@ -9,9 +9,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'), center='max')
- slc.annotate_arrow((0.53, 0.53, 0.53), 1/pf['kpc'])
+ slc.annotate_arrow((0.5, 0.5, 0.5), (1, 'kpc'))
slc.save()
-------------
@@ -30,7 +30,7 @@
pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
data_source = pf.disk([0.5, 0.5, 0.5], [0., 0., 1.],
- 8./pf.units['kpc'], 1./pf.units['kpc'])
+ (8., 'kpc'), (1., 'kpc'))
c_min = 10**na.floor(na.log10(data_source['density']).min() )
c_max = 10**na.floor(na.log10(data_source['density']).max()+1)
@@ -79,7 +79,7 @@
from yt.mods import *
pf = load("Enzo_64/DD0043/data0043")
s = OffAxisSlicePlot(pf, [1,1,0], ["density"], center="c")
- s.annotate_cquiver('CuttingPlaneVelocityX', 'CuttingPlaneVelocityY', 10)
+ s.annotate_cquiver('cutting_plane_velocity_x', 'cutting_plane_velocity_y', 10)
s.zoom(1.5)
s.save()
@@ -97,7 +97,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'), center='max')
slc.annotate_grids()
slc.save()
@@ -153,7 +153,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_image_line((0.3, 0.4), (0.8, 0.9), plot_args={'linewidth':5})
p.save()
@@ -169,7 +169,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_line([-6, -4, -2, 0, 2, 4, 6], [3.6, 1.6, 0.4, 0, 0.4, 1.6, 3.6], plot_args={'linewidth':5})
p.save()
@@ -212,9 +212,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
s = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- s.annotate_marker([0.53, 0.53, 0.53], plot_args={'s':10000})
+ s.annotate_marker([0.5, 0.5, 0.5], plot_args={'s':10000})
s.save()
-------------
@@ -237,7 +237,7 @@
from yt.mods import *
pf = load("Enzo_64/DD0043/data0043")
p = ProjectionPlot(pf, "x", "density", center='m', width=(10, 'Mpc'))
- p.annotate_particles(10/pf['Mpc'])
+ p.annotate_particles((10, 'Mpc'))
p.save()
-------------
@@ -253,9 +253,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- p.annotate_point([0.53, 0.526, 0.53], "What's going on here?", text_args={'size':'xx-large', 'color':'w'})
+ p.annotate_point([0.5, 0.496, 0.5], "What's going on here?", text_args={'size':'xx-large', 'color':'w'})
p.save()
-------------
@@ -273,8 +273,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53],
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center=[0.5, 0.5, 0.5],
weight_field='density', width=(20, 'kpc'))
p.annotate_quiver('velocity_x', 'velocity_y', 16)
p.save()
@@ -292,9 +292,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
- p.annotate_sphere([0.53, 0.53, 0.53], 2/pf['kpc'], {'fill':True})
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
+ p.annotate_sphere([0.5, 0.5, 0.5], (2, 'kpc'), {'fill':True})
p.save()
-------------
@@ -314,8 +314,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- s = SlicePlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ s = SlicePlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
s.annotate_streamlines('velocity_x', 'velocity_y')
s.save()
@@ -333,9 +333,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
s = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- s.annotate_text((0.53, 0.53), 'Sample text', text_args={'size':'xx-large', 'color':'w'})
+ s.annotate_text((0.5, 0.5), 'Sample text', text_args={'size':'xx-large', 'color':'w'})
s.save()
-------------
@@ -349,8 +349,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
p.annotate_title('Density plot')
p.save()
@@ -373,7 +373,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_velocity()
p.save()
diff -r 1b8b4513074bc864fbd9c570bac1d8465be7a5a3 -r 8cd5965195c17904ffc420cfdfdbf430befbc312 doc/source/visualizing/manual_plotting.rst
--- a/doc/source/visualizing/manual_plotting.rst
+++ b/doc/source/visualizing/manual_plotting.rst
@@ -39,13 +39,13 @@
pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
c = pf.h.find_max('density')[1]
- proj = pf.proj(0, 'density')
+ proj = pf.proj('density', 0)
- width = 10/pf['kpc'] # we want a 1.5 mpc view
+ width = (10, 'kpc') # we want a 1.5 mpc view
res = [1000, 1000] # create an image with 1000x1000 pixels
frb = proj.to_frb(width, res, center=c)
- P.imshow(frb['density'])
+ P.imshow(np.array(frb['density']))
P.savefig('my_perfect_figure.png')
The FRB is a very small object that can be deleted and recreated quickly (in
@@ -76,10 +76,10 @@
ray = pf.ortho_ray(ax, (c[1], c[2])) # cutting through the y0,z0 such that we hit the max density
P.subplot(211)
- P.semilogy(ray['x'], ray['density'])
+ P.semilogy(np.array(ray['x']), np.array(ray['density']))
P.ylabel('density')
P.subplot(212)
- P.semilogy(ray['x'], ray['temperature'])
+ P.semilogy(np.array(ray['x']), np.array(ray['temperature']))
P.xlabel('x')
P.ylabel('temperature')
diff -r 1b8b4513074bc864fbd9c570bac1d8465be7a5a3 -r 8cd5965195c17904ffc420cfdfdbf430befbc312 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -108,13 +108,13 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20,'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', center=[0.5, 0.5, 0.5], width=(20,'kpc'))
slc.save()
The above example will display an annotated plot of a slice of the
Density field in a 20 kpc square window centered on the coordinate
-(0.53,0.53) in the x-y plane. The axis to slice along is keyed to the
+(0.5, 0.5, 0.5) in the x-y plane. The axis to slice along is keyed to the
letter 'z', corresponding to the z-axis. Finally, the image is saved to
a png file.
@@ -124,18 +124,19 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z','Pressure', center=[0.53, 0.53, 0.53])
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'pressure', center='c')
slc.save()
slc.zoom(30)
slc.save('zoom')
-will save a slice of the pressure field in a slice along the z
+will save a plot of the pressure field in a slice along the z
axis across the entire simulation domain followed by another plot that
is zoomed in by a factor of 30 with respect to the original
-image. With these sorts of manipulations, one can easily pan and zoom
-onto an interesting region in the simulation and adjust the
-boundaries of the region to visualize on the fly.
+image. Both plots will be centered on the center of the simulation box.
+With these sorts of manipulations, one can easily pan and zoom onto an
+interesting region in the simulation and adjust the boundaries of the
+region to visualize on the fly.
A slice object can also add annotations like a title, an overlying
quiver plot, the location of grid boundaries, halo-finder annotations,
@@ -145,12 +146,12 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.annotate_grids()
slc.save()
-will plot the VorticitySquared in a 10 kiloparsec slice through the
+will plot the density field in a 10 kiloparsec slice through the
z-axis centered on the highest density point in the simulation domain.
Before saving the plot, the script annotates it with the grid
boundaries, which are drawn as thick black lines by default.
@@ -174,9 +175,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- prj = ProjectionPlot(pf, 2, 'density', center=[0.53, 0.53, 0.53],
- width=(25, 'kpc'), weight_field=None)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ prj = ProjectionPlot(pf, 2, 'density', width=(25, 'kpc'),
+ weight_field=None)
prj.save()
will create a projection of Density field along the x axis, plot it,
@@ -205,11 +206,11 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
- cut = OffAxisSlicePlot(pf, L, 'density', width=(25, 'kpc'),
- center=[0.53, 0.53, 0.53], north_vector=north_vector)
+ cut = OffAxisSlicePlot(pf, L, 'density', width=(25, 'kpc'),
+ north_vector=north_vector)
cut.save()
creates an off-axis slice in the plane perpendicular to ``L``,
@@ -246,11 +247,11 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
W = [0.02, 0.02, 0.02]
- c = [0.53, 0.53, 0.53]
+ c = [0.5, 0.5, 0.5]
N = 512
image = off_axis_projection(pf, c, L, W, N, "density")
write_image(na.log10(image), "%s_offaxis_projection.png" % pf)
@@ -268,11 +269,10 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
prj = OffAxisProjectionPlot(pf,L,'density',width=(25, 'kpc'),
- center=[0.53, 0.53, 0.53],
north_vector=north_vector)
prj.save()
@@ -292,8 +292,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.save()
Panning and zooming
@@ -307,9 +307,10 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.pan((2/pf['kpc'],2/pf['kpc']))
+ from yt.units import kpc
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.pan((2*kpc, 2*kpc))
slc.save()
:class:`~yt.visualization.plot_window.SlicePlot.pan_rel` accepts deltas in units relative
@@ -318,8 +319,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.pan_rel((0.1, -0.1))
slc.save()
@@ -328,8 +329,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.zoom(2)
slc.save()
@@ -342,8 +343,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_axes_unit('Mpc')
slc.save()
@@ -356,9 +357,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_center((0.53, 0.53))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_center((0.5, 0.5))
slc.save()
Fonts
@@ -369,8 +370,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_font({'family': 'sans-serif', 'style': 'italic','weight': 'bold', 'size': 24})
slc.save()
@@ -388,9 +389,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_cmap('VorticitySquared', 'RdBu_r')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_cmap('density', 'RdBu_r')
slc.save()
The :class:`~yt.visualization.plot_window.SlicePlot.set_log` function accepts a field name
@@ -400,9 +401,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_log('VorticitySquared', False)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_log('density', False)
slc.save()
Lastly, the :class:`~yt.visualization.plot_window.SlicePlot.set_zlim` function makes it
@@ -411,9 +412,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_zlim('VorticitySquared', 1e-30, 1e-25)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_zlim('density', 1e-30, 1e-25)
slc.save()
Set the size of the plot
@@ -427,8 +428,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_window_size(10)
slc.save()
@@ -438,8 +439,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_buff_size(1600)
slc.save()
@@ -464,8 +465,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- my_galaxy = pf.disk([0.53, 0.53, 0.53], [0.0, 0.0, 1.0], 0.01, 0.003)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ my_galaxy = pf.disk([0.5, 0.5, 0.5], [0.0, 0.0, 1.0], 0.01, 0.003)
plot = ProfilePlot(my_galaxy, "density", ["temperature"])
plot.save()
@@ -483,8 +484,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- my_sphere = pf.sphere([0.53, 0.53, 0.53], (100, "pc"))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ my_sphere = pf.sphere([0.5, 0.5, 0.5], (100, "kpc"))
plot = ProfilePlot(my_sphere, "temperature", ["cell_mass"],
weight_field=None)
plot.save()
@@ -589,7 +590,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
my_sphere = pf.sphere("c", (50, "kpc"))
plot = PhasePlot(my_sphere, "density", "temperature", ["cell_mass"],
weight_field=None)
@@ -602,9 +603,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
my_sphere = pf.sphere("c", (50, "kpc"))
- plot = PhasePlot(my_sphere, "density", "temperature", ["HI_Fraction"],
+ plot = PhasePlot(my_sphere, "density", "temperature", ["H_fraction"],
weight_field="cell_mass")
plot.save()
@@ -646,7 +647,7 @@
.. notebook-cell::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, "x", "density", center='m', width=(10,'kpc'),
weight_field='density')
p.show()
diff -r 1b8b4513074bc864fbd9c570bac1d8465be7a5a3 -r 8cd5965195c17904ffc420cfdfdbf430befbc312 doc/source/visualizing/volume_rendering.rst
--- a/doc/source/visualizing/volume_rendering.rst
+++ b/doc/source/visualizing/volume_rendering.rst
@@ -142,8 +142,7 @@
:class:`~yt.visualization.volume_rendering.camera.Camera`, which represents a
viewpoint into a volume. The camera optionally accepts a volume, which can be
either an instance of
-:class:`~yt.visualization.volume_rendering.grid_partitioner.HomogenizedVolume`
-or an instance of :class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
+:class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
has already been initialized. If one is not supplied, the camera will generate
one itself. This can also be specified if you wish to save bricks between
repeated calls, thus saving considerable amounts of time.
https://bitbucket.org/yt_analysis/yt/commits/ccf7d41ca80e/
Changeset: ccf7d41ca80e
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:55:32
Summary: Fixing issues in the analysis module API.
Affected #: 5 files
diff -r 8cd5965195c17904ffc420cfdfdbf430befbc312 -r ccf7d41ca80e4c1944b18eafb70539e530c4399e yt/analysis_modules/api.py
--- a/yt/analysis_modules/api.py
+++ b/yt/analysis_modules/api.py
@@ -63,14 +63,13 @@
HaloProfiler, \
FakeProfile
-from .index_subset.api import \
+from .hierarchy_subset.api import \
ConstructedRootGrid, \
AMRExtractedGridProxy, \
ExtractedHierarchy, \
ExtractedParameterFile
from .level_sets.api import \
- coalesce_join_tree, \
identify_contours, \
Clump, \
find_clumps, \
diff -r 8cd5965195c17904ffc420cfdfdbf430befbc312 -r ccf7d41ca80e4c1944b18eafb70539e530c4399e yt/analysis_modules/halo_mass_function/halo_mass_function.py
--- a/yt/analysis_modules/halo_mass_function/halo_mass_function.py
+++ b/yt/analysis_modules/halo_mass_function/halo_mass_function.py
@@ -23,9 +23,9 @@
parallel_blocking_call
from yt.utilities.physical_constants import \
cm_per_mpc, \
- mass_sun_cgs, \
- rho_crit_now
-
+ mass_sun_cgs
+from yt.utilities.physical_ratios import \
+ rho_crit_g_cm3_h2
class HaloMassFcn(ParallelAnalysisInterface):
"""
@@ -256,7 +256,7 @@
# rho0 in units of h^2 Msolar/Mpc^3
rho0 = self.omega_matter0 * \
- rho_crit_now * cm_per_mpc**3 / mass_sun_cgs
+ rho_crit_g_cm3_h2 * cm_per_mpc**3 / mass_sun_cgs
# spacing in mass of our sigma calculation
dm = (float(self.log_mass_max) - self.log_mass_min)/self.num_sigma_bins;
@@ -293,7 +293,7 @@
# constants - set these before calling any functions!
# rho0 in units of h^2 Msolar/Mpc^3
rho0 = self.omega_matter0 * \
- rho_crit_now * cm_per_mpc**3 / mass_sun_cgs
+ rho_crit_g_cm3_h2 * cm_per_mpc**3 / mass_sun_cgs
self.delta_c0 = 1.69; # critical density for turnaround (Press-Schechter)
nofmz_cum = 0.0; # keep track of cumulative number density
diff -r 8cd5965195c17904ffc420cfdfdbf430befbc312 -r ccf7d41ca80e4c1944b18eafb70539e530c4399e yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
@@ -44,8 +44,9 @@
parallel_root_only, \
parallel_objects
from yt.utilities.physical_constants import \
- mass_sun_cgs, \
- rho_crit_now
+ mass_sun_cgs
+from yt.utilities.physical_ratios import \
+ rho_crit_g_cm3_h2
from yt.visualization.fixed_resolution import \
FixedResolutionBuffer
from yt.visualization.image_writer import write_image
@@ -932,7 +933,7 @@
if 'ActualOverdensity' in profile.keys():
return
- rhocritnow = rho_crit_now * self.pf.hubble_constant**2 # g cm^-3
+ rhocritnow = rho_crit_g_cm3_h2 * self.pf.hubble_constant**2 # g cm^-3
rho_crit = rhocritnow * ((1.0 + self.pf.current_redshift)**3.0)
if not self.use_critical_density: rho_crit *= self.pf.omega_matter
diff -r 8cd5965195c17904ffc420cfdfdbf430befbc312 -r ccf7d41ca80e4c1944b18eafb70539e530c4399e yt/analysis_modules/hierarchy_subset/api.py
--- a/yt/analysis_modules/hierarchy_subset/api.py
+++ b/yt/analysis_modules/hierarchy_subset/api.py
@@ -1,5 +1,5 @@
"""
-API for index_subset
+API for hierarchy_subset
@@ -13,7 +13,7 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from .index_subset import \
+from .hierarchy_subset import \
ConstructedRootGrid, \
AMRExtractedGridProxy, \
ExtractedHierarchy, \
diff -r 8cd5965195c17904ffc420cfdfdbf430befbc312 -r ccf7d41ca80e4c1944b18eafb70539e530c4399e yt/analysis_modules/hierarchy_subset/setup.py
--- a/yt/analysis_modules/hierarchy_subset/setup.py
+++ b/yt/analysis_modules/hierarchy_subset/setup.py
@@ -7,7 +7,7 @@
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
- config = Configuration('index_subset', parent_package, top_path)
+ config = Configuration('hierarchy_subset', parent_package, top_path)
config.make_config_py() # installs __config__.py
#config.make_svn_version_py()
return config
https://bitbucket.org/yt_analysis/yt/commits/501855a2aee1/
Changeset: 501855a2aee1
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:56:21
Summary: Fixing bugs in data_objects.
Affected #: 2 files
diff -r ccf7d41ca80e4c1944b18eafb70539e530c4399e -r 501855a2aee1cd24f6e2b4152615bff592c23ed4 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -216,7 +216,7 @@
"""
_key_fields = YTSelectionContainer2D._key_fields + ['weight_field']
_type_name = "proj"
- _con_args = ('axis', 'weight_field')
+ _con_args = ('axis', 'field', 'weight_field')
_container_fields = ('px', 'py', 'pdx', 'pdy', 'weight_field')
def __init__(self, field, axis, weight_field = None,
center = None, pf = None, data_source=None,
@@ -241,6 +241,10 @@
return self.data_source.blocks
@property
+ def field(self):
+ return [k for k in self.field_data.keys() if k not in self._container_fields]
+
+ @property
def _mrep(self):
return MinimalProjectionData(self)
diff -r ccf7d41ca80e4c1944b18eafb70539e530c4399e -r 501855a2aee1cd24f6e2b4152615bff592c23ed4 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -802,6 +802,8 @@
if center is None:
center = (self.pf.domain_right_edge
+ self.pf.domain_left_edge)/2.0
+ elif iterable(center) and not isinstance(center, YTArray):
+ center = self.pf.arr(center, 'code_length')
if iterable(width):
w, u = width
width = self.pf.arr(w, input_units = u)
@@ -1262,8 +1264,7 @@
def _get_cut_mask(self, grid, field=None):
if self._is_fully_enclosed(grid):
return True # We do not want child masking here
- if not isinstance(grid, (FakeGridForParticles,)) \
- and grid.id in self._cut_masks:
+ if grid.id in self._cut_masks:
return self._cut_masks[grid.id]
# If we get this far, we have to generate the cut_mask.
return self._get_level_mask(self.regions, grid)
@@ -1320,6 +1321,5 @@
this_cut_mask)
if item == "OR":
np.bitwise_or(this_cut_mask, level_masks[i+1], this_cut_mask)
- if not isinstance(grid, FakeGridForParticles):
- self._cut_masks[grid.id] = this_cut_mask
+ self._cut_masks[grid.id] = this_cut_mask
return this_cut_mask
https://bitbucket.org/yt_analysis/yt/commits/d0c890bf7bbf/
Changeset: d0c890bf7bbf
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:56:50
Summary: re-adding vorticity_squared. Adding a convenience method for a squared field.
Affected #: 2 files
diff -r 501855a2aee1cd24f6e2b4152615bff592c23ed4 -r d0c890bf7bbf77e1f347546e42811618cea9a6a9 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -28,8 +28,9 @@
just_one
from .vector_operations import \
- create_magnitude_field
-
+ create_magnitude_field, \
+ create_squared_field
+
@register_field_plugin
def setup_fluid_vector_fields(registry, ftype = "gas", slice_info = None):
# slice_info would be the left, the right, and the factor.
@@ -126,6 +127,9 @@
create_magnitude_field(registry, "vorticity", "1/s",
ftype=ftype, slice_info=slice_info,
validators=vort_validators)
+ create_squared_field(registry, "vorticity", "1/s**2",
+ ftype=ftype, slice_info=slice_info,
+ validators=vort_validators)
def _vorticity_stretching_x(field, data):
return data[ftype, "velocity_divergence"] * data[ftype, "vorticity_x"]
diff -r 501855a2aee1cd24f6e2b4152615bff592c23ed4 -r d0c890bf7bbf77e1f347546e42811618cea9a6a9 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -61,6 +61,28 @@
function = _magnitude, units = field_units,
validators = validators, particle_type = particle_type)
+def create_squared_field(registry, basename, field_units,
+ ftype = "gas", slice_info = None,
+ validators = None, particle_type=False):
+
+ xn, yn, zn = [(ftype, "%s_%s" % (basename, ax)) for ax in 'xyz']
+
+ # Is this safe?
+ if registry.pf.dimensionality < 3:
+ zn = ("index", "zeros")
+ if registry.pf.dimensionality < 2:
+ yn = ("index", "zeros")
+
+ def _squared(field, data):
+ squared = data[xn] * data[xn]
+ squared += data[yn] * data[yn]
+ squared += data[zn] * data[zn]
+ return squared
+
+ registry.add_field((ftype, "%s_squared" % basename),
+ function = _squared, units = field_units,
+ validators = validators, particle_type = particle_type)
+
def create_vector_fields(registry, basename, field_units,
ftype = "gas", slice_info = None):
# slice_info would be the left, the right, and the factor.
https://bitbucket.org/yt_analysis/yt/commits/ac95efd07de3/
Changeset: ac95efd07de3
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:58:00
Summary: Removing the out-of-date alias for mpc -> Mpc in the unit label aliases.
Affected #: 1 file
diff -r d0c890bf7bbf77e1f347546e42811618cea9a6a9 -r ac95efd07de3e4372fa62caef06d903880901a65 yt/utilities/definitions.py
--- a/yt/utilities/definitions.py
+++ b/yt/utilities/definitions.py
@@ -47,8 +47,7 @@
'cm' : cm_per_mpc}
# Nicely formatted versions of common length units
-formatted_length_unit_names = {'mpc' : 'Mpc',
- 'au' : 'AU',
+formatted_length_unit_names = {'au' : 'AU',
'rsun' : 'R_\odot',
'code_length': 'code\/length'}
https://bitbucket.org/yt_analysis/yt/commits/7d8ddf8954f2/
Changeset: 7d8ddf8954f2
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:58:39
Summary: Removing an unnecessary reference to .h in plot_container.
Affected #: 1 file
diff -r ac95efd07de3e4372fa62caef06d903880901a65 -r 7d8ddf8954f28ef832bc8bba250834bd6a1ffb3d yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -250,7 +250,7 @@
ds = self.data_source
name = ds._type_name
kwargs = dict((n, getattr(ds, n)) for n in ds._con_args)
- new_ds = getattr(new_pf.h, name)(**kwargs)
+ new_ds = getattr(new_pf, name)(**kwargs)
self.pf = new_pf
self.data_source = new_ds
self._data_valid = self._plot_valid = False
https://bitbucket.org/yt_analysis/yt/commits/c3e6f1795b25/
Changeset: c3e6f1795b25
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:59:01
Summary: Updating some of the plot callbacks.
Affected #: 1 file
diff -r 7d8ddf8954f28ef832bc8bba250834bd6a1ffb3d -r c3e6f1795b25d82da10b8e4d4e5d2c97c0ba89f4 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -1,5 +1,5 @@
"""
-Callbacksr to add additional functionality on to plots.
+Callbacks to add additional functionality on to plots.
@@ -54,30 +54,32 @@
# Convert the data and plot limits to tiled numpy arrays so that
# convert_to_plot is automatically vectorized.
- x0 = np.tile(plot.xlim[0],ncoord)
- x1 = np.tile(plot.xlim[1],ncoord)
+ x0 = np.array(np.tile(plot.xlim[0],ncoord))
+ x1 = np.array(np.tile(plot.xlim[1],ncoord))
xx0 = np.tile(plot._axes.get_xlim()[0],ncoord)
xx1 = np.tile(plot._axes.get_xlim()[1],ncoord)
-
- y0 = np.tile(plot.ylim[0],ncoord)
- y1 = np.tile(plot.ylim[1],ncoord)
+
+ y0 = np.array(np.tile(plot.ylim[0],ncoord))
+ y1 = np.array(np.tile(plot.ylim[1],ncoord))
yy0 = np.tile(plot._axes.get_ylim()[0],ncoord)
yy1 = np.tile(plot._axes.get_ylim()[1],ncoord)
-
+
+ ccoord = np.array(coord)
+
# We need a special case for when we are only given one coordinate.
- if np.array(coord).shape == (2,):
- return ((coord[0]-x0)/(x1-x0)*(xx1-xx0) + xx0,
- (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+ if ccoord.shape == (2,):
+ return ((ccoord[0]-x0)/(x1-x0)*(xx1-xx0) + xx0,
+ (ccoord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0)
else:
- return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0,
- (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+ return ((ccoord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0,
+ (ccoord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0)
def pixel_scale(self,plot):
- x0, x1 = plot.xlim
+ x0, x1 = np.array(plot.xlim)
xx0, xx1 = plot._axes.get_xlim()
dx = (xx1 - xx0)/(x1 - x0)
-
- y0, y1 = plot.ylim
+
+ y0, y1 = np.array(plot.ylim)
yy0, yy1 = plot._axes.get_ylim()
dy = (yy1 - yy0)/(y1 - y0)
@@ -120,7 +122,7 @@
if bv is not None:
bv_x = bv[x_dict[plot.data.axis]]
bv_y = bv[y_dict[plot.data.axis]]
- else: bv_x = bv_y = 0
+ else: bv_x = bv_y = YTQuantity(0, 'cm/s')
qcb = QuiverCallback(xv, yv, self.factor, scale=self.scale,
scale_units=self.scale_units,
@@ -405,10 +407,10 @@
for px_off, py_off in zip(pxs.ravel(), pys.ravel()):
pxo = px_off * DW[px_index]
pyo = py_off * DW[py_index]
- left_edge_x = np.array((GLE[:,px_index]+pxo-x0)*dx + xx0)
- left_edge_y = np.array((GLE[:,py_index]+pyo-y0)*dy + yy0)
- right_edge_x = np.array((GRE[:,px_index]+pxo-x0)*dx + xx0)
- right_edge_y = np.array((GRE[:,py_index]+pyo-y0)*dy + yy0)
+ left_edge_x = np.array((GLE[:,px_index]+pxo-x0)*dx) + xx0
+ left_edge_y = np.array((GLE[:,py_index]+pyo-y0)*dy) + yy0
+ right_edge_x = np.array((GRE[:,px_index]+pxo-x0)*dx) + xx0
+ right_edge_y = np.array((GRE[:,py_index]+pyo-y0)*dy) + yy0
visible = ( xpix * (right_edge_x - left_edge_x) / (xx1 - xx0) > self.min_pix ) & \
( ypix * (right_edge_y - left_edge_y) / (yy1 - yy0) > self.min_pix ) & \
( levels >= min_level) & \
@@ -459,7 +461,6 @@
PlotCallback.__init__(self)
self.field_x = field_x
self.field_y = field_y
- self.bv_x = self.bv_y = 0
self.factor = factor
self.dens = density
if plot_args is None: plot_args = {}
@@ -477,14 +478,14 @@
plot.data['py'],
plot.data['pdx'],
plot.data['pdy'],
- plot.data[self.field_x] - self.bv_x,
+ plot.data[self.field_x],
int(nx), int(ny),
(x0, x1, y0, y1),).transpose()
pixY = _MPL.Pixelize(plot.data['px'],
plot.data['py'],
plot.data['pdx'],
plot.data['pdy'],
- plot.data[self.field_y] - self.bv_y,
+ plot.data[self.field_y],
int(nx), int(ny),
(x0, x1, y0, y1),).transpose()
X,Y = (np.linspace(xx0,xx1,nx,endpoint=True),
@@ -750,6 +751,8 @@
_type_name = "arrow"
def __init__(self, pos, code_size, plot_args = None):
self.pos = pos
+ if isinstance(code_size, YTArray):
+ code_size = code_size.in_units('code_length')
if not iterable(code_size):
code_size = (code_size, code_size)
self.code_size = code_size
@@ -761,6 +764,9 @@
pos = (self.pos[x_dict[plot.data.axis]],
self.pos[y_dict[plot.data.axis]])
else: pos = self.pos
+ if isinstance(self.code_size[1], basestring):
+ code_size = plot.data.pf.quan(*self.code_size).value
+ self.code_size = (code_size, code_size)
from matplotlib.patches import Arrow
# Now convert the pixels to code information
x, y = self.convert_to_plot(plot, pos)
@@ -846,7 +852,11 @@
def __call__(self, plot):
from matplotlib.patches import Circle
-
+
+ if iterable(self.radius):
+ self.radius = plot.data.pf.quan(self.radius[0], self.radius[1])
+ self.radius = np.float64(self.radius)
+
radius = self.radius * self.pixel_scale(plot)[0]
if plot.data.axis == 4:
@@ -1101,6 +1111,8 @@
def __call__(self, plot):
data = plot.data
+ if iterable(self.width):
+ self.width = np.float64(plot.data.pf.quan(self.width[0], self.width[1]))
# we construct a recantangular prism
x0, x1 = plot.xlim
y0, y1 = plot.ylim
@@ -1125,9 +1137,9 @@
if gg.sum() == 0: return
plot._axes.hold(True)
px, py = self.convert_to_plot(plot,
- [reg[field_x][gg][::self.stride],
- reg[field_y][gg][::self.stride]])
- plot._axes.scatter(px.ndarray_view(), py.ndarray_view(), edgecolors='None', marker=self.marker,
+ [np.array(reg[field_x][gg][::self.stride]),
+ np.array(reg[field_y][gg][::self.stride])])
+ plot._axes.scatter(px, py, edgecolors='None', marker=self.marker,
s=self.p_size, c=self.color,alpha=self.alpha)
plot._axes.set_xlim(xx0,xx1)
plot._axes.set_ylim(yy0,yy1)
https://bitbucket.org/yt_analysis/yt/commits/3af0d6d021f3/
Changeset: 3af0d6d021f3
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 07:59:57
Summary: Fixing an issue with Oblique FRBs not being indexed in the correct coordinate system by OffAxisSlicePlot.
Affected #: 1 file
diff -r c3e6f1795b25d82da10b8e4d4e5d2c97c0ba89f4 -r 3af0d6d021f3bf37b40a3ea2befd5a8399f449ff yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -301,6 +301,8 @@
bounds = self.xlim+self.ylim+self.zlim
else:
bounds = self.xlim+self.ylim
+ if self._frb_generator is ObliqueFixedResolutionBuffer:
+ bounds = np.array(bounds)
self._frb = self._frb_generator(self.data_source,
bounds, self.buff_size,
self.antialias,
https://bitbucket.org/yt_analysis/yt/commits/799948ec9c39/
Changeset: 799948ec9c39
Branch: yt-3.0
User: ngoldbaum
Date: 2014-03-25 08:00:19
Summary: Removing the last references to HomogenizedVolume in some docstrings.
Affected #: 2 files
diff -r 3af0d6d021f3bf37b40a3ea2befd5a8399f449ff -r 799948ec9c39f6d533ed23c48e29f7e5947364d6 yt/visualization/streamlines.py
--- a/yt/visualization/streamlines.py
+++ b/yt/visualization/streamlines.py
@@ -41,7 +41,7 @@
zfield: field, optional
The z component of the vector field to be streamlined.
Default:'velocity_z'
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to be streamlined. Can be specified for
finer-grained control, but otherwise will be automatically
generated. At this point it must use the AMRKDTree.
diff -r 3af0d6d021f3bf37b40a3ea2befd5a8399f449ff -r 799948ec9c39f6d533ed23c48e29f7e5947364d6 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -86,7 +86,7 @@
vector. Makes it easier to do rotations along a single
axis. If north_vector is specified, is switched to
True. Default: False
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
fields : list of fields, optional
@@ -1609,7 +1609,7 @@
The radial distance to cast to
resolution : int
The number of pixels in each direction. Must be a single int.
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
fields : list of fields, optional
@@ -2301,7 +2301,7 @@
If supplied, the field will be pre-multiplied by this, then divided by
the integrated value of this field. This returns an average rather
than a sum.
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
no_ghost: bool, optional
https://bitbucket.org/yt_analysis/yt/commits/3bbad51fdb0c/
Changeset: 3bbad51fdb0c
Branch: yt-3.0
User: jzuhone
Date: 2014-03-25 20:42:19
Summary: Merged in ngoldbaum/yt/yt-3.0 (pull request #758)
Fixing tons of miscellaneous bugs
Affected #: 27 files
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/extensions/notebook_sphinxext.py
--- a/doc/extensions/notebook_sphinxext.py
+++ b/doc/extensions/notebook_sphinxext.py
@@ -1,9 +1,10 @@
-import os, shutil, string, glob
+import os, shutil, string, glob, re
from sphinx.util.compat import Directive
from docutils import nodes
from docutils.parsers.rst import directives
from IPython.nbconvert import html, python
-from runipy.notebook_runner import NotebookRunner
+from IPython.nbformat.current import read, write
+from runipy.notebook_runner import NotebookRunner, NotebookError
class NotebookDirective(Directive):
"""Insert an evaluated notebook into a document
@@ -57,12 +58,8 @@
skip_exceptions = 'skip_exceptions' in self.options
- try:
- evaluated_text = evaluate_notebook(nb_abs_path, dest_path_eval,
- skip_exceptions=skip_exceptions)
- except:
- # bail
- return []
+ evaluated_text = evaluate_notebook(nb_abs_path, dest_path_eval,
+ skip_exceptions=skip_exceptions)
# Create link to notebook and script files
link_rst = "(" + \
@@ -138,11 +135,20 @@
# Create evaluated version and save it to the dest path.
# Always use --pylab so figures appear inline
# perhaps this is questionable?
- nb_runner = NotebookRunner(nb_path, pylab=False)
- nb_runner.run_notebook(skip_exceptions=skip_exceptions)
+ notebook = read(open(nb_path), 'json')
+ nb_runner = NotebookRunner(notebook, pylab=False)
+ try:
+ nb_runner.run_notebook(skip_exceptions=skip_exceptions)
+ except NotebookError as e:
+ print ''
+ print e
+ # Return the traceback, filtering out ANSI color codes.
+ # http://stackoverflow.com/questions/13506033/filtering-out-ansi-escape-sequences
+ return 'Notebook conversion failed with the following traceback: \n%s' % \
+ re.sub(r'\\033[\[\]]([0-9]{1,2}([;@][0-9]{0,2})*)*[mKP]?', '', str(e))
if dest_path is None:
dest_path = 'temp_evaluated.ipynb'
- nb_runner.save_notebook(dest_path)
+ write(nb_runner.nb, open(dest_path, 'w'), 'json')
ret = nb_to_html(dest_path)
if dest_path is 'temp_evaluated.ipynb':
os.remove(dest_path)
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/extensions/notebookcell_sphinxext.py
--- a/doc/extensions/notebookcell_sphinxext.py
+++ b/doc/extensions/notebookcell_sphinxext.py
@@ -35,12 +35,7 @@
skip_exceptions = 'skip_exceptions' in self.options
- try:
- evaluated_text = \
- evaluate_notebook('temp.ipynb', skip_exceptions=skip_exceptions)
- except:
- # bail
- return []
+ evaluated_text = evaluate_notebook('temp.ipynb', skip_exceptions=skip_exceptions)
# create notebook node
attributes = {'format': 'html', 'source': 'nb_path'}
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/analyzing/objects.rst
--- a/doc/source/analyzing/objects.rst
+++ b/doc/source/analyzing/objects.rst
@@ -242,15 +242,15 @@
.. notebook-cell::
from yt.mods import *
- pf = load("enzo_tiny_cosmology/DD0046/DD0046")
- ad = pf.h.all_data()
- total_mass = ad.quantities["TotalQuantity"]("cell_mass")
+ ds = load("enzo_tiny_cosmology/DD0046/DD0046")
+ ad = ds.all_data()
+ total_mass = ad.quantities.total_mass()
# now select only gas with 1e5 K < T < 1e7 K.
new_region = ad.cut_region(['obj["temperature"] > 1e5',
'obj["temperature"] < 1e7'])
- cut_mass = new_region.quantities["TotalQuantity"]("cell_mass")
+ cut_mass = new_region.quantities.total_mass()
print "The fraction of mass in this temperature range is %f." % \
- (cut_mass[0] / total_mass[0])
+ (cut_mass / total_mass)
The ``cut_region`` function generates a new object containing only the cells
that meet all of the specified criteria. The sole argument to ``cut_region``
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/bootcamp/3)_Simple_Visualization.ipynb
--- a/doc/source/bootcamp/3)_Simple_Visualization.ipynb
+++ b/doc/source/bootcamp/3)_Simple_Visualization.ipynb
@@ -243,7 +243,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "s = SlicePlot(pf, \"x\", [\"density\"], center=\"max\")\n",
+ "s = 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 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 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
@@ -68,7 +68,7 @@
"for ds in ts:\n",
" dd = ds.all_data()\n",
" rho_ex.append(dd.quantities.extrema(\"density\"))\n",
- " times.append(pf.current_time.in_units(\"Gyr\"))\n",
+ " times.append(ds.current_time.in_units(\"Gyr\"))\n",
"rho_ex = np.array(rho_ex)"
],
"language": "python",
@@ -211,7 +211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "pf = load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
+ "ds = 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",
@@ -361,4 +361,4 @@
"metadata": {}
}
]
-}
\ No newline at end of file
+}
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/cookbook/embedded_javascript_animation.ipynb
--- a/doc/source/cookbook/embedded_javascript_animation.ipynb
+++ b/doc/source/cookbook/embedded_javascript_animation.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:578ca4fbc3831e9093489f06939abce9cde845b6cf75d901a3c429abc270f550"
+ "signature": "sha256:4f7d409d15ecc538096d15212923312e2cb4a911ebf5a9cf7edc9bd63a8335e9"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -47,7 +47,8 @@
"import matplotlib.pyplot as plt\n",
"from matplotlib.backends.backend_agg import FigureCanvasAgg\n",
"\n",
- "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'mpccm'))\n",
+ "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'Mpccm'))\n",
+ "prj.set_figure_size(5)\n",
"prj.set_zlim('density',1e-32,1e-26)\n",
"fig = prj.plots['density'].figure\n",
"fig.canvas = FigureCanvasAgg(fig)\n",
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/cookbook/embedded_webm_animation.ipynb
--- a/doc/source/cookbook/embedded_webm_animation.ipynb
+++ b/doc/source/cookbook/embedded_webm_animation.ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:67844f8c2c184fc51aa62440cc05623ee85f252edde6faaa0d7b6617c3f33dfe"
+ "signature": "sha256:0090176ae6299b2310bf613404cbfbb42a54e19a03d1469d1429a01170a63aa0"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -96,7 +96,7 @@
"import matplotlib.pyplot as plt\n",
"from matplotlib.backends.backend_agg import FigureCanvasAgg\n",
"\n",
- "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'mpccm'))\n",
+ "prj = ProjectionPlot(load('Enzo_64/DD0000/data0000'), 0, 'density', weight_field='density',width=(180,'Mpccm'))\n",
"prj.set_zlim('density',1e-32,1e-26)\n",
"fig = prj.plots['density'].figure\n",
"fig.canvas = FigureCanvasAgg(fig)\n",
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/reference/api/api.rst
--- a/doc/source/reference/api/api.rst
+++ b/doc/source/reference/api/api.rst
@@ -604,13 +604,12 @@
~yt.data_objects.derived_quantities.DerivedQuantity
~yt.data_objects.derived_quantities.DerivedQuantityCollection
- ~yt.data_objects.derived_quantities.WeightedAverage
- ~yt.data_objects.derived_quantities.TotalValue
+ ~yt.data_objects.derived_quantities.WeightedAverageQuantity
+ ~yt.data_objects.derived_quantities.TotalQuantity
~yt.data_objects.derived_quantities.TotalMass
~yt.data_objects.derived_quantities.CenterOfMass
~yt.data_objects.derived_quantities.BulkVelocity
~yt.data_objects.derived_quantities.AngularMomentumVector
- ~yt.data_objects.derived_quantities.ParticleAngularMomentumVector
~yt.data_objects.derived_quantities.Extrema
~yt.data_objects.derived_quantities.MaxLocation
~yt.data_objects.derived_quantities.MinLocation
@@ -719,12 +718,11 @@
~yt.config.YTConfigParser
~yt.utilities.parameter_file_storage.ParameterFileStore
- ~yt.data_objects.data_containers.FakeGridForParticles
~yt.utilities.parallel_tools.parallel_analysis_interface.ObjectIterator
~yt.utilities.parallel_tools.parallel_analysis_interface.ParallelAnalysisInterface
~yt.utilities.parallel_tools.parallel_analysis_interface.ParallelObjectIterator
- ~yt.analysis_modules.index_subset.index_subset.ConstructedRootGrid
- ~yt.analysis_modules.index_subset.index_subset.ExtractedHierarchy
+ ~yt.analysis_modules.hierarchy_subset.hierarchy_subset.ConstructedRootGrid
+ ~yt.analysis_modules.hierarchy_subset.hierarchy_subset.ExtractedHierarchy
Testing Infrastructure
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/visualizing/_cb_docstrings.inc
--- a/doc/source/visualizing/_cb_docstrings.inc
+++ b/doc/source/visualizing/_cb_docstrings.inc
@@ -9,9 +9,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'), center='max')
- slc.annotate_arrow((0.53, 0.53, 0.53), 1/pf['kpc'])
+ slc.annotate_arrow((0.5, 0.5, 0.5), (1, 'kpc'))
slc.save()
-------------
@@ -30,7 +30,7 @@
pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
data_source = pf.disk([0.5, 0.5, 0.5], [0., 0., 1.],
- 8./pf.units['kpc'], 1./pf.units['kpc'])
+ (8., 'kpc'), (1., 'kpc'))
c_min = 10**na.floor(na.log10(data_source['density']).min() )
c_max = 10**na.floor(na.log10(data_source['density']).max()+1)
@@ -79,7 +79,7 @@
from yt.mods import *
pf = load("Enzo_64/DD0043/data0043")
s = OffAxisSlicePlot(pf, [1,1,0], ["density"], center="c")
- s.annotate_cquiver('CuttingPlaneVelocityX', 'CuttingPlaneVelocityY', 10)
+ s.annotate_cquiver('cutting_plane_velocity_x', 'cutting_plane_velocity_y', 10)
s.zoom(1.5)
s.save()
@@ -97,7 +97,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'), center='max')
slc.annotate_grids()
slc.save()
@@ -153,7 +153,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_image_line((0.3, 0.4), (0.8, 0.9), plot_args={'linewidth':5})
p.save()
@@ -169,7 +169,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_line([-6, -4, -2, 0, 2, 4, 6], [3.6, 1.6, 0.4, 0, 0.4, 1.6, 3.6], plot_args={'linewidth':5})
p.save()
@@ -212,9 +212,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
s = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- s.annotate_marker([0.53, 0.53, 0.53], plot_args={'s':10000})
+ s.annotate_marker([0.5, 0.5, 0.5], plot_args={'s':10000})
s.save()
-------------
@@ -237,7 +237,7 @@
from yt.mods import *
pf = load("Enzo_64/DD0043/data0043")
p = ProjectionPlot(pf, "x", "density", center='m', width=(10, 'Mpc'))
- p.annotate_particles(10/pf['Mpc'])
+ p.annotate_particles((10, 'Mpc'))
p.save()
-------------
@@ -253,9 +253,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- p.annotate_point([0.53, 0.526, 0.53], "What's going on here?", text_args={'size':'xx-large', 'color':'w'})
+ p.annotate_point([0.5, 0.496, 0.5], "What's going on here?", text_args={'size':'xx-large', 'color':'w'})
p.save()
-------------
@@ -273,8 +273,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53],
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center=[0.5, 0.5, 0.5],
weight_field='density', width=(20, 'kpc'))
p.annotate_quiver('velocity_x', 'velocity_y', 16)
p.save()
@@ -292,9 +292,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
- p.annotate_sphere([0.53, 0.53, 0.53], 2/pf['kpc'], {'fill':True})
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
+ p.annotate_sphere([0.5, 0.5, 0.5], (2, 'kpc'), {'fill':True})
p.save()
-------------
@@ -314,8 +314,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- s = SlicePlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ s = SlicePlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
s.annotate_streamlines('velocity_x', 'velocity_y')
s.save()
@@ -333,9 +333,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
s = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
- s.annotate_text((0.53, 0.53), 'Sample text', text_args={'size':'xx-large', 'color':'w'})
+ s.annotate_text((0.5, 0.5), 'Sample text', text_args={'size':'xx-large', 'color':'w'})
s.save()
-------------
@@ -349,8 +349,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- p = ProjectionPlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20, 'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ p = ProjectionPlot(pf, 'z', 'density', center='c', width=(20, 'kpc'))
p.annotate_title('Density plot')
p.save()
@@ -373,7 +373,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = SlicePlot(pf, 'z', 'density', center='m', width=(10, 'kpc'))
p.annotate_velocity()
p.save()
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/visualizing/manual_plotting.rst
--- a/doc/source/visualizing/manual_plotting.rst
+++ b/doc/source/visualizing/manual_plotting.rst
@@ -39,13 +39,13 @@
pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
c = pf.h.find_max('density')[1]
- proj = pf.proj(0, 'density')
+ proj = pf.proj('density', 0)
- width = 10/pf['kpc'] # we want a 1.5 mpc view
+ width = (10, 'kpc') # we want a 1.5 mpc view
res = [1000, 1000] # create an image with 1000x1000 pixels
frb = proj.to_frb(width, res, center=c)
- P.imshow(frb['density'])
+ P.imshow(np.array(frb['density']))
P.savefig('my_perfect_figure.png')
The FRB is a very small object that can be deleted and recreated quickly (in
@@ -76,10 +76,10 @@
ray = pf.ortho_ray(ax, (c[1], c[2])) # cutting through the y0,z0 such that we hit the max density
P.subplot(211)
- P.semilogy(ray['x'], ray['density'])
+ P.semilogy(np.array(ray['x']), np.array(ray['density']))
P.ylabel('density')
P.subplot(212)
- P.semilogy(ray['x'], ray['temperature'])
+ P.semilogy(np.array(ray['x']), np.array(ray['temperature']))
P.xlabel('x')
P.ylabel('temperature')
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -108,13 +108,13 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'density', center=[0.53, 0.53, 0.53], width=(20,'kpc'))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', center=[0.5, 0.5, 0.5], width=(20,'kpc'))
slc.save()
The above example will display an annotated plot of a slice of the
Density field in a 20 kpc square window centered on the coordinate
-(0.53,0.53) in the x-y plane. The axis to slice along is keyed to the
+(0.5, 0.5, 0.5) in the x-y plane. The axis to slice along is keyed to the
letter 'z', corresponding to the z-axis. Finally, the image is saved to
a png file.
@@ -124,18 +124,19 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z','Pressure', center=[0.53, 0.53, 0.53])
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'pressure', center='c')
slc.save()
slc.zoom(30)
slc.save('zoom')
-will save a slice of the pressure field in a slice along the z
+will save a plot of the pressure field in a slice along the z
axis across the entire simulation domain followed by another plot that
is zoomed in by a factor of 30 with respect to the original
-image. With these sorts of manipulations, one can easily pan and zoom
-onto an interesting region in the simulation and adjust the
-boundaries of the region to visualize on the fly.
+image. Both plots will be centered on the center of the simulation box.
+With these sorts of manipulations, one can easily pan and zoom onto an
+interesting region in the simulation and adjust the boundaries of the
+region to visualize on the fly.
A slice object can also add annotations like a title, an overlying
quiver plot, the location of grid boundaries, halo-finder annotations,
@@ -145,12 +146,12 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.annotate_grids()
slc.save()
-will plot the VorticitySquared in a 10 kiloparsec slice through the
+will plot the density field in a 10 kiloparsec slice through the
z-axis centered on the highest density point in the simulation domain.
Before saving the plot, the script annotates it with the grid
boundaries, which are drawn as thick black lines by default.
@@ -174,9 +175,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- prj = ProjectionPlot(pf, 2, 'density', center=[0.53, 0.53, 0.53],
- width=(25, 'kpc'), weight_field=None)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ prj = ProjectionPlot(pf, 2, 'density', width=(25, 'kpc'),
+ weight_field=None)
prj.save()
will create a projection of Density field along the x axis, plot it,
@@ -205,11 +206,11 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
- cut = OffAxisSlicePlot(pf, L, 'density', width=(25, 'kpc'),
- center=[0.53, 0.53, 0.53], north_vector=north_vector)
+ cut = OffAxisSlicePlot(pf, L, 'density', width=(25, 'kpc'),
+ north_vector=north_vector)
cut.save()
creates an off-axis slice in the plane perpendicular to ``L``,
@@ -246,11 +247,11 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
W = [0.02, 0.02, 0.02]
- c = [0.53, 0.53, 0.53]
+ c = [0.5, 0.5, 0.5]
N = 512
image = off_axis_projection(pf, c, L, W, N, "density")
write_image(na.log10(image), "%s_offaxis_projection.png" % pf)
@@ -268,11 +269,10 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1,1,0] # vector normal to cutting plane
north_vector = [-1,1,0]
prj = OffAxisProjectionPlot(pf,L,'density',width=(25, 'kpc'),
- center=[0.53, 0.53, 0.53],
north_vector=north_vector)
prj.save()
@@ -292,8 +292,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.save()
Panning and zooming
@@ -307,9 +307,10 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.pan((2/pf['kpc'],2/pf['kpc']))
+ from yt.units import kpc
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.pan((2*kpc, 2*kpc))
slc.save()
:class:`~yt.visualization.plot_window.SlicePlot.pan_rel` accepts deltas in units relative
@@ -318,8 +319,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.pan_rel((0.1, -0.1))
slc.save()
@@ -328,8 +329,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.zoom(2)
slc.save()
@@ -342,8 +343,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_axes_unit('Mpc')
slc.save()
@@ -356,9 +357,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_center((0.53, 0.53))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_center((0.5, 0.5))
slc.save()
Fonts
@@ -369,8 +370,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_font({'family': 'sans-serif', 'style': 'italic','weight': 'bold', 'size': 24})
slc.save()
@@ -388,9 +389,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_cmap('VorticitySquared', 'RdBu_r')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_cmap('density', 'RdBu_r')
slc.save()
The :class:`~yt.visualization.plot_window.SlicePlot.set_log` function accepts a field name
@@ -400,9 +401,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_log('VorticitySquared', False)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_log('density', False)
slc.save()
Lastly, the :class:`~yt.visualization.plot_window.SlicePlot.set_zlim` function makes it
@@ -411,9 +412,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
- slc.set_zlim('VorticitySquared', 1e-30, 1e-25)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
+ slc.set_zlim('density', 1e-30, 1e-25)
slc.save()
Set the size of the plot
@@ -427,8 +428,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_window_size(10)
slc.save()
@@ -438,8 +439,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- slc = SlicePlot(pf, 'z', 'VorticitySquared', width=(10,'kpc'), center='max')
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = SlicePlot(pf, 'z', 'density', width=(10,'kpc'))
slc.set_buff_size(1600)
slc.save()
@@ -464,8 +465,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- my_galaxy = pf.disk([0.53, 0.53, 0.53], [0.0, 0.0, 1.0], 0.01, 0.003)
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ my_galaxy = pf.disk([0.5, 0.5, 0.5], [0.0, 0.0, 1.0], 0.01, 0.003)
plot = ProfilePlot(my_galaxy, "density", ["temperature"])
plot.save()
@@ -483,8 +484,8 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
- my_sphere = pf.sphere([0.53, 0.53, 0.53], (100, "pc"))
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ my_sphere = pf.sphere([0.5, 0.5, 0.5], (100, "kpc"))
plot = ProfilePlot(my_sphere, "temperature", ["cell_mass"],
weight_field=None)
plot.save()
@@ -589,7 +590,7 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
my_sphere = pf.sphere("c", (50, "kpc"))
plot = PhasePlot(my_sphere, "density", "temperature", ["cell_mass"],
weight_field=None)
@@ -602,9 +603,9 @@
.. python-script::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
my_sphere = pf.sphere("c", (50, "kpc"))
- plot = PhasePlot(my_sphere, "density", "temperature", ["HI_Fraction"],
+ plot = PhasePlot(my_sphere, "density", "temperature", ["H_fraction"],
weight_field="cell_mass")
plot.save()
@@ -646,7 +647,7 @@
.. notebook-cell::
from yt.mods import *
- pf = load("HiresIsolatedGalaxy/DD0044/DD0044")
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
p = ProjectionPlot(pf, "x", "density", center='m', width=(10,'kpc'),
weight_field='density')
p.show()
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 doc/source/visualizing/volume_rendering.rst
--- a/doc/source/visualizing/volume_rendering.rst
+++ b/doc/source/visualizing/volume_rendering.rst
@@ -142,8 +142,7 @@
:class:`~yt.visualization.volume_rendering.camera.Camera`, which represents a
viewpoint into a volume. The camera optionally accepts a volume, which can be
either an instance of
-:class:`~yt.visualization.volume_rendering.grid_partitioner.HomogenizedVolume`
-or an instance of :class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
+:class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
has already been initialized. If one is not supplied, the camera will generate
one itself. This can also be specified if you wish to save bricks between
repeated calls, thus saving considerable amounts of time.
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/analysis_modules/api.py
--- a/yt/analysis_modules/api.py
+++ b/yt/analysis_modules/api.py
@@ -63,14 +63,13 @@
HaloProfiler, \
FakeProfile
-from .index_subset.api import \
+from .hierarchy_subset.api import \
ConstructedRootGrid, \
AMRExtractedGridProxy, \
ExtractedHierarchy, \
ExtractedParameterFile
from .level_sets.api import \
- coalesce_join_tree, \
identify_contours, \
Clump, \
find_clumps, \
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/analysis_modules/halo_mass_function/halo_mass_function.py
--- a/yt/analysis_modules/halo_mass_function/halo_mass_function.py
+++ b/yt/analysis_modules/halo_mass_function/halo_mass_function.py
@@ -23,9 +23,9 @@
parallel_blocking_call
from yt.utilities.physical_constants import \
cm_per_mpc, \
- mass_sun_cgs, \
- rho_crit_now
-
+ mass_sun_cgs
+from yt.utilities.physical_ratios import \
+ rho_crit_g_cm3_h2
class HaloMassFcn(ParallelAnalysisInterface):
"""
@@ -256,7 +256,7 @@
# rho0 in units of h^2 Msolar/Mpc^3
rho0 = self.omega_matter0 * \
- rho_crit_now * cm_per_mpc**3 / mass_sun_cgs
+ rho_crit_g_cm3_h2 * cm_per_mpc**3 / mass_sun_cgs
# spacing in mass of our sigma calculation
dm = (float(self.log_mass_max) - self.log_mass_min)/self.num_sigma_bins;
@@ -293,7 +293,7 @@
# constants - set these before calling any functions!
# rho0 in units of h^2 Msolar/Mpc^3
rho0 = self.omega_matter0 * \
- rho_crit_now * cm_per_mpc**3 / mass_sun_cgs
+ rho_crit_g_cm3_h2 * cm_per_mpc**3 / mass_sun_cgs
self.delta_c0 = 1.69; # critical density for turnaround (Press-Schechter)
nofmz_cum = 0.0; # keep track of cumulative number density
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
@@ -44,8 +44,9 @@
parallel_root_only, \
parallel_objects
from yt.utilities.physical_constants import \
- mass_sun_cgs, \
- rho_crit_now
+ mass_sun_cgs
+from yt.utilities.physical_ratios import \
+ rho_crit_g_cm3_h2
from yt.visualization.fixed_resolution import \
FixedResolutionBuffer
from yt.visualization.image_writer import write_image
@@ -932,7 +933,7 @@
if 'ActualOverdensity' in profile.keys():
return
- rhocritnow = rho_crit_now * self.pf.hubble_constant**2 # g cm^-3
+ rhocritnow = rho_crit_g_cm3_h2 * self.pf.hubble_constant**2 # g cm^-3
rho_crit = rhocritnow * ((1.0 + self.pf.current_redshift)**3.0)
if not self.use_critical_density: rho_crit *= self.pf.omega_matter
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/analysis_modules/hierarchy_subset/api.py
--- a/yt/analysis_modules/hierarchy_subset/api.py
+++ b/yt/analysis_modules/hierarchy_subset/api.py
@@ -1,5 +1,5 @@
"""
-API for index_subset
+API for hierarchy_subset
@@ -13,7 +13,7 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from .index_subset import \
+from .hierarchy_subset import \
ConstructedRootGrid, \
AMRExtractedGridProxy, \
ExtractedHierarchy, \
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -216,7 +216,7 @@
"""
_key_fields = YTSelectionContainer2D._key_fields + ['weight_field']
_type_name = "proj"
- _con_args = ('axis', 'weight_field')
+ _con_args = ('axis', 'field', 'weight_field')
_container_fields = ('px', 'py', 'pdx', 'pdy', 'weight_field')
def __init__(self, field, axis, weight_field = None,
center = None, pf = None, data_source=None,
@@ -241,6 +241,10 @@
return self.data_source.blocks
@property
+ def field(self):
+ return [k for k in self.field_data.keys() if k not in self._container_fields]
+
+ @property
def _mrep(self):
return MinimalProjectionData(self)
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -802,6 +802,8 @@
if center is None:
center = (self.pf.domain_right_edge
+ self.pf.domain_left_edge)/2.0
+ elif iterable(center) and not isinstance(center, YTArray):
+ center = self.pf.arr(center, 'code_length')
if iterable(width):
w, u = width
width = self.pf.arr(w, input_units = u)
@@ -1262,8 +1264,7 @@
def _get_cut_mask(self, grid, field=None):
if self._is_fully_enclosed(grid):
return True # We do not want child masking here
- if not isinstance(grid, (FakeGridForParticles,)) \
- and grid.id in self._cut_masks:
+ if grid.id in self._cut_masks:
return self._cut_masks[grid.id]
# If we get this far, we have to generate the cut_mask.
return self._get_level_mask(self.regions, grid)
@@ -1320,6 +1321,5 @@
this_cut_mask)
if item == "OR":
np.bitwise_or(this_cut_mask, level_masks[i+1], this_cut_mask)
- if not isinstance(grid, FakeGridForParticles):
- self._cut_masks[grid.id] = this_cut_mask
+ self._cut_masks[grid.id] = this_cut_mask
return this_cut_mask
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -28,8 +28,9 @@
just_one
from .vector_operations import \
- create_magnitude_field
-
+ create_magnitude_field, \
+ create_squared_field
+
@register_field_plugin
def setup_fluid_vector_fields(registry, ftype = "gas", slice_info = None):
# slice_info would be the left, the right, and the factor.
@@ -126,6 +127,9 @@
create_magnitude_field(registry, "vorticity", "1/s",
ftype=ftype, slice_info=slice_info,
validators=vort_validators)
+ create_squared_field(registry, "vorticity", "1/s**2",
+ ftype=ftype, slice_info=slice_info,
+ validators=vort_validators)
def _vorticity_stretching_x(field, data):
return data[ftype, "velocity_divergence"] * data[ftype, "vorticity_x"]
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/fields/vector_operations.py
--- a/yt/fields/vector_operations.py
+++ b/yt/fields/vector_operations.py
@@ -61,6 +61,28 @@
function = _magnitude, units = field_units,
validators = validators, particle_type = particle_type)
+def create_squared_field(registry, basename, field_units,
+ ftype = "gas", slice_info = None,
+ validators = None, particle_type=False):
+
+ xn, yn, zn = [(ftype, "%s_%s" % (basename, ax)) for ax in 'xyz']
+
+ # Is this safe?
+ if registry.pf.dimensionality < 3:
+ zn = ("index", "zeros")
+ if registry.pf.dimensionality < 2:
+ yn = ("index", "zeros")
+
+ def _squared(field, data):
+ squared = data[xn] * data[xn]
+ squared += data[yn] * data[yn]
+ squared += data[zn] * data[zn]
+ return squared
+
+ registry.add_field((ftype, "%s_squared" % basename),
+ function = _squared, units = field_units,
+ validators = validators, particle_type = particle_type)
+
def create_vector_fields(registry, basename, field_units,
ftype = "gas", slice_info = None):
# slice_info would be the left, the right, and the factor.
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/frontends/fits/data_structures.py
--- a/yt/frontends/fits/data_structures.py
+++ b/yt/frontends/fits/data_structures.py
@@ -19,6 +19,7 @@
import stat
import numpy as np
import weakref
+import warnings
from yt.config import ytcfg
from yt.funcs import *
@@ -250,7 +251,9 @@
except:
pass
try:
- fileh = pyfits.open(args[0])
+ with warnings.catch_warnings():
+ warnings.filterwarnings('ignore', category=UserWarning, append=True)
+ fileh = pyfits.open(args[0])
for h in fileh:
if h.is_image and h.data is not None:
fileh.close()
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/utilities/definitions.py
--- a/yt/utilities/definitions.py
+++ b/yt/utilities/definitions.py
@@ -47,8 +47,7 @@
'cm' : cm_per_mpc}
# Nicely formatted versions of common length units
-formatted_length_unit_names = {'mpc' : 'Mpc',
- 'au' : 'AU',
+formatted_length_unit_names = {'au' : 'AU',
'rsun' : 'R_\odot',
'code_length': 'code\/length'}
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -250,7 +250,7 @@
ds = self.data_source
name = ds._type_name
kwargs = dict((n, getattr(ds, n)) for n in ds._con_args)
- new_ds = getattr(new_pf.h, name)(**kwargs)
+ new_ds = getattr(new_pf, name)(**kwargs)
self.pf = new_pf
self.data_source = new_ds
self._data_valid = self._plot_valid = False
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -1,5 +1,5 @@
"""
-Callbacksr to add additional functionality on to plots.
+Callbacks to add additional functionality on to plots.
@@ -54,30 +54,32 @@
# Convert the data and plot limits to tiled numpy arrays so that
# convert_to_plot is automatically vectorized.
- x0 = np.tile(plot.xlim[0],ncoord)
- x1 = np.tile(plot.xlim[1],ncoord)
+ x0 = np.array(np.tile(plot.xlim[0],ncoord))
+ x1 = np.array(np.tile(plot.xlim[1],ncoord))
xx0 = np.tile(plot._axes.get_xlim()[0],ncoord)
xx1 = np.tile(plot._axes.get_xlim()[1],ncoord)
-
- y0 = np.tile(plot.ylim[0],ncoord)
- y1 = np.tile(plot.ylim[1],ncoord)
+
+ y0 = np.array(np.tile(plot.ylim[0],ncoord))
+ y1 = np.array(np.tile(plot.ylim[1],ncoord))
yy0 = np.tile(plot._axes.get_ylim()[0],ncoord)
yy1 = np.tile(plot._axes.get_ylim()[1],ncoord)
-
+
+ ccoord = np.array(coord)
+
# We need a special case for when we are only given one coordinate.
- if np.array(coord).shape == (2,):
- return ((coord[0]-x0)/(x1-x0)*(xx1-xx0) + xx0,
- (coord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+ if ccoord.shape == (2,):
+ return ((ccoord[0]-x0)/(x1-x0)*(xx1-xx0) + xx0,
+ (ccoord[1]-y0)/(y1-y0)*(yy1-yy0) + yy0)
else:
- return ((coord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0,
- (coord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0)
+ return ((ccoord[0][:]-x0)/(x1-x0)*(xx1-xx0) + xx0,
+ (ccoord[1][:]-y0)/(y1-y0)*(yy1-yy0) + yy0)
def pixel_scale(self,plot):
- x0, x1 = plot.xlim
+ x0, x1 = np.array(plot.xlim)
xx0, xx1 = plot._axes.get_xlim()
dx = (xx1 - xx0)/(x1 - x0)
-
- y0, y1 = plot.ylim
+
+ y0, y1 = np.array(plot.ylim)
yy0, yy1 = plot._axes.get_ylim()
dy = (yy1 - yy0)/(y1 - y0)
@@ -120,7 +122,7 @@
if bv is not None:
bv_x = bv[x_dict[plot.data.axis]]
bv_y = bv[y_dict[plot.data.axis]]
- else: bv_x = bv_y = 0
+ else: bv_x = bv_y = YTQuantity(0, 'cm/s')
qcb = QuiverCallback(xv, yv, self.factor, scale=self.scale,
scale_units=self.scale_units,
@@ -405,10 +407,10 @@
for px_off, py_off in zip(pxs.ravel(), pys.ravel()):
pxo = px_off * DW[px_index]
pyo = py_off * DW[py_index]
- left_edge_x = np.array((GLE[:,px_index]+pxo-x0)*dx + xx0)
- left_edge_y = np.array((GLE[:,py_index]+pyo-y0)*dy + yy0)
- right_edge_x = np.array((GRE[:,px_index]+pxo-x0)*dx + xx0)
- right_edge_y = np.array((GRE[:,py_index]+pyo-y0)*dy + yy0)
+ left_edge_x = np.array((GLE[:,px_index]+pxo-x0)*dx) + xx0
+ left_edge_y = np.array((GLE[:,py_index]+pyo-y0)*dy) + yy0
+ right_edge_x = np.array((GRE[:,px_index]+pxo-x0)*dx) + xx0
+ right_edge_y = np.array((GRE[:,py_index]+pyo-y0)*dy) + yy0
visible = ( xpix * (right_edge_x - left_edge_x) / (xx1 - xx0) > self.min_pix ) & \
( ypix * (right_edge_y - left_edge_y) / (yy1 - yy0) > self.min_pix ) & \
( levels >= min_level) & \
@@ -459,7 +461,6 @@
PlotCallback.__init__(self)
self.field_x = field_x
self.field_y = field_y
- self.bv_x = self.bv_y = 0
self.factor = factor
self.dens = density
if plot_args is None: plot_args = {}
@@ -477,14 +478,14 @@
plot.data['py'],
plot.data['pdx'],
plot.data['pdy'],
- plot.data[self.field_x] - self.bv_x,
+ plot.data[self.field_x],
int(nx), int(ny),
(x0, x1, y0, y1),).transpose()
pixY = _MPL.Pixelize(plot.data['px'],
plot.data['py'],
plot.data['pdx'],
plot.data['pdy'],
- plot.data[self.field_y] - self.bv_y,
+ plot.data[self.field_y],
int(nx), int(ny),
(x0, x1, y0, y1),).transpose()
X,Y = (np.linspace(xx0,xx1,nx,endpoint=True),
@@ -750,6 +751,8 @@
_type_name = "arrow"
def __init__(self, pos, code_size, plot_args = None):
self.pos = pos
+ if isinstance(code_size, YTArray):
+ code_size = code_size.in_units('code_length')
if not iterable(code_size):
code_size = (code_size, code_size)
self.code_size = code_size
@@ -761,6 +764,9 @@
pos = (self.pos[x_dict[plot.data.axis]],
self.pos[y_dict[plot.data.axis]])
else: pos = self.pos
+ if isinstance(self.code_size[1], basestring):
+ code_size = plot.data.pf.quan(*self.code_size).value
+ self.code_size = (code_size, code_size)
from matplotlib.patches import Arrow
# Now convert the pixels to code information
x, y = self.convert_to_plot(plot, pos)
@@ -846,7 +852,11 @@
def __call__(self, plot):
from matplotlib.patches import Circle
-
+
+ if iterable(self.radius):
+ self.radius = plot.data.pf.quan(self.radius[0], self.radius[1])
+ self.radius = np.float64(self.radius)
+
radius = self.radius * self.pixel_scale(plot)[0]
if plot.data.axis == 4:
@@ -1101,6 +1111,8 @@
def __call__(self, plot):
data = plot.data
+ if iterable(self.width):
+ self.width = np.float64(plot.data.pf.quan(self.width[0], self.width[1]))
# we construct a recantangular prism
x0, x1 = plot.xlim
y0, y1 = plot.ylim
@@ -1125,9 +1137,9 @@
if gg.sum() == 0: return
plot._axes.hold(True)
px, py = self.convert_to_plot(plot,
- [reg[field_x][gg][::self.stride],
- reg[field_y][gg][::self.stride]])
- plot._axes.scatter(px.ndarray_view(), py.ndarray_view(), edgecolors='None', marker=self.marker,
+ [np.array(reg[field_x][gg][::self.stride]),
+ np.array(reg[field_y][gg][::self.stride])])
+ plot._axes.scatter(px, py, edgecolors='None', marker=self.marker,
s=self.p_size, c=self.color,alpha=self.alpha)
plot._axes.set_xlim(xx0,xx1)
plot._axes.set_ylim(yy0,yy1)
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -301,6 +301,8 @@
bounds = self.xlim+self.ylim+self.zlim
else:
bounds = self.xlim+self.ylim
+ if self._frb_generator is ObliqueFixedResolutionBuffer:
+ bounds = np.array(bounds)
self._frb = self._frb_generator(self.data_source,
bounds, self.buff_size,
self.antialias,
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/visualization/streamlines.py
--- a/yt/visualization/streamlines.py
+++ b/yt/visualization/streamlines.py
@@ -41,7 +41,7 @@
zfield: field, optional
The z component of the vector field to be streamlined.
Default:'velocity_z'
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to be streamlined. Can be specified for
finer-grained control, but otherwise will be automatically
generated. At this point it must use the AMRKDTree.
diff -r 9594ac19008f7f6b936538bea4f109926a073e74 -r 3bbad51fdb0c8e193ce0dba5aaab7754fbe486f1 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -86,7 +86,7 @@
vector. Makes it easier to do rotations along a single
axis. If north_vector is specified, is switched to
True. Default: False
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
fields : list of fields, optional
@@ -1609,7 +1609,7 @@
The radial distance to cast to
resolution : int
The number of pixels in each direction. Must be a single int.
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
fields : list of fields, optional
@@ -2301,7 +2301,7 @@
If supplied, the field will be pre-multiplied by this, then divided by
the integrated value of this field. This returns an average rather
than a sum.
- volume : `yt.extensions.volume_rendering.HomogenizedVolume`, optional
+ volume : `yt.extensions.volume_rendering.AMRKDTree`, optional
The volume to ray cast through. Can be specified for finer-grained
control, but otherwise will be automatically generated.
no_ghost: bool, optional
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