[yt-dev] Issue #963: RAMSES particle depositition onto mesh does not work with filtered datasets (yt_analysis/yt)
Benjamin Thompson
issues-reply at bitbucket.org
Thu Dec 18 11:49:52 PST 2014
New issue 963: RAMSES particle depositition onto mesh does not work with filtered datasets
https://bitbucket.org/yt_analysis/yt/issue/963/ramses-particle-depositition-onto-mesh
Benjamin Thompson:
Hello.
With a RAMSES dataset. The deposition of particles onto a mesh works fine for unfilltered cases.
For example, should I call
```
#!python
print data["deposit,"io_density"]
```
I get answers which are sensible.
However, I wish to filter my particle data for stars/dark matter and treat the particles seperatly. If for example I do this,
```
#!python
def star_filter(pfilter,data):
filter = np.logical_and(data.particles.source["particle_age"] != 0, data.particles.source["particle_age"] != None)
return filter
add_particle_filter("stars", function=star_filter, filtered_type="all", requires=["particle_age"])
data.ds.add_particle_filter("stars")
```
Which filters the particles as expected, which also creates the fields
('deposit', 'io_cic')
('deposit', 'io_cic_velocity_x')
('deposit', 'io_cic_velocity_y')
('deposit', 'io_cic_velocity_z')
('deposit', 'io_count')
('deposit', 'io_density')
('deposit', 'io_mass')
('deposit', 'io_nn_velocity_x')
('deposit', 'io_nn_velocity_y')
('deposit', 'io_nn_velocity_z')
('deposit', 'stars_cic')
('deposit', 'stars_cic_velocity_x')
('deposit', 'stars_cic_velocity_y')
('deposit', 'stars_cic_velocity_z')
('deposit', 'stars_count')
('deposit', 'stars_density')
('deposit', 'stars_mass')
('deposit', 'stars_nn_velocity_x')
('deposit', 'stars_nn_velocity_y')
('deposit', 'stars_nn_velocity_z')
As you would expect
However, upon trying to call
print data["deposit,"stars_density"]
I get the error below
```
#!shell
Traceback (most recent call last):
File "selene_gradients.py", line 46, in <module>
print cylinder[("deposit", "stars_density")]
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 240, in __getitem__
self.get_data(f)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 673, in get_data
self._generate_fields(fields_to_generate)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 693, in _generate_fields
fd = self._generate_field(field)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 277, in _generate_field
tr = self._generate_fluid_field(field)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 295, in _generate_fluid_field
rv = self._generate_spatial_fluid(field, ngt_exception.ghost_zones)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 311, in _generate_spatial_fluid
ind += o.select(self.selector, self[field], rv, ind)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 240, in __getitem__
self.get_data(f)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 673, in get_data
self._generate_fields(fields_to_generate)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 693, in _generate_fields
fd = self._generate_field(field)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 277, in _generate_field
tr = self._generate_fluid_field(field)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 297, in _generate_fluid_field
rv = finfo(gen_obj)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/fields/derived_field.py", line 184, in __call__
dd = self._function(self, data)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/fields/particle_fields.py", line 106, in particle_density
pos = data[ptype, coord_name]
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/octree_subset.py", line 76, in __getitem__
tr = super(OctreeSubset, self).__getitem__(key)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 240, in __getitem__
self.get_data(f)
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 615, in get_data
with f.apply(self):
File "/home/bthompson1/python/yt/yt-x86_64/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/gpfs/home/bthompson1/python/yt/yt-x86_64/src/yt-hg/yt/data_objects/particle_filters.py", line 46, in apply
filter = self.function(self, dobj)
File "/gpfs/home/bthompson1/ramses_pp/ramses_pp/ben/real_selene_analysis/ramses_pp/modules/yt/YT.py", line 59, in star_filter
filter = np.logical_and(data.particles.source["particle_age"] != 0, data.particles.source["particle_age"] != None)
AttributeError: 'RAMSESDomainSubset' object has no attribute 'particles'
```
_______________________________________________
yt-dev mailing list
yt-dev at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
More information about the yt-dev
mailing list