Hi, Everybody!
Does anyone out there have a technique for getting the variance out of
a profile object? A profile object is good at getting <X> vs. B, I'd
then like to get < (X - <X>)^2 > vs B. Matt and I had spittballed the
possibility some time ago, but I was wondering if anyone out there had
successfully done it.
Thanks,
d.
--
Sent from my computer.
Hi,
I'm trying to add text to a particular point in my slice. I've got:
position = na.array([20.2, 13.8, 16.0])
pc = PlotCollection(pf, center=position)
p = pc.add_projection("Density", 2)
p.set_width(2, 'kpc')
for c in range(len(t1clouds)):
r = abs(t1clouds[c]['position']-position)
if r[0] < 1.0 and r[1] < 1.0:
p.modify["point"](t1clouds[c]['position'], str(t1clouds[c]['track']))
p.modify["marker"](t1clouds[c]['position'], marker='o')
pc.save("%s_tracking" % (fn))
But python complains with:
TypeError: text() argument after ** must be a mapping, not NoneType
Did I call the modifier incorrectly?
Elizabeth
Hi, this question is mainly for John Wise,
While attempting to produce different plots for a paper, I wanted to create
color and gray scale versions of the same plot, but since the background of
most plots are white, a gray scale for 2D phase plot would either show the
highest or lowest color as white and blend in with the background, so I
made my own gray scale colormap according to the matplotlib manual.
It works great for PlotCollection and I can make
color/gray-scale-with-no-white-data images in png, but when I tried to use
the same colormap with the eps writer, it complains about it in line 571 in
yt/visualization/eps_writer.py
Here's a sample script of what I used to generate my plots
http://paste.yt-project.org/show/2739/
If I change the line 62 of the script from
p.set_cmap(my_gray_cmap)
to:
p.set_cmap('jet')
the error goes away. So PyX can take the matplotlib colormaps or have
the same ones built-in. Is there a convenient way to get
_cmap = plot.cmap.name
to recognize custom colormaps? Or is there an easier solution to my
problem of displaying gray scale data without using the white portion of
the gray scale colorbar?
Thanks in advance
From
G.S.
Hi all,
Has anybody had any luck adding wireframes to volume rendered images?
I think it would be straightforward, although perhaps not
easy/trivial, to do this on top of a volume rendered scene, but it
would be nice if I could get it into the image proper. Any ideas?
-Matt
Hi all,
I'm curious what sort of scripts, tools, and invocations thereof that people in the yt community use to stitch frames together into movies.
It seems like there are a number of solutions to do this. It would be nice if we could gather some solutions for this process and put them in the documentation or on the website so that future users have a place to start when they're trying to make their first movies.
For what it's worth, here's a script I just wrote to process a bunch of slices and projections dumped by a timeseries script: http://paste.yt-project.org/show/2703/
I've had good results with ffmpeg, although it's a pain to install and has an inflexible command line syntax to tell it to stitch together frames for a movie so I would love to hear of other solutions that don't use ffmpeg.
Cheers,
Nathan
Hi Nathan,
I also use mencoder under Ubuntu 12.04, which I call through the
following python script:
-------------------------------------------------------
#!/usr/bin/python
import os
# where are the pictures?
INPUTDIR ="./slices/slice_collection/"
BASENAME ="Cluster_hdf5_plt_cnt_5363_"
fps = '10'
bitrate = '2048000'
encode_opts=':mbd=2:mv0:trell:v4mv:cbp:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2'
FIELD ="Density"
outputFile = './movies/'+FIELD+'_slice.avi'
frameName=INPUTDIR+BASENAME+'*_Slice_x_'+FIELD+'.png'
encodeCommand = 'mencoder mf://'+frameName+' -mf type=png:fps='+fps+'
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate='+bitrate+encode_opts+' -o
'+outputFile
os.system(encodeCommand)
print 'Finished making video'
-------------------------------------------------------
The only thing you have to make sure is that the slices are numbered
with enough leading zeros, otherwise e.g. slice 100 will be inserted
into the video before slice 11
Cheers,
Markus
Hello Everybody,
I am writing you this time to ask if anybody has an example how to
manipulate data. For instance, I am using
contour_values, connected_sets =
sphere.extract_connected_sets("Density", levels, mi, ma)
print connected_sets[i]
#{0: ExtractedRegionBase (redshift0058): _base_region=AMRSphere
(redshift0058): center=[ 0.1005697 0.15871103 0.37831026],
radius=0.0124657962771}
and connected_sets is an array of dict of dicts, but I couldn't find
any example of how manipulate a dict object.
Thank in Advance
--
Francia F.R.
Hi all,
I updated yt today, and a problem with my 2D FLASH data has arisen again.
As of last week, all of my cells' z values were at
pf.domain_left_edge[2], and all the dz values were 1.
I think ideally I would want my z-values to be (upper + lower)/2, and
my dz-values to be upper-lower, where by upper and lower I mean
pf.domain_right_edge[2] and pf.domain_left_edge[2], respectively. So,
things were working, just not in precisely the way I would have
expected.
With the current version of yt ( d77fb0031d39 ) , it appears that I
get a range of z-values and dz-values, from 0 to upper/2, with dz = 2
z. These appear to be correlated with the refinement level. An example
of what happens in this situation when I try to generate a slice plot
is shown below. I also attempted to shift the center of the plot
collection up by 1.0, but got the same set of errors. The file which
I'm using in the session below is still available here:
http://www.ucolick.org/~jforbes/cloud_hdf5_plt_cnt_0000
Thank you,
John
>>> from yt.mods import *
>>> pf = load("cloud_hdf5_plt_cnt_0000")
yt : [WARNING ] 2012-09-18 15:18:10,923 integer runtime parameter
checkpointfilenumber overwrites a simulation scalar of the same name
yt : [INFO ] 2012-09-18 15:18:10,928 Parameters: current_time
= 0.0
yt : [INFO ] 2012-09-18 15:18:10,928 Parameters: domain_dimensions
= [ 8 32 1]
yt : [INFO ] 2012-09-18 15:18:10,928 Parameters: domain_left_edge
= [ -2.46854420e+22 0.00000000e+00 -2.46854420e+22]
yt : [INFO ] 2012-09-18 15:18:10,928 Parameters: domain_right_edge
= [ 2.46854420e+22 1.97483536e+23 2.46854420e+22]
yt : [INFO ] 2012-09-18 15:18:10,929 Parameters:
cosmological_simulation = 0.0
>>> pc=PlotCollection(pf)
yt : [INFO ] 2012-09-18 15:18:43,245 Max Value is 1.67330e-26 at
-430910425537109360640.0000000000000000
24248504855224609931264.0000000000000000 0.0000000000000000 in grid
FLASHGrid_0649 ([8 8 1]) at level 10 (0, 7, 0)
yt : [INFO ] 2012-09-18 15:18:43,245 Created plot collection with
default plot-center = [-4.3091042553710936e+20, 2.424850485522461e+22,
0.0]
>>> pc.add_slice("Density",2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.py",
line 431, in add_slice
center=center, **field_parameters)
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 1045, in __init__
self._refresh_data()
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 315, in _refresh_data
self.get_data()
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 830, in get_data
self._generate_coords()
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 1079, in _generate_coords
for grid in self._get_grids():
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py",
line 898, in _get_grids
return ObjectIterator(self, attr='_grids')
File "/Users/jforbes/yt-x86_64/src/yt-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py",
line 102, in __init__
raise YTNoDataInObjectError(pobj)
yt.utilities.exceptions.YTNoDataInObjectError: The object requested
has no data included in it. It may lie on a grid face. Try
offsetting slightly.
>>> dd=pf.h.all_data()
>>> print dd['dz'].min(), dd['dz'].max(), dd['z'].min(), dd['z'].max()
yt : [INFO ] 2012-09-18 15:19:27,137 Getting field dz from 3648
yt : [INFO ] 2012-09-18 15:19:28,476 Getting field z from 3648
0.0 2.4685442e+22 0.0 1.2342721e+22
Hi, all--
I have a set of clumps that I've pickled to disk, now I've unpickled
them and I'm trying to get some particle info. When I try to access
the particle indices from the clump (in the error message, it's c1) it
throws the following error. I do the same thing again, and it works
fine (that is, access particle_index on the same c1, returns a
reasonable looking particle list) I'm probably doing something dumb,
do any of y'all see what it is?
Thanks,
d.
File "p19_check_missing2.py", line 15, in <module>
ind1 = c1['particle_index']
File "/Users/dccollins/yt2.0/DaveClump.py", line 80, in __getitem__
return self.data[request]
File "/Users/dccollins/local2/src/yt-hg/yt/data_objects/data_containers.py",
line 327, in __getitem__
self.get_data(key)
File "/Users/dccollins/local2/src/yt-hg/yt/data_objects/data_containers.py",
line 2525, in get_data
self.particles.get_data(field)
File "/Users/dccollins/local2/src/yt-hg/yt/data_objects/particle_io.py",
line 62, in get_data
if len(fields) == 1: return rvs[0]
TypeError: 'NoneType' object is not subscriptable
--
Sent from my computer.
Hi all,
Yesterday I've updated YT (af06f14fcd9e), but after that I found I got some error in slice plot for 2d FLASH data, in both cartesian and cylindrical cases. In cartesian, the error is:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
yt : [WARNING ] 2012-09-17 01:19:45,023 integer runtime parameter checkpointfilenumber overwrites a simulation scalar of the same name
yt : [WARNING ] 2012-09-17 01:19:45,023 integer runtime parameter plotfilenumber overwrites a simulation scalar of the same name
yt : [INFO ] 2012-09-17 01:19:45,029 Parameters: current_time = 1.01787779719e-09
yt : [INFO ] 2012-09-17 01:19:45,029 Parameters: domain_dimensions = [1280 64 1]
yt : [INFO ] 2012-09-17 01:19:45,029 Parameters: domain_left_edge = [ 0. 0. 0.]
yt : [INFO ] 2012-09-17 01:19:45,030 Parameters: domain_right_edge = [ 256. 12.8 12.8]
yt : [INFO ] 2012-09-17 01:19:45,030 Parameters: cosmological_simulation = 0.0
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field enuc to list of fields
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field ar36 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field c12 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field ca40 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field cr48 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,040 Adding unknown field fe52 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field he4 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field mg24 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field ne20 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field ni56 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field o16 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field s32 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field si28 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,041 Adding unknown field ti44 to list of fields
yt : [INFO ] 2012-09-17 01:19:45,356 Max Value is 4.25001e+07 at 22.7500000000000000 0.8375000000000000 0.5000000000000000 in grid FLASHGrid_0001 ([64 64 1]) at level 0 (45, 33, 0)
yt : [INFO ] 2012-09-17 01:19:45,401 Making a fixed resolution buffer of (dens) 800 by 800
Traceback (most recent call last):
File "slice.py", line 14, in <module>
p1 = SlicePlot(pf, "z", my_var, origin="left-domain")
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 949, in __init__
PWViewerMPL.__init__(self, slc, bounds, origin=origin)
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 473, in __init__
if setup: self._setup_plots()
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 725, in _setup_plots
self.plots[f].image, cax = self.plots[f].cax)
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/figure.py", line 1196, in colorbar
cb = cbar.Colorbar(cax, mappable, **kw)
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/colorbar.py", line 743, in __init__
ColorbarBase.__init__(self, ax, **kw)
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/colorbar.py", line 258, in __init__
self.draw_all()
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/colorbar.py", line 272, in draw_all
self._process_values()
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/colorbar.py", line 570, in _process_values
b = self.norm.inverse(self._uniform_y(self.cmap.N+1))
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/matplotlib/colors.py", line 948, in inverse
return vmin * ma.power((vmax/vmin), val)
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py", line 3642, in __mul__
return multiply(self, other)
File "/aphelion/jisuoqing/yt-x86_64/lib/python2.7/site-packages/numpy/ma/core.py", line 936, in __call__
if m:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
And in cylindrical case, the error is:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> from yt.mods import *
>>> pf=load('relax_hdf5_chk_0000')
yt : [INFO ] 2012-09-17 01:22:27,082 Parameters: current_time = 0.0
yt : [INFO ] 2012-09-17 01:22:27,082 Parameters: domain_dimensions = [256 128 1]
yt : [INFO ] 2012-09-17 01:22:27,082 Parameters: domain_left_edge = [ 0.00000000e+00 -6.55360000e+09 0.00000000e+00]
yt : [INFO ] 2012-09-17 01:22:27,082 Parameters: domain_right_edge = [ 1.31072000e+10 6.55360000e+09 1.74532925e-02]
yt : [INFO ] 2012-09-17 01:22:27,083 Parameters: cosmological_simulation = 0.0
>>> p1 = SlicePlot(pf, 'z', 'dens', origin="left-domain")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py", line 948, in __init__
slc = pf.h.slice(axis, center[axis], fields=fields)
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1045, in __init__
self._refresh_data()
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 315, in _refresh_data
self.get_data()
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 830, in get_data
self._generate_coords()
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 1079, in _generate_coords
for grid in self._get_grids():
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py", line 898, in _get_grids
return ObjectIterator(self, attr='_grids')
File "/aphelion/jisuoqing/yt-x86_64/src/yt-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py", line 102, in __init__
raise YTNoDataInObjectError(pobj)
yt.utilities.exceptions.YTNoDataInObjectError: The object requested has no data included in it. It may lie on a grid face. Try offsetting slightly.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I would very appreciate it if you have any idea on solving these errors.
Best wishes,
Suoqing