[yt-users] sliceplot and frb problems
Kathy Eastwood
kathy.eastwood at nau.edu
Tue Nov 26 10:21:05 PST 2013
Dear (very helpful) yt folk:
I have been struggling with trying to make a slice plot of some FLASH data
that is an odd size; the volume is 1 kpc square in x and y, and 40 kpc tall
in z. The grid sizes vary widely, as expected. I have two questions: one,
I would like to understand the odd behavior that I get with regular
SlicePLots, and I would like some help using the FixedResolutionBuffer,
which I *suspect* is the way I want to go, but I have not been able to make
it work. I am using the newest version of yt (upgraded this morning!) on
Mac OS 10.7.5.
The SlicePlot weirdnesses:
from yt.mods import *
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.colorbar as cb
import numpy as np
pf = load("Strat_Box_hdf5_plt_cnt_0064")
#First try a 20 kpc tall box
slc = SlicePlot(pf, 'x',
'Density',center='c',width=((1,"kpc"),(20.0,"kpc")))
slc.annotate_title('This is a Density plot')
slc.save('test_20kpc.png')
slc.show()
#Please see plot at http://i.imgur.com/N65CNfU.png
#Now try a 5 kpc tall plot
slc = SlicePlot(pf, 'x', 'Density',center='c',width=((1,"kpc"),(5.0,"kpc")))
slc.annotate_title('This is a Density plot')
slc.save('test_5kpc.png')
slc.show()
#Please see plot at http://i.imgur.com/L1YORNK.png ; note that it seems to
filling
#a different part of the plotting "window"
#Now try a 2 kpc tall plot
slc = SlicePlot(pf, 'x', 'Density',center='c',width=((1,"kpc"),(2.0,"kpc")))
slc.annotate_title('This is a Density plot')
slc.save('test_2kpc.png')
slc.show()
#Please see plot at http://i.imgur.com/Bq1WaIP.png ; note that it seems to
filling
#even MORE of the plotting "window", but that the density labels were cut
off a bit.
OK, now the part that doesn't work. After reading, I decided that an frb
must be
the way to go, so I tried
frb = FixedResolutionBuffer(slc, (0.0, 1.0, 0.0, 1.0), (1024,1024))
plt.imshow(frb['Density'])
plt.savefig('test_figure.png')
and I get the following error. Note: I also tried slc.to_frb and that
didn't work either.
---------------------------------------------------------------------------AttributeError
Traceback (most recent call
last)<ipython-input-17-e68719d58ae4> in <module>()----> 1 frb =
FixedResolutionBuffer(slc, (0.0, 1.0, 0.0, 1.0), (1024,1024)) 2
plt.imshow(frb['Density']) 3 plt.savefig('test_figure.png')
4 5
/Users/kde/yt-x86_64/src/yt-hg/yt/visualization/fixed_resolution.pyc
in __init__(self, data_source, bounds, buff_size, antialias, periodic)
89 self.antialias = antialias 90 self.data =
{}---> 91 self.axis = data_source.axis 92
self.periodic = periodic 93
AttributeError: 'SlicePlot' object has no attribute 'axis'
THanks in advance for any help.
cheers
kathy
--
Kathy DeGioia Eastwood, Ph.D.
Professor of Physics and Astronomy
Northern Arizona University
Flagstaff, AZ 86011-6010
Ph: 928-523-7159 FX: 928-523-1371
Kathy.Eastwood at nau.edu
deliveries: 602 S. Humphreys St., Bldg 19 Rm 209
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131126/fd80cc8c/attachment.htm>
More information about the yt-users
mailing list