HI Tomoyuki,

I'm not really sure, but I see that you're running a rather old version of yt. Can you update to the latest version and try it again? That might be the only way to debug this.

Britton

On Sat, Dec 18, 2021 at 1:55 PM Tomoyuki Shiokawa <201s408s@stu.kobe-u.ac.jp> wrote:
Hi, Mr. Smith

Thank you for your checking and advice.
After correcting the part you pointed out and executing it again,
Another error was displayed.
What does this error mean and what improvement is it asking me to do?
I am very sorry for the rudimentary question.

Tomoyuki

=================================================================================

import numpy as np
import yt
from yt.data_objects.level_sets.api import *

fname2 = 'Gadget2_arbitrary_grid.h5'
ds = yt.load(fname2)

data_source = ds.disk([0.5, 0.5, 0.5], [0.0, 0.0, 1.0], (8, "pc"), (1, "pc"))
master_clump = Clump(data_source, ("grid", "all_density"))

master_clump.add_validator("min_cells", 20)
master_clump.add_info_item("center_of_mass")

c_min = data_source["grid", "all_density"].min()
c_max = data_source["grid", "all_density"].max()
step = 2.0
print(c_min)
print(c_max)

find_clumps(master_clump, c_min, c_max, step)

-------------------------------------------------------------------------------------------------------------------------------------------

yt : [INFO     ] 2021-12-18 22:29:51,766 Parameters: current_time              = 10.68 code_time
yt : [INFO     ] 2021-12-18 22:29:51,769 Parameters: domain_dimensions         = [128 128 128]
yt : [INFO     ] 2021-12-18 22:29:51,772 Parameters: domain_left_edge          = [-10. -10. -10.] code_length
yt : [INFO     ] 2021-12-18 22:29:51,776 Parameters: domain_right_edge         = [10. 10. 10.] code_length
yt : [INFO     ] 2021-12-18 22:29:51,779 Parameters: cosmological_simulation   = 0
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-f7ea1136c4b7> in <module>()
     17 #master_clump = Clump(data_source, ("gas", "cell_density"))
     18
---> 19 master_clump = Clump(data_source, ("grid", "all_density"))
     20
     21 master_clump.add_validator("min_cells", 20)

/home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/data_objects/level_sets/clump_handling.pyc in __init__(self, data, field, parent, clump_info, validators, base, contour_key, contour_id)
     62         self.parent = parent
     63         self.quantities = data.quantities
---> 64         self.min_val = self.data[field].min()
     65         self.max_val = self.data[field].max()
     66         self.info = {}

/home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/numpy/core/_methods.pyc in _amin(a, axis, out, keepdims, initial)
     30 def _amin(a, axis=None, out=None, keepdims=False,
     31           initial=_NoValue):
---> 32     return umr_minimum(a, axis, None, out, keepdims, initial)
     33
     34 def _sum(a, axis=None, dtype=None, out=None, keepdims=False,

/home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/units/yt_array.pyc in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
   1371             if len(inputs) == 1:
   1372                 _, inp, u = get_inp_u_unary(ufunc, inputs)
-> 1373                 out_arr = func(np.asarray(inp), out=out, **kwargs)
   1374                 if ufunc in (multiply, divide) and method == 'reduce':
   1375                     power_sign = POWER_SIGN_MAPPING[ufunc]

ValueError: zero-size array to reduction operation minimum which has no identity
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: brittonsmith@gmail.com