[yt-svn] commit/yt: 12 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Feb 3 11:56:24 PST 2016


12 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/e0ae749c98f0/
Changeset:   e0ae749c98f0
Branch:      stable
User:        ngoldbaum
Date:        2016-01-12 19:24:31+00:00
Summary:     Backporting PR #1933 https://bitbucket.org/yt_analysis/yt/pull-requests/1933
Affected #:  2 files

diff -r 618c5af3ddc85a6b4bfc66a0eb0e63d66c506b7b -r e0ae749c98f0799fa74ce97c2b0eae2e30f73931 yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -127,8 +127,8 @@
         fields = list(_base_fields)
 
         for rf in requested:
-            if field.particle_type:
-                if rf not in particle_fields:
+            if rf[0] == 'io' or rf[0] == 'all':
+                if rf not in particle_fields or rf[1] not in particle_fields:
                     particle_fields.append(rf[1])
             else:
                 fields.append(rf)

diff -r 618c5af3ddc85a6b4bfc66a0eb0e63d66c506b7b -r e0ae749c98f0799fa74ce97c2b0eae2e30f73931 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -615,6 +615,17 @@
     number_of_particles = data.pop("number_of_particles", 0)
     # First we fix our field names
     field_units, data = unitify_data(data)
+
+    for field_name in data:
+        fshape = data[field_name].shape
+        dshape = tuple(domain_dimensions)
+        pshape = (number_of_particles, )
+        if fshape != dshape and fshape != pshape:
+            msg = ("Input data shape %s for field %s does not match provided "
+                   "domain_dimensions %s or number of particles %s")
+            msg = msg % (fshape, field_name, dshape, pshape)
+            raise RuntimeError(msg)
+
     sfh = StreamDictFieldHandler()
 
     if number_of_particles > 0:


https://bitbucket.org/yt_analysis/yt/commits/720e87526a52/
Changeset:   720e87526a52
Branch:      stable
User:        xarthisius
Date:        2016-01-14 01:13:35+00:00
Summary:     Reintroduce sanite_width for polar/cyl coordinates

It was accidentally removed in PR 1826. Fixes behavior of SlicePlot when
width is not provided for cylindrical and polar datasets

Reported-by: Miguel de Val-Borro <miguel at archlinux.net>
Affected #:  1 file

diff -r e0ae749c98f0799fa74ce97c2b0eae2e30f73931 -r 720e87526a52b7e749da66ea604cee09426956db yt/geometry/coordinates/cylindrical_coordinates.py
--- a/yt/geometry/coordinates/cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/cylindrical_coordinates.py
@@ -134,7 +134,7 @@
     _image_axis_name = None
 
     @property
-    def image_axis_name(self):    
+    def image_axis_name(self):
         if self._image_axis_name is not None:
             return self._image_axis_name
         # This is the x and y axes labels that get displayed.  For
@@ -192,3 +192,23 @@
             display_center[z_ax] = self.ds.domain_center[z_ax]
             # zeros for the others
         return center, display_center
+
+    def sanitize_width(self, axis, width, depth):
+        name = self.axis_name[axis]
+        r_ax, theta_ax, z_ax = (self.ds.coordinates.axis_id[ax]
+                                for ax in ('r', 'theta', 'z'))
+        if width is not None:
+             width = super(CylindricalCoordinateHandler,
+                           self).sanitize_width(axis, width, depth)
+        # Note: regardless of axes, these are set up to give consistent plots
+        # when plotted, which is not strictly a "right hand rule" for axes.
+        elif name == "r": # soup can label
+            width = [2.0 * np.pi * self.ds.domain_width.uq,
+                     self.ds.domain_width[z_ax]]
+        elif name == "theta":
+            width = [self.ds.domain_right_edge[r_ax],
+                     self.ds.domain_width[z_ax]]
+        elif name == "z":
+            width = [2.0*self.ds.domain_right_edge[r_ax],
+                     2.0*self.ds.domain_right_edge[r_ax]]
+        return width


https://bitbucket.org/yt_analysis/yt/commits/a11c989cdbb1/
Changeset:   a11c989cdbb1
Branch:      stable
User:        ngoldbaum
Date:        2016-01-20 17:02:52+00:00
Summary:     Backporting PR #1941 https://bitbucket.org/yt_analysis/yt/pull-requests/1941
Affected #:  3 files

diff -r 720e87526a52b7e749da66ea604cee09426956db -r a11c989cdbb1314e0e392441690b51cfb3ade96c doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -1304,7 +1304,9 @@
 .. note::
    PyX must be installed, which can be accomplished either manually
    with ``pip install pyx`` or with the install script by setting
-   ``INST_PYX=1``.
+   ``INST_PYX=1``. If you are using python2, you must install pyx
+   version 0.12.1 with ``pip install pyx==0.12.1``, since that is 
+   the last version with python2 support.
 
 This module can take any of the plots mentioned above and create an
 EPS or PDF figure.  For example,
@@ -1351,3 +1353,31 @@
 margin, but it can be overridden by providing the keyword
 ``cb_location`` with a dict of either ``right, left, top, bottom``
 with the fields as the keys.
+
+You can also combine slices, projections, and phase plots. Here is
+an example that includes slices and phase plots:
+
+.. code-block:: python
+
+    from yt import SlicePlot, PhasePlot
+    from yt.visualization.eps_writer import multiplot_yt
+   
+    ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+
+    p1 = SlicePlot(ds, 0, 'density')
+    p1.set_width(10, 'kpc')
+   
+    p2 = SlicePlot(ds, 0, 'temperature')
+    p2.set_width(10, 'kpc')
+    p2.set_cmap('temperature', 'hot')
+
+    sph = ds.sphere(ds.domain_center, (10, 'kpc'))
+    p3 = PhasePlot(sph, 'radius', 'density', 'temperature',
+                   weight_field='cell_mass')
+
+    p4 = PhasePlot(sph, 'radius', 'density', 'pressure', 'cell_mass')
+
+    mp = multiplot_yt(2, 2, [p1, p2, p3, p4], savefig="yt", shrink_cb=0.9,
+                      bare_axes=False, yt_nocbar=False, margins=(0.5,0.5))
+
+    mp.save_fig('multi_slice_phase')

diff -r 720e87526a52b7e749da66ea604cee09426956db -r a11c989cdbb1314e0e392441690b51cfb3ade96c yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -311,7 +311,7 @@
 
         Examples
         --------
-        >>> p = pc.add_slice('Density', 0, use_colorbar=False)
+        >>> p = SlicePlot(ds, 0, 'density')
         >>> d = DualEPS()
         >>> d.axis_box_yt(p)
         >>> d.save_fig()
@@ -496,7 +496,7 @@
 
         Examples
         --------
-        >>> p = pc.add_slice('Density', 0, use_colorbar=False)
+        >>> p = SlicePlot(ds, 0, 'density')
         >>> d = DualEPS()
         >>> d.axis_box_yt(p)
         >>> d.insert_image_yt(p)
@@ -704,7 +704,8 @@
 
         Examples
         --------
-        >>> p = pc.add_slice('Density', 0, use_colorbar=False)
+        >>> p = SlicePlot(ds, 0, 'density')
+        >>> p.hide_colorbar()
         >>> d = DualEPS()
         >>> d.axis_box_yt(p)
         >>> d.insert_image_yt(p)
@@ -740,7 +741,8 @@
                     print("Colorbar label not available")
                     _zlabel = ''
             else:
-                _zlabel = pyxize_label(plot.z_title)
+                _, _, z_title = plot._get_field_title(self.field, plot.profile)
+                _zlabel = pyxize_label(z_title)
             _zlabel = _zlabel.replace("_","\;")
             _zlog = plot.get_log(self.field)[self.field]
             if plot.plots[self.field].zmin == None:
@@ -1258,27 +1260,28 @@
         Number of columns in the figure.
     nrow : integer
         Number of rows in the figure.
-    plots : `yt.visualization.plot_window.PlotWindow`
-        yt PlotWindow that has the plots to be used.
+    plots : ``PlotWindow`` instance, ``PhasePlot`` instance, or list of plots
+        yt plots to be used.
 
     Examples
     --------
-    >>> pc = PlotCollection(ds)
-    >>> p = pc.add_slice('Density',0,use_colorbar=False)
-    >>> p.set_width(0.1,'kpc')
-    >>> p1 = pc.add_slice('Temperature',0,use_colorbar=False)
-    >>> p1.set_width(0.1,'kpc')
-    >>> p1.set_cmap('hot')
-    >>> p1 = pc.add_phase_sphere(0.1, 'kpc', ['Radius', 'Density', 'H2I_Fraction'],
-    >>>                         weight='CellMassMsun')
-    >>> p1.set_xlim(1e18,3e20)
-    >>> p1 = pc.add_phase_sphere(0.1, 'kpc', ['Radius', 'Density', 'Temperature'],
-    >>>                         weight='CellMassMsun')
-    >>> p1.set_xlim(1e18,3e20)
-    >>> mp = multiplot_yt(2,2,pc,savefig="yt",shrink_cb=0.9, bare_axes=False,
-    >>>                   yt_nocbar=False, margins=(0.5,0.5))
+    >>> p1 = SlicePlot(ds, 0, 'density')
+    >>> p1.set_width(10, 'kpc')
+    >>>
+    >>> p2 = SlicePlot(ds, 0, 'temperature')
+    >>> p2.set_width(10, 'kpc')
+    >>> p2.set_cmap('temperature', 'hot')
+    >>>
+    >>> sph = ds.sphere(ds.domain_center, (10, 'kpc'))
+    >>> p3 = PhasePlot(sph, 'radius', 'density', 'temperature',
+    ...                weight_field='cell_mass')
+    >>>
+    >>> p4 = PhasePlot(sph, 'radius', 'density', 'pressure', 'cell_mass')
+    >>>
+    >>> mp = multiplot_yt(2, 2, [p1, p2, p3, p4], savefig="yt", shrink_cb=0.9,
+    ...                   bare_axes=True, yt_nocbar=False, margins=(0.5,0.5))
     """
-    # Determine whether the plots are organized in a PlotWindow, or list 
+    # Determine whether the plots are organized in a PlotWindow, or list
     # of PlotWindows
     if isinstance(plots, (PlotWindow, PhasePlot)):
         if fields == None:
@@ -1329,7 +1332,7 @@
 
     Examples
     --------
-    >>> p = pc.add_slice('Density',0,use_colorbar=False)
+    >>> p = SlicePlot(ds, 0, 'density')
     >>> p.set_width(0.1,'kpc')
     >>> single_plot(p, savefig="figure1")
     """

diff -r 720e87526a52b7e749da66ea604cee09426956db -r a11c989cdbb1314e0e392441690b51cfb3ade96c yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -809,6 +809,10 @@
         scales = {True: 'log', False: 'linear'}
         return scales[x_log], scales[y_log], scales[z_log]
 
+    def _recreate_frb(self):
+        # needed for API compatibility with PlotWindow
+        pass
+
     def _setup_plots(self):
         if self._plot_valid:
             return


https://bitbucket.org/yt_analysis/yt/commits/83f96e34c1c2/
Changeset:   83f96e34c1c2
Branch:      stable
User:        ngoldbaum
Date:        2016-01-15 01:24:33+00:00
Summary:     Better error message when export_fits is not able to determine fields to export
Affected #:  1 file

diff -r a11c989cdbb1314e0e392441690b51cfb3ade96c -r 83f96e34c1c211ff39846f63ed45b6f72f5723e5 yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -328,7 +328,17 @@
 
         from yt.utilities.fits_image import FITSImageData
 
-        if fields is None: fields = list(self.data.keys())
+        if fields is None:
+            fields = list(self.data.keys())
+        else:
+            fields = ensure_list(fields)
+
+        if len(fields) == 0:
+            raise RuntimeError(
+                "No fields to export. Either pass a field or list of fields to "
+                "export_fits or access a field from the fixed resolution buffer "
+                "object."
+            )
 
         fib = FITSImageData(self, fields=fields, units=units)
         if other_keys is not None:


https://bitbucket.org/yt_analysis/yt/commits/fa551f6e089f/
Changeset:   fa551f6e089f
Branch:      stable
User:        Max Katz
Date:        2016-01-19 20:36:08+00:00
Summary:     For 2D BoxLib simulations, the runtime parameter amr.n_cell was being read in a way that gave an incorrect number of values to ds.domain_dimensions. This has been corrected so that '1' is appended in the unused extra dimensions.
Affected #:  1 file

diff -r 83f96e34c1c211ff39846f63ed45b6f72f5723e5 -r fa551f6e089f8ffb293fbe5a100d61ffa9ad20ea yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -445,6 +445,16 @@
             param, vals = [s.strip() for s in line.split("=")]
             if param == "amr.n_cell":
                 vals = self.domain_dimensions = np.array(vals.split(), dtype='int32')
+
+                # For 1D and 2D simulations in BoxLib usually only the relevant dimensions
+                # have a specified number of zones, but yt requires domain_dimensions to 
+                # have three elements, with 1 in the additional slots if we're not in 3D, 
+                # so append them as necessary.
+
+                if (len(vals) == 1):
+                    vals = self.domain_dimensions = np.array([vals[0], 1, 1])
+                elif (len(vals) == 2):
+                    vals = self.domain_dimensions = np.array([vals[0], vals[1], 1])
             elif param == "amr.ref_ratio":
                 vals = self.refine_by = int(vals[0])
             elif param == "Prob.lo_bc":


https://bitbucket.org/yt_analysis/yt/commits/4e2c4bc26795/
Changeset:   4e2c4bc26795
Branch:      stable
User:        ngoldbaum
Date:        2016-01-28 15:45:47+00:00
Summary:     Backporting PR #1950 https://bitbucket.org/yt_analysis/yt/pull-requests/1950
Affected #:  3 files

diff -r fa551f6e089f8ffb293fbe5a100d61ffa9ad20ea -r 4e2c4bc2679516b89458fca377dd525c11d77049 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -603,7 +603,15 @@
         coordinates. Returns a list of field values in the same order as
         the input *fields*.
         """
-        return self.point(coords)[fields]
+        point = self.point(coords)
+        ret = []
+        field_list = ensure_list(fields)
+        for field in field_list:
+            ret.append(point[field])
+        if len(field_list) == 1:
+            return ret[0]
+        else:
+            return ret
 
     def find_field_values_at_points(self, fields, coords):
         """
@@ -611,19 +619,26 @@
         [(x1, y1, z2), (x2, y2, z2),...] points.  Returns a list of field
         values in the same order as the input *fields*.
 
-        This is quite slow right now as it creates a new data object for each
-        point.  If an optimized version exists on the Index object we'll use
-        that instead.
         """
-        if hasattr(self,"index") and \
-                hasattr(self.index,"_find_field_values_at_points"):
-            return self.index._find_field_values_at_points(fields,coords)
+        # If an optimized version exists on the Index object we'll use that
+        try:
+            return self.index._find_field_values_at_points(fields, coords)
+        except AttributeError:
+            pass
 
         fields = ensure_list(fields)
-        out = np.zeros((len(fields),len(coords)), dtype=np.float64)
-        for i,coord in enumerate(coords):
-            out[:][i] = self.point(coord)[fields]
-        return out
+        out = []
+
+        # This may be slow because it creates a data object for each point
+        for field_index, field in enumerate(fields):
+            funit = self._get_field_info[field].units
+            out.append(self.arr(np.empty((len(coords),)), funit))
+            for coord_index, coord in enumerate(coords):
+                out[field_index][coord_index] = self.point(coord)[fields]
+        if len(fields) == 1:
+            return out[0]
+        else:
+            return out
 
     # Now all the object related stuff
     def all_data(self, find_max=False, **kwargs):

diff -r fa551f6e089f8ffb293fbe5a100d61ffa9ad20ea -r 4e2c4bc2679516b89458fca377dd525c11d77049 yt/data_objects/tests/test_points.py
--- a/yt/data_objects/tests/test_points.py
+++ b/yt/data_objects/tests/test_points.py
@@ -6,5 +6,55 @@
     ytcfg["yt","__withintesting"] = "True"
 
 def test_domain_point():
-    ds = fake_random_ds(16, fields = ("density"))
+    ds = fake_random_ds(16, particles=nparticles)
     p = ds.point(ds.domain_center)
+
+    # ensure accessing one field works, store for comparison later
+    point_den = p['density']
+    point_vel = p['velocity_x']
+
+    ad = ds.all_data()
+    ppos = ad['all', 'particle_position']
+
+    fpoint_den = ds.find_field_values_at_point('density', ds.domain_center)
+
+    fpoint_den_vel = ds.find_field_values_at_point(
+        ['density', 'velocity_x'], ds.domain_center)
+
+    assert_equal(point_den, fpoint_den)
+    assert_equal(point_den, fpoint_den_vel[0])
+    assert_equal(point_vel, fpoint_den_vel[1])
+
+    ppos_den = ds.find_field_values_at_points('density', ppos)
+    ppos_vel = ds.find_field_values_at_points('velocity_x', ppos)
+    ppos_den_vel = ds.find_field_values_at_points(
+        ['density', 'velocity_x'], ppos)
+
+    assert_equal(ppos_den.shape, (nparticles,))
+    assert_equal(ppos_vel.shape, (nparticles,))
+    assert_equal(len(ppos_den_vel), 2)
+    assert_equal(ppos_den_vel[0], ppos_den)
+    assert_equal(ppos_den_vel[1], ppos_vel)
+
+g30 = "IsolatedGalaxy/galaxy0030/galaxy0030"
+
+ at requires_file(g30)
+def test_fast_find_field_values_at_points():
+    ds = yt.load(g30)
+    ad = ds.all_data()
+    # right now this is slow for large numbers of particles, so randomly
+    # sample 100 particles
+    nparticles = 100
+    ppos = ad['all', 'particle_position']
+    ppos = ppos[np.random.random_integers(0, len(ppos), size=nparticles)]
+
+    ppos_den = ds.find_field_values_at_points('density', ppos)
+    ppos_vel = ds.find_field_values_at_points('velocity_x', ppos)
+    ppos_den_vel = ds.find_field_values_at_points(
+        ['density', 'velocity_x'], ppos)
+
+    assert_equal(ppos_den.shape, (nparticles,))
+    assert_equal(ppos_vel.shape, (nparticles,))
+    assert_equal(len(ppos_den_vel), 2)
+    assert_equal(ppos_den_vel[0], ppos_den)
+    assert_equal(ppos_den_vel[1], ppos_vel)

diff -r fa551f6e089f8ffb293fbe5a100d61ffa9ad20ea -r 4e2c4bc2679516b89458fca377dd525c11d77049 yt/geometry/grid_geometry_handler.py
--- a/yt/geometry/grid_geometry_handler.py
+++ b/yt/geometry/grid_geometry_handler.py
@@ -211,8 +211,8 @@
         Returns the values [field1, field2,...] of the fields at the given
         (x, y, z) points. Returns a numpy array of field values cross coords
         """
-        coords = YTArray(ensure_numpy_array(coords),'code_length', registry=self.ds.unit_registry)
-        grids = self._find_points(coords[:,0], coords[:,1], coords[:,2])[0]
+        coords = self.ds.arr(ensure_numpy_array(coords), 'code_length')
+        grids = self._find_points(coords[:, 0], coords[:, 1], coords[:, 2])[0]
         fields = ensure_list(fields)
         mark = np.zeros(3, dtype=np.int)
         out = []
@@ -224,13 +224,21 @@
                 grid_index[grid] = []
             grid_index[grid].append(coord_index)
 
-        out = np.zeros((len(fields),len(coords)), dtype=np.float64)
+        out = []
+        for field in fields:
+            funit = self.ds._get_field_info(field).units
+            out.append(self.ds.arr(np.empty((len(coords))), funit))
+
         for grid in grid_index:
             cellwidth = (grid.RightEdge - grid.LeftEdge) / grid.ActiveDimensions
-            for field in fields:
+            for field_index, field in enumerate(fields):
                 for coord_index in grid_index[grid]:
-                    mark = ((coords[coord_index,:] - grid.LeftEdge) / cellwidth).astype('int')
-                    out[:,coord_index] = grid[field][mark[0],mark[1],mark[2]]
+                    mark = ((coords[coord_index, :] - grid.LeftEdge) / cellwidth)
+                    mark = np.array(mark, dtype='int64')
+                    out[field_index][coord_index] = \
+                        grid[field][mark[0], mark[1], mark[2]]
+        if len(fields) == 1:
+            return out[0]
         return out
 
 


https://bitbucket.org/yt_analysis/yt/commits/b1197d8fe900/
Changeset:   b1197d8fe900
Branch:      stable
User:        jwise77
Date:        2016-01-26 22:53:45+00:00
Summary:     Backporting PR #1963 https://bitbucket.org/yt_analysis/yt/pull-requests/1963
Affected #:  1 file

diff -r 4e2c4bc2679516b89458fca377dd525c11d77049 -r b1197d8fe90019f76257be15ceab5b8389a0ca07 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -522,7 +522,12 @@
                 self.field = plot.data_source._determine_fields(field)[0]
             if self.field not in plot.plots.keys():
                 raise RuntimeError("Field '%s' does not exist!" % str(self.field))
-            plot.plots[self.field].hide_colorbar()
+            if isinstance(plot, PlotWindow):
+                plot.hide_colorbar()
+                plot.hide_axes()
+            else:
+                plot.plots[self.field]._toggle_axes(False)
+                plot.plots[self.field]._toggle_colorbar(False)
             plot.refresh()
             _p1 = plot.plots[self.field].figure
             force_square = True
@@ -538,16 +543,13 @@
         else:
             raise RuntimeError("Unknown plot type")
 
-        _p1.axes[0].set_axis_off()  # remove axes
         _p1.axes[0].set_position([0,0,1,1])  # rescale figure
         _p1.set_facecolor('w')  # set background color
         figure_canvas = FigureCanvasAgg(_p1)
         figure_canvas.draw()
         size = (_p1.get_size_inches() * _p1.dpi).astype('int')
 
-        # Account for 1 pixel line width of the axis box and
-        # non-square images after removing the colorbar.
-        yshift = -1.0 / _p1.dpi * 2.54
+        # Account for non-square images after removing the colorbar.
         scale *= 1.0 - 1.0 / (_p1.dpi * self.figsize[0])
         if force_square:
             yscale = scale * float(size[1]) / float(size[0])
@@ -555,7 +557,7 @@
             yscale = scale
         image = pyx.bitmap.image(size[0], size[1], "RGB",
                                  figure_canvas.tostring_rgb())
-        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1]+yshift, image,
+        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1], image,
                                              width=scale*self.figsize[0],
                                              height=yscale*self.figsize[1]))
 
@@ -1339,7 +1341,7 @@
     d = DualEPS(figsize=figsize)
     d.insert_image_yt(plot, field=field)
     d.axis_box_yt(plot, bare_axes=bare_axes, **kwargs)
-    if colorbar:
+    if colorbar and not isinstance(plot, ProfilePlot):
         d.colorbar_yt(plot, orientation=cb_orient)
     if savefig != None:
         d.save_fig(savefig, format=file_format)


https://bitbucket.org/yt_analysis/yt/commits/c6db55487ce8/
Changeset:   c6db55487ce8
Branch:      stable
User:        MatthewTurk
Date:        2016-01-27 20:57:59+00:00
Summary:     Adding a hash cache
Affected #:  2 files

diff -r b1197d8fe90019f76257be15ceab5b8389a0ca07 -r c6db55487ce8ac630471e5a8689cfc20e673a106 yt/geometry/selection_routines.pxd
--- a/yt/geometry/selection_routines.pxd
+++ b/yt/geometry/selection_routines.pxd
@@ -37,6 +37,8 @@
     cdef int overlap_cells
     cdef np.float64_t domain_width[3]
     cdef bint periodicity[3]
+    cdef bint _hash_initialized
+    cdef np.int64_t _hash
 
     cdef void recursively_visit_octs(self, Oct *root,
                         np.float64_t pos[3], np.float64_t dds[3],

diff -r b1197d8fe90019f76257be15ceab5b8389a0ca07 -r c6db55487ce8ac630471e5a8689cfc20e673a106 yt/geometry/selection_routines.pyx
--- a/yt/geometry/selection_routines.pyx
+++ b/yt/geometry/selection_routines.pyx
@@ -119,6 +119,7 @@
 cdef class SelectorObject:
 
     def __cinit__(self, dobj, *args):
+        self._hash_initialized = 0
         cdef np.float64_t [:] DLE
         cdef np.float64_t [:] DRE
         self.min_level = getattr(dobj, "min_level", 0)
@@ -616,6 +617,8 @@
 
     def __hash__(self):
         # convert data to be hashed to a byte array, which FNV algorithm expects
+        if self._hash_initialized == 1:
+            return self._hash
         hash_data = bytearray()
         for v in self._hash_vals() + self._base_hash():
             if isinstance(v, tuple):
@@ -623,7 +626,10 @@
                 hash_data.extend(repr(v[1]).encode('ascii'))
             else:
                 hash_data.extend(repr(v).encode('ascii'))
-        return fnv_hash(hash_data)
+        cdef np.int64_t hash_value = fnv_hash(hash_data)
+        self._hash = hash_value
+        self._hash_initialized = 1
+        return hash_value
 
     def _hash_vals(self):
         raise NotImplementedError


https://bitbucket.org/yt_analysis/yt/commits/30919200cdb8/
Changeset:   30919200cdb8
Branch:      stable
User:        migueldvb
Date:        2016-01-30 03:13:18+00:00
Summary:     Import HUGE from utilities.physical_ratios
Affected #:  1 file

diff -r c6db55487ce8ac630471e5a8689cfc20e673a106 -r 30919200cdb8b717011ef946e6ebeaf04b0e952e yt/geometry/object_finding_mixin.py
--- a/yt/geometry/object_finding_mixin.py
+++ b/yt/geometry/object_finding_mixin.py
@@ -23,7 +23,7 @@
 from yt.geometry.grid_container import \
     MatchPointsToGrids, \
     GridTree
-from yt.utilities.physical_constants import \
+from yt.utilities.physical_ratios import \
     HUGE
 
 class ObjectFindingMixin(object) :


https://bitbucket.org/yt_analysis/yt/commits/883145cae183/
Changeset:   883145cae183
Branch:      stable
User:        ngoldbaum
Date:        2016-02-03 19:55:00+00:00
Summary:     Fixing point tests
Affected #:  1 file

diff -r 30919200cdb8b717011ef946e6ebeaf04b0e952e -r 883145cae183d884fc322a394a6cef9f9a5807cc yt/data_objects/tests/test_points.py
--- a/yt/data_objects/tests/test_points.py
+++ b/yt/data_objects/tests/test_points.py
@@ -1,4 +1,5 @@
 from yt.testing import *
+import yt
 import numpy as np
 
 def setup():
@@ -6,6 +7,7 @@
     ytcfg["yt","__withintesting"] = "True"
 
 def test_domain_point():
+    nparticles = 3
     ds = fake_random_ds(16, particles=nparticles)
     p = ds.point(ds.domain_center)
 


https://bitbucket.org/yt_analysis/yt/commits/80aff0c49f40/
Changeset:   80aff0c49f40
Branch:      stable
User:        ngoldbaum
Date:        2016-02-03 16:53:51+00:00
Summary:     Updating version numbers for 3.2.3
Affected #:  3 files

diff -r 883145cae183d884fc322a394a6cef9f9a5807cc -r 80aff0c49f40e04f00d7b39149c7fc297b8ed311 doc/source/conf.py
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -67,9 +67,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '3.2.2'
+version = '3.2.3'
 # The full version, including alpha/beta/rc tags.
-release = '3.2.2'
+release = '3.2.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

diff -r 883145cae183d884fc322a394a6cef9f9a5807cc -r 80aff0c49f40e04f00d7b39149c7fc297b8ed311 setup.py
--- a/setup.py
+++ b/setup.py
@@ -114,7 +114,7 @@
 # End snippet
 ######
 
-VERSION = "3.2.2"
+VERSION = "3.2.3"
 
 if os.path.exists('MANIFEST'):
     os.remove('MANIFEST')

diff -r 883145cae183d884fc322a394a6cef9f9a5807cc -r 80aff0c49f40e04f00d7b39149c7fc297b8ed311 yt/__init__.py
--- a/yt/__init__.py
+++ b/yt/__init__.py
@@ -72,7 +72,7 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-__version__ = "3.2.2"
+__version__ = "3.2.3"
 
 # First module imports
 import numpy as np # For modern purposes


https://bitbucket.org/yt_analysis/yt/commits/e485fee10909/
Changeset:   e485fee10909
Branch:      stable
User:        ngoldbaum
Date:        2016-02-03 19:55:32+00:00
Summary:     Added tag yt-3.2.3 for changeset 80aff0c49f40
Affected #:  1 file

diff -r 80aff0c49f40e04f00d7b39149c7fc297b8ed311 -r e485fee10909aeca0aa1bf9a3d0f964e007fc743 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -5188,3 +5188,4 @@
 0000000000000000000000000000000000000000 yt-3.2.1
 f7ca21c7b3fdf25d2ccab139849ae457597cfd5c yt-3.2.1
 a7896583c06585be66de8404d76ad5bc3d2caa9a yt-3.2.2
+80aff0c49f40e04f00d7b39149c7fc297b8ed311 yt-3.2.3

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