[yt-users] using yt for non-spatial data

Britton Smith brittonsmith at gmail.com
Thu Apr 23 05:16:28 PDT 2015


Hi Carolin,

The first argument to ProjectionPlot should be a dataset object and not a
data container.  Can you try this instead:
pl=yt.ProjectionPlot(*mcyt*, 'x', 'y')

Additionally, if you want to project just the values in the sphere, you can
try this:
pl=yt.ProjectionPlot(*mcyt*, 'x', 'y', data_source=circle)

You're a pioneer in unexplored territory here, so please let us know how it
goes!

Britton


On Thu, Apr 23, 2015 at 10:56 AM, Carolin Villforth <cv21 at st-andrews.ac.uk>
wrote:

> Hello yt-users,
>
> I saw a yt presentation at the Python Astronomy Meeting and am interested
> to see if yt could be used for non-spatial data. My specific problem is
> MCMC chains in 19 (or up to 23) dimensional parameter space in which none
> of the parameters are nuisance parameters. I thought yt could be used to
> visualize and analyze such data. I tried to load the chain as particles and
> managed to do so, but am having problems plotting. I pasted the code below.
>
> Has anyone used yt for non-spatial data?
>
> Cheers,
>
> Carolin
>
>
> -----------
>
> In [81]: mcchain.keys() ## a dictionary containing dimensions of the chain
> Out[81]:
> ['particle_position_z',
>  'particle_mass',
>  'particle_position_x',
>  'particle_position_y',
>  'qso']
>
> In [82]: mcyt = yt.load_particles(mcchain)
> yt : [INFO     ] 2015-04-23 09:47:39,235 Parameters: current_time
>     = 0.0
> yt : [INFO     ] 2015-04-23 09:47:39,235 Parameters: domain_dimensions
>      = [2 2 2]
> yt : [INFO     ] 2015-04-23 09:47:39,237 Parameters: domain_left_edge
>     = [ 0.  0.  0.]
> yt : [INFO     ] 2015-04-23 09:47:39,237 Parameters: domain_right_edge
>      = [ 1.  1.  1.]
> yt : [INFO     ] 2015-04-23 09:47:39,238 Parameters:
> cosmological_simulation   = 0.0
>
> In [83]: circle = mcyt.sphere([0.5, 0.5, 0.5], 0.25)
> yt : [INFO     ] 2015-04-23 09:47:45,741 Allocating for 1.000e+04 particles
> yt : [INFO     ] 2015-04-23 09:47:45,763 Identified 7.130e+02 octs
> yt : [INFO     ] 2015-04-23 09:47:45,897 Loading field plugins.
> yt : [INFO     ] 2015-04-23 09:47:45,898 Loaded angular_momentum (8 new
> fields)
> yt : [INFO     ] 2015-04-23 09:47:45,898 Loaded astro (15 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,898 Loaded cosmology (22 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,899 Loaded fluid (64 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,900 Loaded fluid_vector (96 new
> fields)
> yt : [INFO     ] 2015-04-23 09:47:45,900 Loaded geometric (112 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,900 Loaded local (112 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,901 Loaded magnetic_field (120 new
> fields)
> yt : [INFO     ] 2015-04-23 09:47:45,901 Loaded my_plugins (120 new fields)
> yt : [INFO     ] 2015-04-23 09:47:45,901 Loaded species (122 new fields)
>
> In [84]: pl=yt.ProjectionPlot(circle, 'x', 'y')
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> <ipython-input-84-685c784708ec> in <module>()
> ----> 1 pl=yt.ProjectionPlot(circle, 'x', 'y')
>
> /Users/cvillforth/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/yt/visualization/plot_window.pyc
> in __init__(self, ds, axis, fields, center, width, axes_unit, weight_field,
> max_level, origin, fontsize, field_parameters, data_source, method,
> proj_style, window_size, aspect)
>    1212         self.ts = ts
>    1213         ds = self.ds = ts[0]
> -> 1214         axis = fix_axis(axis, ds)
>    1215         # proj_style is deprecated, but if someone specifies then
> it trumps
>    1216         # method.
>
> /Users/cvillforth/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/yt/funcs.pyc
> in fix_axis(axis, ds)
>     649
>     650 def fix_axis(axis, ds):
> --> 651     return ds.coordinates.axis_id.get(axis, axis)
>     652
>     653 def get_image_suffix(name):
>
> AttributeError: 'YTSphere' object has no attribute 'coordinates'
>
>
>
> --------------------------------------------------------------------------------
>   Dr Carolin Villforth
>   SUPA Advanced Fellow
>   University of St Andrews (SUPA)
>   School of Physics & Astronomy
>   North Haugh, St Andrews, Fife
>   KY16 9SS
>   UK
>   cv21 at st-andrews.ac.uk
>   Office: 272
>   phone +44 (0) 1334 46 1612
>   http://www-star.st-and.ac.uk/~cv21/cv21/Home.html
>
> --------------------------------------------------------------------------------
>
>
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150423/52831ef8/attachment.htm>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list