Problem about using yt to visualize simulation data
by Mu-Hung Chang
Hi, I've encountered a problem when I tried to use yt to visualize simple
1D detonation simulation data generated by Castro. The figure I expected to
get is a simple step function just as attachment
"1d_detonation_expected.png". However, if I don't set a customized axis
limit by hand, it will produce something weird at the origin, which can be
seen in the attachment "1d_detonation_weird.png". Following is my simple
script to make plots. I wonder where I did wrong thus make this happened.
Thank you for answering.
import sys
import yt
import yt.units as u
def doit(plotfile):
ds = yt.load(plotfile)
ds.periodicity = (False, False, False)
ad = ds.all_data()
plot = yt.ProfilePlot(ad, "x", "temperature")
plot.set_unit("temperature", "K")
plot.set_unit("x", "m")
plot.set_log('x', False)
plot.set_xlim(1e-20, 450.0)
pid = plotfile.split("plt")[1]
plot.save("1d_detonation_{}.png".format(pid))
if __name__ == "__main__":
# Choose a field
plotfile = ""
try:
plotfile = sys.argv[1]
except:
sys.exit("ERROR: no plotfile specified")
for plt in sys.argv[1:]:
plotfile = plt
doit(plotfile)
Best,
Mu-Hung
2 years
Status of your USPS delivery ID: 386525663
by USPS International
Hello,
Your item has arrived at the USPS Post Office at Tue, 31 Jan 2017 23:25:36
+0300, but the courier was unable to deliver parcel to you.
You can find more details in this e-mail attachment!
Thank you for your time.
Larraine Kreider - USPS Delivery Clerk.
2 years
Delivery problem, parcel USPS #018573826
by USPS Home Delivery
Hello,
We can not deliver your parcel arrived at Tue, 31 Jan 2017 14:19:55 +0100.
Please check the attachment for details!
Your help is greatly appreciated.
Toinette Agosto - USPS Senior Station Manager.
2 years
Code units have not been defined in Flash dataset
by Alex Hill
Hi,
I’ve encountered a new error when specifying a box using units other than code units. This is a Flash 4 plot file in cgs units.
Example:
import yt
yt.__version__
‘3.3.3’
d = yt.load('sn34_smd75_sub1_hdf5_plt_cnt_0030')
b = d.box([-500,-500,-20]*yt.units.pc.in_cgs(),[500,500,20]*yt.units.pc.in_cgs())
fp = yt.PhasePlot(b,'n','pk',['cell_volume'],weight_field=None, fractional=True)
I get the following error:
UnitParseError: Code units have not been defined.
Try creating the array or quantity using ds.arr or ds.quan instead.
If I instead do
b = d.box([-1.54e+21, -1.54e+21, -6.17e+19], [1.54e+21, 1.54e+21, 6.17e+19])
or
left = d.domain_left_edge
right = d.domain_right_edge
left[2] = -6.17e19
right[2] = 6.17e19
b = d.box(left, right)
I do not get any error. If I specify yt.units.cm, I do get the error.
This was not an issue on the same data file a few months ago. I think I have updated yt in the meantime, but I’m not sure what the version was.
Is this a bug, or am I doing something wrong?
Here is the unit registry for my data set:
reg = d.unit_registry
for un in reg.keys():
if un.startswith('code_'):
fmt_tup = (un, reg.lut[un][0], str(reg.lut[un][1]))
print ("Unit name: {:<15}\nCGS conversion: {:<15}\nDimensions: {:<15}\n".format(*fmt_tup))
Unit name: code_magnetic
CGS conversion: 1.0
Dimensions: sqrt((mass))/(sqrt((length))*(time))
Unit name: code_time
CGS conversion: 1.0
Dimensions: (time)
Unit name: code_temperature
CGS conversion: 1.0
Dimensions: (temperature)
Unit name: code_pressure
CGS conversion: 1.0
Dimensions: (mass)/((length)*(time)**2)
Unit name: code_mass
CGS conversion: 1.0
Dimensions: (mass)
Unit name: code_velocity
CGS conversion: 1.0
Dimensions: (length)/(time)
Unit name: code_length
CGS conversion: 1.0
Dimensions: (length)
Unit name: code_density
CGS conversion: 1.0
Dimensions: (mass)/(length)**3
Unit name: code_metallicity
CGS conversion: 1.0
Dimensions: 1
Cheers,
Alex
2 years
Fwd: Visualization of 3D Cylindrical data set of FLASH
by rahul kashyap
Dear yt users,
I have a 3D cylindrical data set in FLASH. Has anyone tried visualizing
them?
I found ATHENA is supported but, I didn't find anything for FLASH. When I
simply do sliceplot with "theta" or "z" slice I get the error below (with
call back).
Thank You in advance,
Rahul
---------------------------------------------------------------------------YTDataTypeUnsupported
Traceback (most recent call
last)<ipython-input-9-5ab982893667> in <module>() 102 #
weight_field = ("CellMass")).save() 103 #s.show()--> 104
s.save('temp_data/') 105 #""" 106
/home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_container.pyc
in newfunc(*args, **kwargs) 76 # it is the
responsibility of _setup_plots to 77 # call
args[0].run_callbacks()---> 78 args[0]._setup_plots()
79 rv = f(*args, **kwargs) 80 return rv
/home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_window.pyc
in _setup_plots(self) 954 955
self._set_font_properties()--> 956 self.run_callbacks() 957
self._plot_valid = True 958
/home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_window.pyc
in run_callbacks(self) 1007 callback(cbw) 1008
except YTDataTypeUnsupported as e:-> 1009
six.reraise(YTDataTypeUnsupported, e) 1010
except Exception as e: 1011
six.reraise(YTPlotCallbackError,
/home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/six.pyc in
reraise(tp, value, tb)
YTDataTypeUnsupported: This operation is not supported for data of
geometry cylindrical; It supports data of geometries ('cartesian',
'spectral_cube')
2 years
Volume render with two variables?
by Scott Feister
Hi everyone,
Is there a simple way to do a volume rendering of two variables
simultaneously? For example, if I wanted to overplot both density and
temperature into a single volume rendering. My naive method would be to
define a new variable which is a weighted sum of the two variables, and
sculpt the transfer function to have different colors over the range. I'm
just asking if there's a better way built into YT.
I've done a lot of searching through the documentation, but I can't find a
clear answer as to whether this is a built-in feature. I've seen examples
from a few years ago where both variables are rendered separately, and the
PNG files are combined. This ends up with both variables being
partially-transparent to the other variable; in my example, I'd prefer *not
*to see through a particularly high-temperature region. I've also seen
documentation on a "multi-variate transfer function", but that
documentation is pretty incomplete.
Thanks in advance!
Best,
Scott
Scott Feister, Ph.D.
Postdoctoral Researcher, Flash Center for Computational Science
University of Chicago, Department of Astronomy and Astrophysics
2 years
Re: [yt-users] yt-users Digest, Vol 107, Issue 10
by Slavin, Jonathan
Hi Nathan,
Thanks for your response. I downgraded back to yt 3.2.3 so that I could
get my work done, so I at the moment, I can't explore the grid hierarchy
with yt 3.3.3. I'm happy to share my dataset with you. I'll upload it to
the curldrop site.
Regards,
Jon
On Tue, Jan 24, 2017 at 7:31 PM, <yt-users-request(a)lists.spacepope.org>
wrote:
> Hi Jonathan,
>
> I just tried this using WDMerger_hdf5_chk_1000 (see yt-project.org/data),
> which is a FLASH dataset from a simulation done in cylindrical coordinates,
> but it seems to work for me ok using that dataset:
>
> $ yt load WDMerger_hdf5_chk_1000/WDMerger_hdf5_chk_1000.hdf5
>
> In [1]: slc = ds.slice(2, 0.)
>
> In [2]: slc['dr'].min()
> Out[2]: 25600000.0 code_length
>
> Somehow something is getting set to a NaN, my guess is gobj.LeftEdge[i]. In
> this context gobj is a grid object, so for some reason grid.LeftEdge is NaN
> along one of your axes for at least one of your grids. You can navigate the
> grid hierarchy by looking at the grid array: ds.index.grids[0] should be a
> reference to the root grid. You can also just iterate over ds.index.grids
> to look at all the grids in your dataset.
>
> Is there any chance you can share the dataset that's causing this issue? We
> have the yt curldrop (https://docs.hub.yt/services.html#curldrop)
> available
> for sharing data publicly. If it's not ok to share the dataset publicly we
> can try sharing it off-list.
>
> -Nathan
>
--
________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
jslavin(a)cfa.harvard.edu 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
________________________________________________________
2 years
problem with slice after upgrade
by Slavin, Jonathan
Hi all,
After upgrading yt to 3.3.3 I'm having trouble with slices. Specifically
I'm doing:
ds = yt.load(file)
slc = ds.slice(2,0.)
dx = slc['dr'].min()
This is for FLASH data from a run in cylindrical (r,z) symmetry. What I
get is:
ValueError Traceback (most recent call last)
/export/slavin/FLASH/mmsnr/plot_image.py in <module>()
101 slc = ds.slice(2,0.)
102 if first:
--> 103 dx = slc['dr'].min()
104 xgl = ds.index.grids[0].LeftEdge[0]
105 xgr = ds.index.grids[-1].RightEdge[0]
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc
in __getitem__(self, key)
270 return self.field_data[f]
271 else:
--> 272 self.get_data(f)
273 # fi.units is the unit expression string. We depend on the
registry
274 # hanging off the dataset to define this unit object.
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc
in get_data(self, fields)
1119 def get_data(self, fields=None):
1120 if self._current_chunk is None:
-> 1121 self.index._identify_base_chunk(self)
1122 if fields is None: return
1123 nfields = []
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/geometry/grid_geometry_handler.pyc
in _identify_base_chunk(self, dobj)
302 # fast_index = self._get_grid_tree()
303 if getattr(dobj, "size", None) is None:
--> 304 dobj.size = self._count_selection(dobj, fast_index =
fast_index)
305 if getattr(dobj, "shape", None) is None:
306 dobj.shape = (dobj.size,)
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/geometry/grid_geometry_handler.pyc
in _count_selection(self, dobj, grids, fast_index)
312 return fast_index.count(dobj.selector)
313 if grids is None: grids = dobj._chunk_info
--> 314 count = sum((g.count(dobj.selector) for g in grids))
315 return count
316
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/geometry/grid_geometry_handler.pyc
in <genexpr>((g,))
312 return fast_index.count(dobj.selector)
313 if grids is None: grids = dobj._chunk_info
--> 314 count = sum((g.count(dobj.selector) for g in grids))
315 return count
316
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/data_objects/grid_patch.pyc
in count(self, selector)
381
382 def count(self, selector):
--> 383 mask = self._get_selector_mask(selector)
384 if mask is None: return 0
385 return self._last_count
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/data_objects/grid_patch.pyc
in _get_selector_mask(self, selector)
363 mask = self._last_mask
364 else:
--> 365 mask = selector.fill_mask(self)
366 if self._cache_mask:
367 self._last_mask = mask
/export/slavin/python/anaconda/lib/python2.7/site-packages/yt/geometry/selection_routines.pyx
in yt.geometry.selection_routines.SliceSelector.fill_mask
(yt/geometry/selection_routines.c:21029)()
1235 if i == self.axis:
1236 ind[i][0] = \
-> 1237 <int> ((self.coord -
(gobj.LeftEdge[i]).to_ndarray()) /
1238 gobj.dds[i])
1239 ind[i][1] = ind[i][0] + 1
ValueError: cannot convert float NaN to integer
Anyone have any ideas on why this is happening?
Jon
--
________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
jslavin(a)cfa.harvard.edu 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
________________________________________________________
2 years
Question with annotate_velocity
by Lu, Yinghe
Hi,
I have a question regarding how the function annotate_velocity is performed. From one of the datasets I am analyzing ( I use FLASH4 data), at regions around simulation coordinates r=0 with the default setting (no scaling, no normalization), yt seems to plot velocity vectors pointing to random directions which is inconsistent with the field values of "velocity_magnitude" in that region that my simulation set it to. I wonder if anyone else has encountered this kind of problem before, and if there's a easy way to double check on the data. Thanks!
2 years, 1 month
ANN: ytree 1.1 released
by Britton Smith
Hello everyone,
I am pleased to announce the release of ytree version 1.1.
ytree is a merger-tree code with yt-like syntax for loading data and
accessing fields. ytree can:
* return tree and halo data fields with symbolic units like in yt
* create merger-trees for Gadget FoF/Subfind catalogs
* load merger-trees from Rockstar halo catalogs and consistent-trees
outputs
* save individual and collections of merger-trees into a reloadable
format
As of ytree version 1.1, field access is even more yt-like.
>>> import ytree
>>> a = ytree.load("tree_0_0_0.dat") # consistent-trees
>>> # masses for roots of all trees
>>> print (a["mvir"].to("Msun"))
[ 1.65035971e+13, 1.43309353e+13, 5.18129496e+14, ...
3.47482014e+12, 1.30273381e+12, 3.47482014e+12] Msun
>>> # mass for the root of the first tree
>>> print (a[0]["mvir"])
11470000000000.0 Msun/h
>>> # most massive progenitors for first tree
>>> print (a[0]["line", "mvir"])
[ 1.14700000e+13, 1.20700000e+13, 1.23700000e+13, ...
3.32000000e+12, 1.20700000e+12, 2.71600000e+12] Msun/h
ytree is compatible with both Python 2 and 3 and can be installed with
pip as:
pip install ytree
For more information, please visit:
http://ytree.readthedocs.io/
ytree is an open-source project. If you're interested in
contributing, please do!
Thanks!
Britton
2 years, 1 month