[yt-users] help on ProjectionPlot

Renyue Cen cen at astro.princeton.edu
Mon Oct 1 06:31:12 PDT 2012


Hi,

I was trying some simple script for making ProjectionPlot and 
failed for some reason. Here is the script:

import os, sys, time
from yt.mods import * # set up our namespace
import h5py as h5
from yt.utilities.amr_kdtree.api import AMRKDTree

fn = "redshift0085" # parameter file to load
pf = load(fn, file_style="%s.grid.cpu%%04i") # load data

center = [0.5,0.5,0.5]
sp = pf.h.sphere(center, 1.0/pf['mpc'])

p = ProjectionPlot(sp, "x","Density")
p.set_width(1.0,'mpc')
p.save()


The error message is this:
    p = ProjectionPlot(sp, "x","Density")
Traceback (most recent call last):
  File "projectOVIgasCZ3z0200.py", line 24, in <module>
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 828, in __init__
    p = ProjectionPlot(sp, "x","Density")
    p = ProjectionPlot(sp, "x","Density")
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 828, in __init__
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 828, in __init__
    p = ProjectionPlot(sp, "x","Density")
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 828, in __init__
    (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
    (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
    (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 136, in GetBoundsAndCenter
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 136, in GetBoundsAndCenter
    (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 136, in GetBoundsAndCenter
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_window.py", line 136, in GetBoundsAndCenter
    width = (Wx/pf[unit], Wy/pf[unit])
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 327, in __getitem__
    width = (Wx/pf[unit], Wy/pf[unit])
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 327, in __getitem__
    width = (Wx/pf[unit], Wy/pf[unit])
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 327, in __getitem__
    width = (Wx/pf[unit], Wy/pf[unit])
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 327, in __getitem__
    self.get_data(key)
    self.get_data(key)
    self.get_data(key)
    self.get_data(key)
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 2510, in get_data
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 2510, in get_data
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 2510, in get_data
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 2510, in get_data
    if self._generate_field(field):
    if self._generate_field(field):
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 360, in _generate_field
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 360, in _generate_field
    if self._generate_field(field):
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 360, in _generate_field
    if self._generate_field(field):
  File "/u/jhwise/local/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/data_objects/data_containers.py", line 360, in _generate_field
    raise KeyError(field)
    raise KeyError(field)
KeyError: 'unitary'
    raise KeyError(field)
KeyError: 'unitary'
KeyError: 'unitary'
    raise KeyError(field)
KeyError: 'unitary'


Thanks in advance for your help 
Renyue

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20121001/c240a2c9/attachment.htm>


More information about the yt-users mailing list