[yt-users] empty plot issue
Matthew Turk
matthewturk at gmail.com
Wed Nov 27 06:11:35 PST 2013
Hi Kathy,
On Tue, Nov 26, 2013 at 2:41 PM, Kathy Eastwood <kathy.eastwood at nau.edu> wrote:
> Hi, helpful folks. Another issue I have been struggling with, which is
> similar to this thread
> http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2013-May/003652.html
>
> I am working on some FLASH data with the current version of yt using MacOS
> 10.7.5. Using this exact same data set, I managed to create some nice
> phaseplots using spheres centered on the densest spot. However, I now want
> to make some plots for a much larger volume of scientific interest...
> Here is the code
>
> from yt.mods import *
> %matplotlib inline
> import matplotlib.pyplot as plt
> import numpy as np
> pf = load("Strat_Box_hdf5_plt_cnt_0064")
> pc = PlotCollection(pf, [0.5, 0.5, 0.5])
> plane = pf.h.region([0.5,0.5,0.5],[0.0,0.0,0.4],[1.0,1.0,0.6])
> pc.save("plane_cnt_0064")
Hmm, is there a line missing here, where you create a profile or phase object?
>
> I then get the following error
>
> ValueError: Data has no positive values, and therefore can not be log-scaled
>
>
> Following the advice in the thread listed above, John Wise suggested
> "For your "empty" plot, do you have any gas with densities between
> 1e-26 and 1e-27 g/cm^3 in this sphere? If there's no gas in this
>
> range, then CellVolume will be zero and will give you that error
> message when it tries to take the log of CellVolume. If you want
> to manually inspect the CellVolume field, you can print out the following
> variable
> pc.plots[-1].data['CellVolume']
> which will give you the CellVolume as a function of the x-variable
> for the last plot you have added to your PlotCollection."
>
> The writer did not respond in the next thread, so I'm not sure if
>
> this worked. But when I try it, I get the following:
> KeyError Traceback (most recent call last)
> <ipython-input-18-71f93f9e2cb6> in <module>()
> ----> 1 pc.plots[-1].data["CellVolume"]
>
> /Users/kde/yt-x86_64/src/yt-hg/yt/data_objects/profiles.pyc in
> __getitem__(self, key)
> 160 # This raises a KeyError if it doesn't exist
> 161 # This is because we explicitly want to add all fields
> --> 162 return self.field_data[key]
> 163
> 164 def __setitem__(self, key, value):
>
> KeyError: 'CellVolume'
>
> Even though CellVolume is explicitly listed in my list of derived fields...
>
> Also, I did try the same command for Density rather than CellVolume,
>
> and the numbers were in the e-24 g cm-3 range...in fact, all the numbers
> were exactly the same. So I don't know if I've screwed up my data container
> somehow, or if the density values really are too low?
Well, one thing that immediately comes to mind is that your region
object looks smaller than what I'm used to in FLASH datasets, which
are typically in cgs. If you want to take the relative units
(relative to the box width) and scale them to be absolute in your
domain, you could do this like so:
C = np.array([0.5,0.5,0.5]) * pf.domain_width + pf.domain_left_edge
LE = np.array([0.0,0.0,0.4]) * pf.domain_width + pf.domain_left_edge
RE = np.array([1.0,1.0,0.6]) * pf.domain_width + pf.domain_left_edge
You can try making a plane again with these C, LE, RE values, but you
can also check the existing one by looking at
plane["Ones"]
and seeing how many values are returned there. Do you get anything back?
Hope that helps,
Matt
>
>
> any ideas?
> thanks SO much
> 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
>
> _______________________________________________
> 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