Hi yt, I have a pretty simple question that I ought to know the answer to - how do I extract the actual values in the field_list or derived_field_list of a ds? For example, I have a field: ('PartType0', 'Coordinates'), but printing something like pf[('PartType0','Coordinates')] doesn't return the list of particle type 0 coordinates (or anything for that matter). Do I have to access this through a pf.all_data() command somehow? Thanks -desika
Hey Desika, You're right, you need to use all_data: import yt ds = yt.load("your_dataset") ad = ds.all_data() print ad["PartType0", "Coordinates"] In general all yt data sources will print out the flattened data contained in the source when you query them like a dictionary using an unambiguous string field name or ('field_type', 'field name') tuple. Nathan On Thursday, May 22, 2014, Desika Narayanan <dnarayan@haverford.edu> wrote:
Hi yt,
I have a pretty simple question that I ought to know the answer to - how do I extract the actual values in the field_list or derived_field_list of a ds?
For example, I have a field: ('PartType0', 'Coordinates'),
but printing something like pf[('PartType0','Coordinates')] doesn't return the list of particle type 0 coordinates (or anything for that matter). Do I have to access this through a pf.all_data() command somehow?
Thanks -desika
This may also be a good option for you, Desika: http://yt-project.org/docs/dev-3.0/examining/low_level_inspection.html#exami... Cameron On Thu, May 22, 2014 at 10:38 AM, Nathan Goldbaum <nathan12343@gmail.com>wrote:
Hey Desika,
You're right, you need to use all_data:
import yt ds = yt.load("your_dataset") ad = ds.all_data() print ad["PartType0", "Coordinates"]
In general all yt data sources will print out the flattened data contained in the source when you query them like a dictionary using an unambiguous string field name or ('field_type', 'field name') tuple.
Nathan
On Thursday, May 22, 2014, Desika Narayanan <dnarayan@haverford.edu> wrote:
Hi yt,
I have a pretty simple question that I ought to know the answer to - how do I extract the actual values in the field_list or derived_field_list of a ds?
For example, I have a field: ('PartType0', 'Coordinates'),
but printing something like pf[('PartType0','Coordinates')] doesn't return the list of particle type 0 coordinates (or anything for that matter). Do I have to access this through a pf.all_data() command somehow?
Thanks -desika
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Cameron Hummels Postdoctoral Researcher Steward Observatory University of Arizona http://chummels.org
participants (3)
-
Cameron Hummels
-
Desika Narayanan
-
Nathan Goldbaum