Fwd: ParticleProjectionPlot error
Guys, I get an error trying to use a simple ParticleProjectionPlot on a ARTIO dataset. It looks like ParticleProjectionPlot expect particular names for particle fields that the reader does not create. imp = yt.ParticleProjectionPlot(d,'z',center=[x0,y0,z0],width=(10,'kpc')) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/particle_plots.py", line 249, in __init__ splat_color=splat_color) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 660, in __init__ PlotWindow.__init__(self, *args, **kwargs) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 219, in __init__ self._setup_plots() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 748, in _setup_plots self._recreate_frb() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 272, in _recreate_frb self._frb._get_data_source_fields() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/fixed_resolution.py", line 646, in _get_data_source_fields self[f] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/fixed_resolution.py", line 586, in __getitem__ x_data = self.data_source.dd[ftype, self.x_field] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/data_objects/data_containers.py", line 282, in __getitem__ self.get_data(f) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/data_objects/data_containers.py", line 1331, in get_data particles, self, self._current_chunk) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/geometry/geometry_handler.py", line 227, in _read_particle_fields fields_to_read) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/utilities/io_handler.py", line 219, in _read_particle_selection for field_r, vals in self._read_particle_fields(chunks, ptf, selector): File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/frontends/artio/io.py", line 63, in _read_particle_fields rv = dict(**subset.fill_particles(fields)) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/frontends/artio/data_structures.py", line 107, in fill_particles count += species_data[i, f].size KeyError: (0, 'POSITION_X')
Hi Nick,
I think you need to explicitly set the fields that you're plotting, like
("Stars", "particle_position_x") and so forth. Here is an example:
http://yt-project.org/docs/dev/visualizing/plots.html#particle-plots
You can see what fields are available to plot by looking at the
"derived_field_list" hanging off of your dataset:
ds = yt.load("dataset")
print(ds.derived_field_list)
Look for particle-based ones that have "particle_position_x" and
"particle_position_y" present. I'm not sure the field_types associated with
ARTIO.
Hope this helps!
Cameron
On Thu, May 24, 2018 at 3:25 PM, Nick Gnedin
Guys,
I get an error trying to use a simple ParticleProjectionPlot on a ARTIO dataset. It looks like ParticleProjectionPlot expect particular names for particle fields that the reader does not create.
imp = yt.ParticleProjectionPlot(d,'z',center=[x0,y0,z0],width=(10,'kpc')) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/particle_plots.py", line 249, in __init__ splat_color=splat_color) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 660, in __init__ PlotWindow.__init__(self, *args, **kwargs) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 219, in __init__ self._setup_plots() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 748, in _setup_plots self._recreate_frb() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 272, in _recreate_frb self._frb._get_data_source_fields() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/fixed_resolution.py", line 646, in _get_data_source_fields self[f] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/fixed_resolution.py", line 586, in __getitem__ x_data = self.data_source.dd[ftype, self.x_field] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ data_objects/data_containers.py", line 282, in __getitem__ self.get_data(f) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ data_objects/data_containers.py", line 1331, in get_data particles, self, self._current_chunk) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/geometry/geometry_handler.py", line 227, in _read_particle_fields fields_to_read) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/utilities/io_handler.py", line 219, in _read_particle_selection for field_r, vals in self._read_particle_fields(chunks, ptf, selector): File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/frontends/artio/io.py", line 63, in _read_particle_fields rv = dict(**subset.fill_particles(fields)) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ frontends/artio/data_structures.py", line 107, in fill_particles count += species_data[i, f].size KeyError: (0, 'POSITION_X') _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- Cameron Hummels NSF Postdoctoral Fellow Department of Astronomy California Institute of Technology http://chummels.org
Hi Nick,
I seem to be able to make this plot using the public artio test dataset we
have at yt-project.org/data:
http://yt-project.org/data/sizmbhloz-clref04SNth-rs9_a0.9011.tar.gz
Using that dataset I'm able to run the following script:
```python
import yt
ds =
yt.load('sizmbhloz-clref04SNth-rs9_a0.9011/sizmbhloz-clref04SNth-rs9_a0.9011.art')
p = yt.ParticleProjectionPlot(ds, 'z')
p.save()
```
which produces this image: https://i.imgur.com/0lt31xR.png
So I think there's something about the dataset you're working with that's
breaking the artio frontend somehow. Judging from the traceback, yt is
trying to get the particle counts to allocate the numpy arrays that will
contain the particle position fields needed by the ParticleProjectionPlot
machinery. Somehow when we ask the artio octree handler how many particles
there are, we get a dict back that's either missing some of those counts or
is empty. It's hard for me to say more about what's going wrong without
being able to debug on a live dataset triggering the issue.
Is there any chance you can share either the dataset you're working with or
some other dataset that triggers this error? There's something different
about the dataset you're working with compared with the test dataset we
have which will help to explain what's going wrong.
-Nathan
On Thu, May 24, 2018 at 7:02 PM, Cameron Hummels
Hi Nick,
I think you need to explicitly set the fields that you're plotting, like ("Stars", "particle_position_x") and so forth. Here is an example:
http://yt-project.org/docs/dev/visualizing/plots.html#particle-plots
You can see what fields are available to plot by looking at the "derived_field_list" hanging off of your dataset:
ds = yt.load("dataset") print(ds.derived_field_list)
Look for particle-based ones that have "particle_position_x" and "particle_position_y" present. I'm not sure the field_types associated with ARTIO.
Hope this helps!
Cameron
On Thu, May 24, 2018 at 3:25 PM, Nick Gnedin
wrote: Guys,
I get an error trying to use a simple ParticleProjectionPlot on a ARTIO dataset. It looks like ParticleProjectionPlot expect particular names for particle fields that the reader does not create.
imp = yt.ParticleProjectionPlot(d,'z',center=[x0,y0,z0],width=(10,'kpc')) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/particle_plots.py", line 249, in __init__ splat_color=splat_color) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 660, in __init__ PlotWindow.__init__(self, *args, **kwargs) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 219, in __init__ self._setup_plots() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 748, in _setup_plots self._recreate_frb() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/visualization/plot_window.py", line 272, in _recreate_frb self._frb._get_data_source_fields() File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/fixed_resolution.py", line 646, in _get_data_source_fields self[f] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ visualization/fixed_resolution.py", line 586, in __getitem__ x_data = self.data_source.dd[ftype, self.x_field] File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ data_objects/data_containers.py", line 282, in __getitem__ self.get_data(f) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ data_objects/data_containers.py", line 1331, in get_data particles, self, self._current_chunk) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/geometry/geometry_handler.py", line 227, in _read_particle_fields fields_to_read) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/utilities/io_handler.py", line 219, in _read_particle_selection for field_r, vals in self._read_particle_fields(chunks, ptf, selector): File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/frontends/artio/io.py", line 63, in _read_particle_fields rv = dict(**subset.fill_particles(fields)) File "/data/gnedin/soft/anaconda3/lib/python3.6/site-packages/yt/ frontends/artio/data_structures.py", line 107, in fill_particles count += species_data[i, f].size KeyError: (0, 'POSITION_X') _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- Cameron Hummels NSF Postdoctoral Fellow Department of Astronomy California Institute of Technology http://chummels.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (3)
-
Cameron Hummels
-
Nathan Goldbaum
-
Nick Gnedin