Clump Finding for Gadget2 format

Dear all, For my master's research, I installed yt and I want to load my research data converted to gadget2 format with yt. The function I want to use is the clump function, and I want to create a similar figure by performing the same processing as the Clump Finding below. https://yt-project.org/doc/cookbook/constructing_data_objects.html#cookbook-... First of all, I tried to test with the gadget data placed in the data index, but neither the default nor the hdf5 format works. Is it possible to do Clump Finding in Gadget2 format?

Hi there, Unfortunately, the clump finder won't work straight away on Gadget data because it relies on field data being on a grid. However, you should be able to create a covering_grid or arbitrary_grid to deposit particle fields onto. You can then use the save_as_dataset command to save this as a new dataset. The new dataset should work with the clump finder provided you have saved all the fields you need. Search for covering_grid or arbitrary_grid here: https://yt-project.org/docs/dev/analyzing/objects.html Saving reloadable data: https://yt-project.org/docs/dev/analyzing/saving_data.html Britton On Sat, Feb 27, 2021 at 7:46 AM <201s408s@stu.kobe-u.ac.jp> wrote:
Dear all,
For my master's research, I installed yt and I want to load my research data converted to gadget2 format with yt. The function I want to use is the clump function, and I want to create a similar figure by performing the same processing as the Clump Finding below.
https://yt-project.org/doc/cookbook/constructing_data_objects.html#cookbook-...
First of all, I tried to test with the gadget data placed in the data index, but neither the default nor the hdf5 format works. Is it possible to do Clump Finding in Gadget2 format? _______________________________________________ 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

Hi Mr. Britton Smith, Thank you very much for your very polite reply the other day. When I executed the processing of Gadget2 data that you taught me as follows and prepared for Clump Finding, I got an error like this. I don't know the cause of this error and the solution. If you have any advice, could you please let me know? Tomoyuki Shiokawa -------------------------------------------------------------------- import numpy as np import yt from yt.data_objects.level_sets.api import * fname = "Gadget2.0090" unit_base = { "UnitLength_in_cm": 3.08568e21, "UnitMass_in_g": 1.989e43, "UnitVelocity_in_cm_per_s": 100000, } bbox_lim = 70 # kpc bbox = [[-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim]] ds = yt.load(fname, unit_base=unit_base, bounding_box=bbox) sphere = ds.sphere([-2.13004994, 1.08833396, 0.87476391], (70, "kpc")) ds2 = sphere.save_as_dataset(fields=[("gas", "density"), ("all", "particle_mass")]) print(ds2) sphere_ds = yt.load(ds2) print(sphere_ds.data["grid", "density"]) data_source = sphere_ds.disk([0.5, 0.5, 0.5], [0.0, 0.0, 1.0], (8, "kpc"), (1, "kpc")) master_clump = Clump(data_source, ("gas", "density")) master_clump.add_validator("min_cells", 20) master_clump.add_info_item("center_of_mass") c_min = data_source["gas", "density"].min() c_max = data_source["gas", "density"].max() print(c_min) print(c_max) step = 2.0 find_clumps(master_clump, c_min, c_max, step) ---------------------------------------------------------------------------------------------------------------------------------------------------------- yt : [INFO ] 2021-11-01 12:05:14,115 Omega Lambda is 0.0, so we are turning off Cosmology. yt : [INFO ] 2021-11-01 12:05:14,245 Parameters: current_time = 10.68 yt : [INFO ] 2021-11-01 12:05:14,247 Parameters: domain_dimensions = [2 2 2] yt : [INFO ] 2021-11-01 12:05:14,253 Parameters: domain_left_edge = [-70. -70. -70.] yt : [INFO ] 2021-11-01 12:05:14,257 Parameters: domain_right_edge = [70. 70. 70.] yt : [INFO ] 2021-11-01 12:05:14,260 Parameters: cosmological_simulation = 0 yt : [INFO ] 2021-11-01 12:05:14,278 Allocating for 2.198e+06 particles (index particle type 'all') yt : [INFO ] 2021-11-01 12:05:14,705 Identified 1.478e+05 octs yt : [INFO ] 2021-11-01 12:06:02,589 Saving field data to yt dataset: Gadget2_sphere.h5. yt : [INFO ] 2021-11-01 12:06:03,130 Parameters: current_time = 10.68 code_time yt : [INFO ] 2021-11-01 12:06:03,132 Parameters: domain_dimensions = [2 2 2] Gadget2_sphere.h5 yt : [INFO ] 2021-11-01 12:06:03,138 Parameters: domain_left_edge = [-70. -70. -70.] code_length yt : [INFO ] 2021-11-01 12:06:03,149 Parameters: domain_right_edge = [70. 70. 70.] code_length yt : [INFO ] 2021-11-01 12:06:03,156 Parameters: cosmological_simulation = 0 yt : [INFO ] 2021-11-01 12:06:03,176 Allocating for 3.232e+06 particles (index particle type 'all') yt : [INFO ] 2021-11-01 12:06:04,515 Identified 8.938e+05 octs [0.00000000e+00 0.00000000e+00 2.01374744e-24 ... 0.00000000e+00 0.00000000e+00 0.00000000e+00] g/cm**3 yt : [INFO ] 2021-11-01 12:06:07,879 Finding clumps: min: 0.000000e+00, max: 3.546025e-16, step: 2.000000 0.0 g/cm**3 3.5460253791689846e-16 g/cm**3 --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-21-0dcc2997b138> in <module>() 36 print(c_max) 37 step = 2.0 ---> 38 find_clumps(master_clump, c_min, c_max, step) /home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/data_objects/level_sets/clump_handling.pyc in find_clumps(clump, min_val, max_val, d_clump) 410 (min_val, max_val, d_clump)) 411 if min_val >= max_val: return --> 412 clump.find_children(min_val) 413 414 if len(clump.children) == 1: /home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/data_objects/level_sets/clump_handling.pyc in find_children(self, min_val, max_val) 161 self.children = [] 162 if max_val is None: max_val = self.max_val --> 163 nj, cids = identify_contours(self.data, self.field, min_val, max_val) 164 # Here, cids is the set of slices and values, keyed by the 165 # parent_grid_id, that defines the contours. So we can figure out all /home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/data_objects/level_sets/contour_finder.pyc in identify_contours(data_source, field, min_val, max_val, cached_fields) 34 DLE = data_source.ds.domain_left_edge 35 masks = dict((g.id, m) for g, m in data_source.blocks) ---> 36 for (g, node, (sl, dims, gi)) in data_source.tiles.slice_traverse(): 37 g.field_parameters.update(data_source.field_parameters) 38 node.node_ind = len(node_ids) /home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in tiles(self) 1195 def tiles(self): 1196 if self._tree is not None: return self._tree -> 1197 self._tree = AMRKDTree(self.ds, data_source=self) 1198 return self._tree 1199 /home/salty1840/anaconda3/envs/yt3/lib/python2.7/site-packages/yt/utilities/amr_kdtree/amr_kdtree.pyc in __init__(self, ds, min_level, max_level, data_source) 155 156 if not issubclass(ds.index.__class__, GridIndex): --> 157 raise RuntimeError("AMRKDTree does not support particle or octree-based data.") 158 159 ParallelAnalysisInterface.__init__(self) RuntimeError: AMRKDTree does not support particle or octree-based data.

Hi there, As I received the advice the other day, I converted the Gadget2 data to arbitrary_grid data by referring to the following URL, https://yt-project.org/docs/dev/analyzing/objects.html https://yt-project.org/docs/dev/analyzing/saving_data.html and reloaded it. As I received the advice the other day, I converted the Gadget2 data to arbitrary_grid data by referring to the following URL, and reloaded it. Then, probably because the converted data does not have the necessary data elements, an error is displayed and clamp finding is not possible. What elements should be added to the arbitrary_grid data in order to perform the clamp finding introduced on the homepage? We apologize for the inconvenience, but thank you for your reply. Below are all the results of the execution. It's very hard to see, but please forgive me. ================================================================================= import numpy as np import yt from yt.data_objects.level_sets.api import * fname = "Gadget2.0090" bbox_lim = 70 # pc bbox = [[-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim]] ds = yt.load(fname, bounding_box=bbox) ds.index sorted(ds.field_list) print(ds.field_list) obj = ds.arbitrary_grid([-10, -10, -10], [10, 10, 10], dims=[128, 128, 128]) print(obj) ds2 = obj.save_as_dataset(fields=[("deposit", "all_density"), ("deposit", "all_mass")]) print(ds2) ------------------------------------------------------------------------------------------------------------------------------------------- yt : [INFO ] 2021-12-15 11:52:05,207 Omega Lambda is 0.0, so we are turning off Cosmology. yt : [INFO ] 2021-12-15 11:52:05,209 Assuming length units are in kpc (physical) yt : [INFO ] 2021-12-15 11:52:05,280 Parameters: current_time = 10.68 yt : [INFO ] 2021-12-15 11:52:05,282 Parameters: domain_dimensions = [2 2 2] yt : [INFO ] 2021-12-15 11:52:05,284 Parameters: domain_left_edge = [-70. -70. -70.] yt : [INFO ] 2021-12-15 11:52:05,286 Parameters: domain_right_edge = [70. 70. 70.] yt : [INFO ] 2021-12-15 11:52:05,289 Parameters: cosmological_simulation = 0 yt : [INFO ] 2021-12-15 11:52:05,295 Allocating for 2.198e+06 particles (index particle type 'all') yt : [INFO ] 2021-12-15 11:52:05,780 Identified 1.478e+05 octs [('Gas', 'Coordinates'), ('Gas', 'Density'), ('Gas', 'InternalEnergy'), ('Gas', 'Mass'), ('Gas', 'ParticleIDs'), ('Gas', 'SmoothingLength'), ('Gas', 'Velocities'), ('Stars', 'Coordinates'), ('Stars', 'Mass'), ('Stars', 'ParticleIDs'), ('Stars', 'Velocities'), ('all', 'Coordinates'), ('all', 'Mass'), ('all', 'ParticleIDs'), ('all', 'Velocities')] YTArbitraryGrid (Gadget2): , left_edge=[-3.08567758e+22 -3.08567758e+22 -3.08567758e+22] cm, right_edge=[3.08567758e+22 3.08567758e+22 3.08567758e+22] cm, ActiveDimensions=[128 128 128] yt : [INFO ] 2021-12-15 11:52:09,509 Saving field data to yt dataset: Gadget2_arbitrary_grid.h5. Gadget2_arbitrary_grid.h5 ================================================================================= import yt fname2 = 'Gadget2_arbitrary_grid.h5' sphere_ds = yt.load(fname2) sphere_ds.index sorted(sphere_ds.field_list) ------------------------------------------------------------------------------------------------------------------------------------------- yt : [INFO ] 2021-12-15 11:52:15,177 Parameters: current_time = 10.68 code_time yt : [INFO ] 2021-12-15 11:52:15,179 Parameters: domain_dimensions = [128 128 128] yt : [INFO ] 2021-12-15 11:52:15,181 Parameters: domain_left_edge = [-10. -10. -10.] code_length yt : [INFO ] 2021-12-15 11:52:15,183 Parameters: domain_right_edge = [10. 10. 10.] code_length yt : [INFO ] 2021-12-15 11:52:15,187 Parameters: cosmological_simulation = 0 [('grid', 'all_density'), ('grid', 'all_mass'), ('grid', 'dx'), ('grid', 'dy'), ('grid', 'dz'), ('grid', 'x'), ('grid', 'y'), ('grid', 'z')] ================================================================================= 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(ds, ("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-15 13:11:53,189 Parameters: current_time = 10.68 code_time yt : [INFO ] 2021-12-15 13:11:53,191 Parameters: domain_dimensions = [128 128 128] yt : [INFO ] 2021-12-15 13:11:53,193 Parameters: domain_left_edge = [-10. -10. -10.] code_length yt : [INFO ] 2021-12-15 13:11:53,195 Parameters: domain_right_edge = [10. 10. 10.] code_length yt : [INFO ] 2021-12-15 13:11:53,198 Parameters: cosmological_simulation = 0 --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-f88c4eeda40e> in <module>() 17 #master_clump = Clump(data_source, ("gas", "cell_density")) 18 ---> 19 master_clump = Clump(ds, ("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) 61 self.field = field 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() AttributeError: 'YTGridDataset' object has no attribute 'quantities'

Hi Tomoyuki, It looks like you might almost have it. The one error I spotted is that the Clump object needs to be given a data container (i.e., the disk object you call data_source) instead of a dataset. If you change it to something like below, I think it should work. master_clump = Clump(data_sourece, ("grid", "all_density")) Britton On Thu, Dec 16, 2021 at 9:25 AM Tomoyuki Shiokawa <201s408s@stu.kobe-u.ac.jp> wrote:
Hi there,
As I received the advice the other day, I converted the Gadget2 data to arbitrary_grid data by referring to the following URL, https://yt-project.org/docs/dev/analyzing/objects.html https://yt-project.org/docs/dev/analyzing/saving_data.html and reloaded it.
As I received the advice the other day, I converted the Gadget2 data to arbitrary_grid data by referring to the following URL, and reloaded it. Then, probably because the converted data does not have the necessary data elements, an error is displayed and clamp finding is not possible.
What elements should be added to the arbitrary_grid data in order to perform the clamp finding introduced on the homepage? We apologize for the inconvenience, but thank you for your reply.
Below are all the results of the execution. It's very hard to see, but please forgive me.
=================================================================================
import numpy as np import yt from yt.data_objects.level_sets.api import *
fname = "Gadget2.0090" bbox_lim = 70 # pc bbox = [[-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim], [-bbox_lim, bbox_lim]]
ds = yt.load(fname, bounding_box=bbox) ds.index sorted(ds.field_list) print(ds.field_list)
obj = ds.arbitrary_grid([-10, -10, -10], [10, 10, 10], dims=[128, 128, 128]) print(obj) ds2 = obj.save_as_dataset(fields=[("deposit", "all_density"), ("deposit", "all_mass")]) print(ds2)
------------------------------------------------------------------------------------------------------------------------------------------- yt : [INFO ] 2021-12-15 11:52:05,207 Omega Lambda is 0.0, so we are turning off Cosmology. yt : [INFO ] 2021-12-15 11:52:05,209 Assuming length units are in kpc (physical) yt : [INFO ] 2021-12-15 11:52:05,280 Parameters: current_time = 10.68 yt : [INFO ] 2021-12-15 11:52:05,282 Parameters: domain_dimensions = [2 2 2] yt : [INFO ] 2021-12-15 11:52:05,284 Parameters: domain_left_edge = [-70. -70. -70.] yt : [INFO ] 2021-12-15 11:52:05,286 Parameters: domain_right_edge = [70. 70. 70.] yt : [INFO ] 2021-12-15 11:52:05,289 Parameters: cosmological_simulation = 0 yt : [INFO ] 2021-12-15 11:52:05,295 Allocating for 2.198e+06 particles (index particle type 'all') yt : [INFO ] 2021-12-15 11:52:05,780 Identified 1.478e+05 octs
[('Gas', 'Coordinates'), ('Gas', 'Density'), ('Gas', 'InternalEnergy'), ('Gas', 'Mass'), ('Gas', 'ParticleIDs'), ('Gas', 'SmoothingLength'), ('Gas', 'Velocities'), ('Stars', 'Coordinates'), ('Stars', 'Mass'), ('Stars', 'ParticleIDs'), ('Stars', 'Velocities'), ('all', 'Coordinates'), ('all', 'Mass'), ('all', 'ParticleIDs'), ('all', 'Velocities')] YTArbitraryGrid (Gadget2): , left_edge=[-3.08567758e+22 -3.08567758e+22 -3.08567758e+22] cm, right_edge=[3.08567758e+22 3.08567758e+22 3.08567758e+22] cm, ActiveDimensions=[128 128 128]
yt : [INFO ] 2021-12-15 11:52:09,509 Saving field data to yt dataset: Gadget2_arbitrary_grid.h5. Gadget2_arbitrary_grid.h5
=================================================================================
import yt
fname2 = 'Gadget2_arbitrary_grid.h5' sphere_ds = yt.load(fname2) sphere_ds.index sorted(sphere_ds.field_list)
------------------------------------------------------------------------------------------------------------------------------------------- yt : [INFO ] 2021-12-15 11:52:15,177 Parameters: current_time = 10.68 code_time yt : [INFO ] 2021-12-15 11:52:15,179 Parameters: domain_dimensions = [128 128 128] yt : [INFO ] 2021-12-15 11:52:15,181 Parameters: domain_left_edge = [-10. -10. -10.] code_length yt : [INFO ] 2021-12-15 11:52:15,183 Parameters: domain_right_edge = [10. 10. 10.] code_length yt : [INFO ] 2021-12-15 11:52:15,187 Parameters: cosmological_simulation = 0
[('grid', 'all_density'), ('grid', 'all_mass'), ('grid', 'dx'), ('grid', 'dy'), ('grid', 'dz'), ('grid', 'x'), ('grid', 'y'), ('grid', 'z')]
=================================================================================
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(ds, ("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-15 13:11:53,189 Parameters: current_time = 10.68 code_time yt : [INFO ] 2021-12-15 13:11:53,191 Parameters: domain_dimensions = [128 128 128] yt : [INFO ] 2021-12-15 13:11:53,193 Parameters: domain_left_edge = [-10. -10. -10.] code_length yt : [INFO ] 2021-12-15 13:11:53,195 Parameters: domain_right_edge = [10. 10. 10.] code_length yt : [INFO ] 2021-12-15 13:11:53,198 Parameters: cosmological_simulation = 0
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-f88c4eeda40e> in <module>() 17 #master_clump = Clump(data_source, ("gas", "cell_density")) 18 ---> 19 master_clump = Clump(ds, ("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) 61 self.field = field 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()
AttributeError: 'YTGridDataset' object has no attribute 'quantities' _______________________________________________ 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

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

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

Hi, Mr. Smith, Thank you for your email the other day. After updating yt to the latest version, I tried running it again, but it didn't work. The other day, I made the execution result into pdf, attached it to a new email, and added it to yt-user. I think the email is on the mailing list, one above this thread. If you have any advice, please reply. Tomoyuki

Hi Tomoyuki, My apologies for taking so long to get back to you. If this is something you are still working on, I should be able to help take a look at it now. From the pdf, I can't quite see why you are getting that error. Would it be possible to share the arbitrary grid dataset that you were using ('Gadget2_arbitrary_grid.h5')? If so, I'm happy to try and debug this. Britton On Thu, Jan 6, 2022 at 10:36 AM Tomoyuki Shiokawa <201s408s@stu.kobe-u.ac.jp> wrote:
Hi, Mr. Smith,
Thank you for your email the other day. After updating yt to the latest version, I tried running it again, but it didn't work. The other day, I made the execution result into pdf, attached it to a new email, and added it to yt-user. I think the email is on the mailing list, one above this thread.
If you have any advice, please reply.
Tomoyuki _______________________________________________ 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
participants (3)
-
201s408s@stu.kobe-u.ac.jp
-
Britton Smith
-
Tomoyuki Shiokawa