[yt-dev] Issue #848: PR #926 causes build failure for the docs (yt_analysis/yt)

Kacper Kowalik issues-reply at bitbucket.org
Wed Jun 4 02:09:37 PDT 2014


New issue 848: PR #926 causes build failure for the docs
https://bitbucket.org/yt_analysis/yt/issue/848/pr-926-causes-build-failure-for-the-docs

Kacper Kowalik:

After pull request #926 following script:


```
#!python

from yt.mods import *
from yt.analysis_modules.halo_analysis.api import *
import tempfile
import shutil
import os
tmpdir = tempfile.mkdtemp()
data_pf = load('Enzo_64/RD0006/RedshiftOutput0006')
halos_pf = load('rockstar_halos/halos_0.0.bin')
hc = HaloCatalog(data_pf=data_pf, halos_pf=halos_pf,
                 output_dir=os.path.join(tmpdir, 'halo_catalog'))
hc.add_filter("quantity_value", "particle_mass", ">", 1e14, "Msun")
hc.add_callback("sphere", factor=2.0)
hc.add_callback("profile", x_field="radius",
                y_fields=[("gas", "overdensity")],
                weight_field="cell_volume",
                accumulation=False,
                storage="virial_quantities_profiles")
hc.add_callback("virial_quantities", ["radius"],
                profile_storage = "virial_quantities_profiles")
hc.add_callback('delete_attribute','virial_quantities_profiles')
hc.add_callback('sphere', radius_field='radius_200', factor=5,
                field_parameters=dict(virial_radius=('quantity', 'radius_200')))
hc.add_callback('profile', 'virial_radius', [('gas','temperature')],
                storage='virial_profiles',
                weight_field='cell_mass',
                accumulation=False, output_dir='profiles')
hc.add_callback("save_profiles", storage="virial_profiles", output_dir="profiles")
hc.create()
```

yields


```
#!text

Traceback (most recent call last):
  File "bug.py", line 28, in <module>
    hc.create()
  File "yt/analysis_modules/halo_analysis/halo_catalog.py", line 284, in create
    self._run(save_halos, save_catalog, njobs=njobs, dynamic=dynamic)
  File "yt/utilities/parallel_tools/parallel_analysis_interface.py", line 244, in barrierize
    return func(*args, **kwargs)
  File "yt/analysis_modules/halo_analysis/halo_catalog.py", line 375, in _run
    action(new_halo)
  File "yt/analysis_modules/halo_analysis/halo_callbacks.py", line 55, in __call__
    self.function(halo, *self.args, **self.kwargs)
  File "yt/analysis_modules/halo_analysis/halo_callbacks.py", line 213, in profile
    x_range = list(halo.data_object.quantities.extrema(x_field, non_zero=True))
  File "/home/xarth/yt/src/yt-my/yt/data_objects/derived_quantities.py", line 483, in __call__
    rv = super(Extrema, self).__call__(fields, non_zero)
  File "yt/data_objects/derived_quantities.py", line 68, in __call__
    values = [self.data_source.pf.arr(values[i]) for i in range(self.num_vals)]
  File "yt/units/yt_array.py", line 288, in __new__
    if isinstance(input_array[0], YTArray):
IndexError: list index out of range

```

There two issues here:

1. `yt_array:YTArray.__new__` should take into account that empty list is iterable. Simple `elif iterable(input_array) and input_array` should fix that.
1. Real bug is that quantity *Extrema* for *radius* suddenly returns empty list for `halo.data_object`

Responsible: ngoldbaum



More information about the yt-dev mailing list