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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Apr 6 11:09:56 PDT 2016


3 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/81dc5b3d5633/
Changeset:   81dc5b3d5633
Branch:      yt
User:        ngoldbaum
Date:        2016-03-31 02:52:12+00:00
Summary:     logging: don't create a StreamHandler unless we will use it. Closes #1024
Affected #:  1 file

diff -r ac130eab01032636d00b9de431b8e5f1b4b788d6 -r 81dc5b3d563331842988e4a09e42232e833ddb14 yt/utilities/logger.py
--- a/yt/utilities/logger.py
+++ b/yt/utilities/logger.py
@@ -54,36 +54,43 @@
 
 ytLogger = logging.getLogger("yt")
 
-yt_sh = logging.StreamHandler(stream=stream)
-# create formatter and add it to the handlers
-formatter = logging.Formatter(ufstring)
-yt_sh.setFormatter(formatter)
-# add the handler to the logger
-ytLogger.addHandler(yt_sh)
-ytLogger.setLevel(level)
-ytLogger.propagate = False
- 
 def disable_stream_logging():
-    ytLogger.removeHandler(ytLogger.handlers[0])
+    if len(ytLogger.handlers) > 0:
+        ytLogger.removeHandler(ytLogger.handlers[0])
     h = logging.NullHandler()
     ytLogger.addHandler(h)
 
-original_emitter = yt_sh.emit
-
 def colorize_logging():
     f = logging.Formatter(cfstring)
     ytLogger.handlers[0].setFormatter(f)
     yt_sh.emit = add_coloring_to_emit_ansi(yt_sh.emit)
 
 def uncolorize_logging():
-    f = logging.Formatter(ufstring)
-    ytLogger.handlers[0].setFormatter(f)
-    yt_sh.emit = original_emitter
-
-if ytcfg.getboolean("yt", "coloredlogs"):
-    colorize_logging()
+    try:
+        f = logging.Formatter(ufstring)
+        ytLogger.handlers[0].setFormatter(f)
+        yt_sh.emit = original_emitter
+    except NameError:
+        # yt_sh and original_emitter are not defined because
+        # suppressStreamLogging is True, so we continue since there is nothing
+        # to uncolorize
+        pass
 
 if ytcfg.getboolean("yt", "suppressStreamLogging"):
     disable_stream_logging()
+else:
+    yt_sh = logging.StreamHandler(stream=stream)
+    # create formatter and add it to the handlers
+    formatter = logging.Formatter(ufstring)
+    yt_sh.setFormatter(formatter)
+    # add the handler to the logger
+    ytLogger.addHandler(yt_sh)
+    ytLogger.setLevel(level)
+    ytLogger.propagate = False
+
+    original_emitter = yt_sh.emit
+
+    if ytcfg.getboolean("yt", "coloredlogs"):
+        colorize_logging()
 
 ytLogger.debug("Set log level to %s", level)


https://bitbucket.org/yt_analysis/yt/commits/def617b415de/
Changeset:   def617b415de
Branch:      yt
User:        ngoldbaum
Date:        2016-03-31 14:43:16+00:00
Summary:     Merging with mainline
Affected #:  14 files

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 doc/source/analyzing/mesh_filter.ipynb
--- a/doc/source/analyzing/mesh_filter.ipynb
+++ b/doc/source/analyzing/mesh_filter.ipynb
@@ -143,13 +143,13 @@
    "source": [
     "ph1 = yt.PhasePlot(ad, 'density', 'temperature', 'cell_mass', weight_field=None)\n",
     "ph1.set_xlim(3e-31, 3e-27)\n",
-    "ph1.set_title('cell_mass', 'No Cuts')\n",
+    "ph1.annotate_title('No Cuts')\n",
     "ph1.set_figure_size(5)\n",
     "ph1.show()\n",
     "\n",
     "ph1 = yt.PhasePlot(dense_ad, 'density', 'temperature', 'cell_mass', weight_field=None)\n",
     "ph1.set_xlim(3e-31, 3e-27)\n",
-    "ph1.set_title('cell_mass', 'Dense Gas')\n",
+    "ph1.annotate_title('Dense Gas')\n",
     "ph1.set_figure_size(5)\n",
     "ph1.show()"
    ]

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 doc/source/cookbook/tests/test_cookbook.py
--- a/doc/source/cookbook/tests/test_cookbook.py
+++ b/doc/source/cookbook/tests/test_cookbook.py
@@ -11,16 +11,22 @@
 """
 import glob
 import os
+import sys
 import subprocess
 
 
 PARALLEL_TEST = {"rockstar_nest.py": "3"}
+BLACKLIST = ["opengl_ipython.py", "opengl_vr.py"]
 
+if sys.version_info >= (3,0,0):
+    BLACKLIST.append("rockstar_nest.py")
 
 def test_recipe():
     '''Dummy test grabbing all cookbook's recipes'''
     for fname in glob.glob("doc/source/cookbook/*.py"):
         recipe = os.path.basename(fname)
+        if recipe in BLACKLIST:
+            continue
         check_recipe.description = "Testing recipe: %s" % recipe
         if recipe in PARALLEL_TEST:
             yield check_recipe, \

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 doc/source/reference/api/api.rst
--- a/doc/source/reference/api/api.rst
+++ b/doc/source/reference/api/api.rst
@@ -743,6 +743,7 @@
 
    ~yt.visualization.plot_window.PWViewerMPL.annotate_clear
    ~yt.visualization.plot_modifications.ArrowCallback
+   ~yt.visualization.plot_modifications.CellEdgesCallback
    ~yt.visualization.plot_modifications.ClumpContourCallback
    ~yt.visualization.plot_modifications.ContourCallback
    ~yt.visualization.plot_modifications.CuttingQuiverCallback

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 doc/source/visualizing/callbacks.rst
--- a/doc/source/visualizing/callbacks.rst
+++ b/doc/source/visualizing/callbacks.rst
@@ -273,6 +273,31 @@
    slc.annotate_grids()
    slc.save()
 
+.. _annotate-cell-edges:
+
+Overplot Cell Edges
+~~~~~~~~~~~~~~~~~~~
+
+.. function:: annotate_cell_edges(line_width=1.0, alpha = 1.0,
+                                  color = (0.0, 0.0, 0.0))
+
+   (This is a proxy for
+   :class:`~yt.visualization.plot_modifications.CellEdgesCallback`.)
+
+    Annotate the edges of cells, where the ``line_width`` in pixels is specified.
+    The ``alpha`` of the overlaid image and the ``color`` of the lines are also
+    specifiable.  Note that because the lines are drawn from both sides of a
+    cell, the image sometimes has the effect of doubling the line width.
+    Color here is in RGB float values (0 to 1).
+
+.. python-script::
+
+   import yt
+   ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+   slc = yt.SlicePlot(ds, 'z', 'density', width=(10,'kpc'), center='max')
+   slc.annotate_cell_edges()
+   slc.save()
+
 .. _annotate-halos:
 
 Overplot Halo Annotations

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 tests/tests_2.7.yaml
--- a/tests/tests_2.7.yaml
+++ b/tests/tests_2.7.yaml
@@ -42,7 +42,7 @@
   local_tipsy_270:
     - yt/frontends/tipsy/tests/test_outputs.py
   
-  local_varia_273:
+  local_varia_274:
     - yt/analysis_modules/radmc3d_export
     - yt/frontends/moab/tests/test_c5.py
     - yt/analysis_modules/photon_simulator/tests/test_spectra.py

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 tests/tests_3.5.yaml
--- a/tests/tests_3.5.yaml
+++ b/tests/tests_3.5.yaml
@@ -25,6 +25,8 @@
 
   local_halos_350:
     - yt/frontends/owls_subfind/tests/test_outputs.py
+    - yt/frontends/gadget_fof/tests/test_outputs.py:test_fields_g5
+    - yt/frontends/gadget_fof/tests/test_outputs.py:test_fields_g42
   
   local_owls_350:
     - yt/frontends/owls/tests/test_outputs.py
@@ -40,7 +42,7 @@
   local_tipsy_350:
     - yt/frontends/tipsy/tests/test_outputs.py
   
-  local_varia_350:
+  local_varia_351:
     - yt/analysis_modules/radmc3d_export
     - yt/frontends/moab/tests/test_c5.py
     - yt/analysis_modules/photon_simulator/tests/test_spectra.py

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/frontends/gadget_fof/tests/test_outputs.py
--- a/yt/frontends/gadget_fof/tests/test_outputs.py
+++ b/yt/frontends/gadget_fof/tests/test_outputs.py
@@ -62,7 +62,7 @@
     for hid in range(0, ds.index.particle_count["Group"]):
         my_h = ds.halo("Group", hid)
         h_ids = my_h["ID"]
-        for sid in range(my_h["subhalo_number"]):
+        for sid in range(int(my_h["subhalo_number"][0])):
             my_s = ds.halo("Subhalo", (my_h.particle_identifier, sid))
             total_sub += my_s["ID"].size
             total_int += np.intersect1d(h_ids, my_s["ID"]).size

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -31,6 +31,8 @@
 from cython.parallel import prange, parallel, threadid
 from vec3_ops cimport dot, subtract, L2_norm, fma
 
+from cpython.exc cimport PyErr_CheckSignals
+
 DEF Nch = 4
 
 cdef class PartitionedGrid:
@@ -458,6 +460,7 @@
         size = nx * ny
         cdef ImageAccumulator *idata
         cdef np.float64_t width[3]
+        cdef int chunksize = 100
         for i in range(3):
             width[i] = self.width[i]
         with nogil, parallel(num_threads = num_threads):
@@ -465,7 +468,7 @@
             idata.supp_data = self.supp_data
             v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
             v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
-            for j in prange(size, schedule="static", chunksize=100):
+            for j in prange(size, schedule="static", chunksize=chunksize):
                 vj = j % ny
                 vi = (j - vj) / ny + iter[0]
                 vj = vj + iter[2]
@@ -476,6 +479,9 @@
                 max_t = fclip(im.zbuffer[vi, vj], 0.0, 1.0)
                 walk_volume(vc, v_pos, v_dir, self.sampler,
                             (<void *> idata), NULL, max_t)
+                if (j % (10*chunksize)) == 0:
+                    with gil:
+                        PyErr_CheckSignals()
                 for i in range(Nch):
                     im.image[vi, vj, i] = idata.rgba[i]
             free(idata)

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/utilities/lib/pixelization_routines.pyx
--- a/yt/utilities/lib/pixelization_routines.pyx
+++ b/yt/utilities/lib/pixelization_routines.pyx
@@ -61,10 +61,12 @@
                        int cols, int rows, bounds,
                        int antialias = 1,
                        period = None,
-                       int check_period = 1):
+                       int check_period = 1,
+                       np.float64_t line_width = 0.0):
     cdef np.float64_t x_min, x_max, y_min, y_max
     cdef np.float64_t period_x = 0.0, period_y = 0.0
     cdef np.float64_t width, height, px_dx, px_dy, ipx_dx, ipx_dy
+    cdef np.float64_t ld_x, ld_y, cx, cy
     cdef int i, j, p, xi, yi
     cdef int lc, lr, rc, rr
     cdef np.float64_t lypx, rypx, lxpx, rxpx, overlap1, overlap2
@@ -170,13 +172,29 @@
                         for j in range(lc, rc):
                             lxpx = px_dx * j + x_min
                             rxpx = px_dx * (j+1) + x_min
-                            if antialias == 1:
+                            if line_width > 0:
+                                # Here, we figure out if we're within
+                                # line_width*px_dx of the cell edge
+                                # Midpoint of x:
+                                cx = (rxpx+lxpx)*0.5
+                                ld_x = fmin(fabs(cx - (xsp+dxsp)),
+                                            fabs(cx - (xsp-dxsp)))
+                                ld_x *= ipx_dx
+                                # Midpoint of y:
+                                cy = (rypx+lypx)*0.5
+                                ld_y = fmin(fabs(cy - (ysp+dysp)),
+                                            fabs(cy - (ysp-dysp)))
+                                ld_y *= ipx_dy
+                                if ld_x <= line_width or ld_y <= line_width:
+                                    my_array[j,i] = 1.0
+                            elif antialias == 1:
                                 overlap1 = ((fmin(rxpx, xsp+dxsp)
                                            - fmax(lxpx, (xsp-dxsp)))*ipx_dx)
                                 if overlap1 < 0.0: continue
                                 my_array[j,i] += (dsp * overlap1) * overlap2
                             else:
                                 my_array[j,i] = dsp
+                            
     return my_array
 
 @cython.cdivision(True)

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -36,7 +36,8 @@
 from yt.visualization.image_writer import apply_colormap
 from yt.utilities.lib.geometry_utils import triangle_plane_intersect
 from yt.utilities.lib.pixelization_routines import \
-    pixelize_element_mesh, pixelize_off_axis_cartesian
+    pixelize_element_mesh, pixelize_off_axis_cartesian, \
+    pixelize_cartesian
 from yt.analysis_modules.cosmological_observation.light_ray.light_ray import \
     periodic_ray
 from yt.utilities.lib.line_integral_convolution import \
@@ -2361,3 +2362,68 @@
         plot._axes.hold(False)
 
         return plot
+
+class CellEdgesCallback(PlotCallback):
+    """
+    annotate_cell_edges(line_width=1.0, alpha = 1.0, color = (0.0, 0.0, 0.0))
+
+    Annotate cell edges.  This is done through a second call to pixelize, where
+    the distance from a pixel to a cell boundary in pixels is compared against
+    the `line_width` argument.  The secondary image is colored as `color` and
+    overlaid with the `alpha` value.
+
+    Parameters
+    ----------
+    line_width : float
+        Distance, in pixels, from a cell edge that will mark a pixel as being
+        annotated as a cell edge.  Default is 1.0.
+    alpha : float
+        When the second image is overlaid, it will have this level of alpha
+        transparency.  Default is 1.0 (fully-opaque).
+    color : tuple of three floats
+        This is the color of the cell edge values.  It defaults to black.
+
+    Examples
+    --------
+
+    >>> import yt
+    >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
+    >>> s = yt.SlicePlot(ds, 'z', 'density')
+    >>> s.annotate_cell_edges()
+    >>> s.save()
+    """
+    _type_name = "cell_edges"
+    def __init__(self, line_width=1.0, alpha = 1.0, color=(0.0, 0.0, 0.0)):
+        PlotCallback.__init__(self)
+        self.line_width = line_width
+        self.alpha = alpha
+        self.color = (np.array(color) * 255).astype("uint8")
+
+    def __call__(self, plot):
+        x0, x1 = plot.xlim
+        y0, y1 = plot.ylim
+        xx0, xx1 = plot._axes.get_xlim()
+        yy0, yy1 = plot._axes.get_ylim()
+        plot._axes.hold(True)
+        nx = plot.image._A.shape[0]
+        ny = plot.image._A.shape[1]
+        im = pixelize_cartesian(plot.data['px'],
+                                plot.data['py'],
+                                plot.data['pdx'],
+                                plot.data['pdy'],
+                                plot.data['px'], # dummy field
+                                int(nx), int(ny),
+                                (x0, x1, y0, y1),
+                                line_width=self.line_width).transpose()
+        # New image:
+        im_buffer = np.zeros((nx, ny, 4), dtype="uint8")
+        im_buffer[im>0,3] = 255
+        im_buffer[im>0,:3] = self.color
+        plot._axes.imshow(im_buffer, origin='lower',
+                          interpolation='nearest',
+                          extent = [xx0, xx1, yy0, yy1],
+                          alpha = self.alpha)
+        plot._axes.set_xlim(xx0,xx1)
+        plot._axes.set_ylim(yy0,yy1)
+        plot._axes.hold(False)
+

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -462,7 +462,7 @@
         """
         if field == "all":
             self.x_log = log
-            for field in self.profiles[0].field_data.keys():
+            for field in list(self.profiles[0].field_data.keys()):
                 self.y_log[field] = log
         else:
             field, = self.profiles[0].data_source._determine_fields([field])
@@ -578,7 +578,7 @@
 
         """
         if field is 'all':
-            fields = self.axes.keys()
+            fields = list(self.axes.keys())
         else:
             fields = ensure_list(field)
         for profile in self.profiles:
@@ -697,7 +697,7 @@
     >>> # Change plot properties.
     >>> plot.set_cmap("cell_mass", "jet")
     >>> plot.set_zlim("cell_mass", 1e8, 1e13)
-    >>> plot.set_title("cell_mass", "This is a phase plot")
+    >>> plot.annotate_title("This is a phase plot")
 
     """
     x_log = None
@@ -971,7 +971,7 @@
         >>>  plot.annotate_text(1e-15, 5e4, "Hello YT")
 
         """
-        for f in self.data_source._determine_fields(self.plots.keys()):
+        for f in self.data_source._determine_fields(list(self.plots.keys())):
             if self.plots[f].figure is not None and text is not None:
                 self.plots[f].axes.text(xpos, ypos, text,
                                         fontproperties=self._font_properties,
@@ -1061,6 +1061,27 @@
         return self
 
     @invalidate_plot
+    def annotate_title(self, title):
+        """Set a title for the plot.
+
+        Parameters
+        ----------
+        title : str
+            The title to add.
+
+        Examples
+        --------
+
+        >>> plot.annotate_title("This is a phase plot")
+
+        """
+        for f in self.profile.field_data:
+            if isinstance(f, tuple):
+                f = f[1]
+            self.plot_title[self.data_source._determine_fields(f)[0]] = title
+        return self
+
+    @invalidate_plot
     def reset_plot(self):
         self.plots = {}
         return self

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/visualization/tests/test_callbacks.py
--- a/yt/visualization/tests/test_callbacks.py
+++ b/yt/visualization/tests/test_callbacks.py
@@ -341,6 +341,25 @@
             max_level=3, cmap="gist_stern")
         p.save(prefix)
 
+def test_cell_edges_callback():
+    with _cleanup_fname() as prefix:
+        ds = fake_amr_ds(fields = ("density",))
+        for ax in 'xyz':
+            p = ProjectionPlot(ds, ax, "density")
+            p.annotate_cell_edges()
+            yield assert_fname, p.save(prefix)[0]
+            p = ProjectionPlot(ds, ax, "density", weight_field="density")
+            p.annotate_cell_edges()
+            yield assert_fname, p.save(prefix)[0]
+            p = SlicePlot(ds, ax, "density")
+            p.annotate_cell_edges()
+            yield assert_fname, p.save(prefix)[0]
+        # Now we'll check a few additional minor things
+        p = SlicePlot(ds, "x", "density")
+        p.annotate_cell_edges(alpha=0.7, line_width=0.9,
+                              color=(0.0, 1.0, 1.0))
+        p.save(prefix)
+
 def test_line_integral_convolution_callback():
     with _cleanup_fname() as prefix:
         ds = fake_amr_ds(fields =

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/visualization/volume_rendering/lens.py
--- a/yt/visualization/volume_rendering/lens.py
+++ b/yt/visualization/volume_rendering/lens.py
@@ -277,8 +277,8 @@
         dz = np.dot(pos - position, camera.unit_vectors[2])
 
         # Transpose into image coords.
-        px = (res[0] * 0.5 + res[0] / camera.width[0].d * dx).astype('int')
-        py = (res[1] * 0.5 + res[1] / camera.width[1].d * dy).astype('int')
+        px = (res[0] * 0.5 + res[0] / width[0] * dx).astype('int64')
+        py = (res[1] * 0.5 + res[1] / width[1] * dy).astype('int64')
 
         return px, py, dz
 

diff -r 81dc5b3d563331842988e4a09e42232e833ddb14 -r def617b415dec95ac24052fd0d378a3700fcd092 yt/visualization/volume_rendering/tests/test_mesh_render.py
--- a/yt/visualization/volume_rendering/tests/test_mesh_render.py
+++ b/yt/visualization/volume_rendering/tests/test_mesh_render.py
@@ -52,6 +52,7 @@
     def mesh_render_image_func(filename_prefix):
         return im.write_image(filename_prefix)
 
+    mesh_render_image_func.__name__ = "func_{}".format(test_prefix)
     test = GenericImageTest(ds, mesh_render_image_func, decimals)
     test.prefix = test_prefix
     return test


https://bitbucket.org/yt_analysis/yt/commits/c55b7a1e36bf/
Changeset:   c55b7a1e36bf
Branch:      yt
User:        jzuhone
Date:        2016-04-06 18:09:47+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2102)

logging: don't create a StreamHandler unless we will use it. Closes #1024
Affected #:  1 file

diff -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 -r c55b7a1e36bf638dffa73074a047cc5c2e245bf7 yt/utilities/logger.py
--- a/yt/utilities/logger.py
+++ b/yt/utilities/logger.py
@@ -54,36 +54,43 @@
 
 ytLogger = logging.getLogger("yt")
 
-yt_sh = logging.StreamHandler(stream=stream)
-# create formatter and add it to the handlers
-formatter = logging.Formatter(ufstring)
-yt_sh.setFormatter(formatter)
-# add the handler to the logger
-ytLogger.addHandler(yt_sh)
-ytLogger.setLevel(level)
-ytLogger.propagate = False
- 
 def disable_stream_logging():
-    ytLogger.removeHandler(ytLogger.handlers[0])
+    if len(ytLogger.handlers) > 0:
+        ytLogger.removeHandler(ytLogger.handlers[0])
     h = logging.NullHandler()
     ytLogger.addHandler(h)
 
-original_emitter = yt_sh.emit
-
 def colorize_logging():
     f = logging.Formatter(cfstring)
     ytLogger.handlers[0].setFormatter(f)
     yt_sh.emit = add_coloring_to_emit_ansi(yt_sh.emit)
 
 def uncolorize_logging():
-    f = logging.Formatter(ufstring)
-    ytLogger.handlers[0].setFormatter(f)
-    yt_sh.emit = original_emitter
-
-if ytcfg.getboolean("yt", "coloredlogs"):
-    colorize_logging()
+    try:
+        f = logging.Formatter(ufstring)
+        ytLogger.handlers[0].setFormatter(f)
+        yt_sh.emit = original_emitter
+    except NameError:
+        # yt_sh and original_emitter are not defined because
+        # suppressStreamLogging is True, so we continue since there is nothing
+        # to uncolorize
+        pass
 
 if ytcfg.getboolean("yt", "suppressStreamLogging"):
     disable_stream_logging()
+else:
+    yt_sh = logging.StreamHandler(stream=stream)
+    # create formatter and add it to the handlers
+    formatter = logging.Formatter(ufstring)
+    yt_sh.setFormatter(formatter)
+    # add the handler to the logger
+    ytLogger.addHandler(yt_sh)
+    ytLogger.setLevel(level)
+    ytLogger.propagate = False
+
+    original_emitter = yt_sh.emit
+
+    if ytcfg.getboolean("yt", "coloredlogs"):
+        colorize_logging()
 
 ytLogger.debug("Set log level to %s", level)

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160406/dc6910bb/attachment-0001.htm>


More information about the yt-svn mailing list