Issue #976: Sphere object creation and RAMSES - fails with a ValueError (yt_analysis/yt)
New issue 976: Sphere object creation and RAMSES - fails with a ValueError https://bitbucket.org/yt_analysis/yt/issue/976/sphere-object-creation-and-ra... Benjamin Thompson: Hello. Using the sample dataset hosted on YT http://yt-project.org/data/output_00101.tar.gz, I have encountered a bug with the sphere field. this code ``` #!python import yt from yt import derived_field from yt.units.yt_array import YTArray snap = yt.load("test_gal/output_00101/info_00101.txt") snapa = snap.all_data() b = snapa.ds.arr(2,"kpc") print b.in_units("code_length") sphere = snapa.ds.sphere([ 0.50638366, 0.50013661, 0.49566656], b) print sphere #print sphere["index"], "index" print sphere["particle_mass"], "particle mass" sphere2 = snapa.ds.sphere([ 0.50638366, 0.50013661, 0.49566656], 7.01290365998e-05) print sphere2 #print sphere2["index"], "index" print sphere2["particle_mass"], "particle mass" sphere3 = snapa.ds.sphere([ 0.50638366, 0.50013661, 0.49566656], 0.00869399672932) print sphere3 #print sphere3["index"], "index" print sphere3["particle_mass"], "particle mass" ``` will return this error ``` #!python YTSphere (info_00101): center=[ 0.50638366 0.50013661 0.49566656] code_length, radius=2.3424788685e-05 code_length --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /gpfs/home/bthompson1/ramses_pp/ramses_pp/ben/real_selene_analysis/test_highz.py in <module>() 63 #print sphere["index"], "index" 64 ---> 65 print sphere["particle_mass"], "particle mass" 66 67 /gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __getitem__(self, key) 246 return self.field_data[f] 247 else: --> 248 self.get_data(f) 249 # fi.units is the unit expression string. We depend on the registry 250 # hanging off the dataset to define this unit object. /gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields) 685 686 read_particles, gen_particles = self.index._read_particle_fields( --> 687 particles, self, self._current_chunk) 688 for f, v in read_particles.items(): 689 self.field_data[f] = self.ds.arr(v, input_units = finfos[f].units) /gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/geometry/geometry_handler.pyc in _read_particle_fields(self, fields, dobj, chunk) 232 self._chunk_io(dobj, cache = False), 233 selector, --> 234 fields_to_read) 235 return fields_to_return, fields_to_generate 236 /gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/utilities/io_handler.pyc in _read_particle_selection(self, chunks, selector, fields) 181 # mylog.debug("Filling %s from %s to %s with %s", 182 # field_f, my_ind, my_ind+vals.shape[0], field_r) --> 183 rv[field_f][my_ind:my_ind + vals.shape[0],...] = vals 184 ind[field_f] += vals.shape[0] 185 # Now we need to truncate all our fields, since we allow for ``` _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (1)
-
Benjamin Thompson