Repository: yt-project/yt

Issue:
Volume Rendering Not Working
### Bug report

**Bug summary**

Follow the volume rendering tutorial on [yt-project website](https://yt-project.org/doc/visualizing/volume_rendering.html#transfer-functions), but it ends up with an error.

**Code for reproduction**

```python
import yt

ds = yt.load("Enzo_64/DD0043/data0043")

sc = yt.create_scene(ds, lens_type="perspective")

# Get a reference to the VolumeSource associated with this scene
# It is the first source associated with the scene, so we can refer to it
# using index 0.
source = sc[0]

# Set the bounds of the transfer function
source.tfh.set_bounds((3e-31, 5e-27))

# set that the transfer function should be evaluated in log space
source.tfh.set_log(True)

# Make underdense regions appear opaque
source.tfh.grey_opacity = True

# Plot the transfer function, along with the CDF of the density field to
# see how the transfer function corresponds to structure in the CDF
source.tfh.plot("transfer_function.png", profile_field=("gas", "density"))

# save the image, flooring especially bright pixels for better contrast
sc.save("rendering.png", sigma_clip=6.0)
```

**Actual outcome**
```
Traceback (most recent call last):
  File "VolumeRendering.py", line 26, in <module>
    sc.save("rendering.png", sigma_clip=6.0)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/scene.py", line 335, in save
    fname = self._setup_save(fname, render)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/scene.py", line 253, in _setup_save
    self._render_on_demand(render)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/scene.py", line 246, in _render_on_demand
    self.render()
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/scene.py", line 225, in render
    bmp = self.composite(camera=camera)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/scene.py", line 553, in composite
    im = source.render(camera, zbuffer=opaque)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/render_source.py", line 82, in wrapper
    return f(*args, **kwargs)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/render_source.py", line 532, in render
    self.set_sampler(camera)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/render_source.py", line 429, in set_sampler
    sampler = new_volume_render_sampler(camera, self)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/utils.py", line 56, in new_volume_render_sampler
    params = ensure_code_unit_params(camera._get_sampler_params(render_source))
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/camera.py", line 290, in _get_sampler_params
    lens_params = self.lens._get_sampler_params(self, render_source)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/visualization/volume_rendering/lens.py", line 236, in _get_sampler_params
    mylog.debug(positions)
  File "/home/calab912/software/python/python3.8/lib/python3.8/logging/__init__.py", line 1422, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/home/calab912/software/python/python3.8/lib/python3.8/logging/__init__.py", line 1577, in _log
    self.handle(record)
  File "/home/calab912/software/python/python3.8/lib/python3.8/logging/__init__.py", line 1586, in handle
    if (not self.disabled) and self.filter(record):
  File "/home/calab912/software/python/python3.8/lib/python3.8/logging/__init__.py", line 807, in filter
    result = f.filter(record)
  File "/home/calab912/software/python/python3.8/lib/python3.8/site-packages/yt/utilities/logger.py", line 95, in filter
    if not record.msg.startswith("The Derived Field"):
AttributeError: 'unyt_array' object has no attribute 'startswith'

```

**Expected outcome**

![cbe33dfa871c4cae91207c47b91f4745rendering](https://user-images.githubusercontent.com/6188366/136653692-af5fa687-fe25-4df7-8315-d2be02408b65.png)
![cf955b6a798e471982aec60c01ee0d35transfer_function](https://user-images.githubusercontent.com/6188366/136653696-a025a2f1-b5a2-4a7b-b106-848736cc8146.png)

**Version Information**

  * Operating System: Ubuntu 20.04
  * Python Version: 3.8
  * yt version: 4.1.dev [`yt/main`](https://github.com/yt-project/yt/commit/c6caf13b80c9495a6a8e8bb1ea6d5983ae8566e3)
    * Install from source, using `pip`

<!--Please tell us how you installed yt and python e.g., from source,
pip, conda. If you installed from conda, please specify which channel you used
if not the default-->



Discussion:
bug confirmed. Note however that the bug is purely in the logging message, and your script works perfectly if you set yt's logger level above `DEBUG`. This is the case by default and I guess that's why the doc page you took inspiration from isn't broken.
I absolutely agree the bug needs fixing. In the mean time here's the workaround:
```python
yt.set_log_level("info")
```

Resolving patch:
diff --git a/yt/visualization/volume_rendering/lens.py b/yt/visualization/volume_rendering/lens.py
--- a/yt/visualization/volume_rendering/lens.py
+++ b/yt/visualization/volume_rendering/lens.py
@@ -1,7 +1,6 @@
 import numpy as np
 
 from yt.data_objects.image_array import ImageArray
-from yt.funcs import mylog
 from yt.units.yt_array import uhstack, unorm, uvstack
 from yt.utilities.lib.grid_traversal import arr_fisheye_vectors
 from yt.utilities.math_utils import get_rotation_matrix
@@ -233,9 +232,6 @@ def _get_sampler_params(self, camera, render_source):
             lens_type="perspective",
         )
 
-        mylog.debug(positions)
-        mylog.debug(vectors)
-
         return sampler_params
 
     def set_viewpoint(self, camera):
@@ -427,9 +423,6 @@ def _get_positions_vectors(self, camera, disparity):
         # Here the east_vecs is non-rotated one
         positions = positions + east_vecs * disparity
 
-        mylog.debug(positions)
-        mylog.debug(vectors)
-
         return vectors, positions
 
     def project_to_plane(self, camera, pos, res=None):


Test patch: