[yt-users] plotting program
j s oishi
jsoishi at gmail.com
Mon Jan 27 16:23:26 PST 2014
Hi Kathy,
You don't need the load call. The ts has already loaded it for you. fn is
actually a pf!
Just do
for i, pf in enumerate(ts):
sl = pf.h.slice(...)
and it'll work.
See here:
http://yt-project.org/docs/dev/bootcamp/data_objects_and_time_series.html
for more examples.
Let me know if this doesn't help.
j
On Mon, Jan 27, 2014 at 7:20 PM, Kathy Eastwood <kathy.eastwood at nau.edu>wrote:
> hi, helpful folks
>
>
> I am once again very confused, and would appreciate any help. I am still
> trying to make a plot which contains frb's created from datafiles at
> different time steps. This is what I have that I think should work, and
> doesn't:
>
> from yt.mods import *
> %matplotlib inline
> import matplotlib.pyplot as plt
> import matplotlib.colorbar as cb
> from matplotlib.colors import LogNorm
> import numpy as np
>
> ts = TimeSeriesData.from_filenames("Strat_Box_hdf5_plt_cnt_01*")
>
> print len(ts) #just checking
> num = len(ts)
>
> for index, val in enumerate(ts):
> print "%s = %s" % (index, val) #again, just checking that this does
> what I think
>
> orient = 'vertical'
> fig, axes, colorbars = get_multi_plot( num, 1, colorbar=orient, bw = 6)
>
> plots = []
>
> for i, fn in enumerate(ts):
> pf = load(fn) # load data
> sl = pf.h.slice(0,
> pf.domain_center[0],fields=["Density","Temperature"] )
> frb = sl.to_frb( (1.0, 'kpc'), (4096,1024),height=(4.0, 'kpc'))
> dens_axes = [axes[0][i]]
> for ax in dens_axes:
> ax.xaxis.set_visible(False)
> ax.yaxis.set_visible(False)
> plots = [dens_axes[0].imshow(frb["Density"], origin='lower',
> norm=LogNorm())]
>
> These are the errors that I get;
>
> TypeError Traceback (most recent call last)<ipython-input-6-cd09eb0aaf88> in <module>() 1 for i, fn in enumerate(ts):----> 2 pf = load(fn) # load data 3 sl = pf.h.slice(0, pf.domain_center[0],fields=["Density","Temperature"] ) 4 frb = sl.to_frb( (1.0, 'kpc'), (4096,1024),height=(4.0, 'kpc')) 5 dens_axes = [axes[0][i]]
> /Users/kde/yt-x86_64/src/yt-hg/yt/convenience.pyc in load(*args, **kwargs) 65 try: 66 from yt.data_objects.time_series import TimeSeriesData---> 67 ts = TimeSeriesData.from_filenames(*args, **kwargs) 68 return ts 69 except YTOutputNotIdentified:
> /Users/kde/yt-x86_64/src/yt-hg/yt/data_objects/time_series.pyc in from_filenames(cls, filenames, parallel, **kwargs) 263 filenames = glob.glob(filenames) 264 filenames.sort()--> 265 obj = cls(filenames[:], parallel = parallel, **kwargs) 266 return obj 267
> /Users/kde/yt-x86_64/src/yt-hg/yt/data_objects/static_output.pyc in __getitem__(self, key) 146 for d in [self.units, self.time_units, self.parameters, \ 147 self.conversion_factors]:--> 148 if key in d: return d[key] 149 raise KeyError(key) 150
> TypeError: unhashable type
>
>
> thanks
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140127/143536c2/attachment.htm>
More information about the yt-users
mailing list