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.
Dear yt
Can current yt calculate 3-D Mass power spectra? I checked the website but
I didn't find any information. I think calculating 3-D Mass power
spectra is a very useful for cosmological simulations. So I guess maybe yt
supports this function now....?
Thanks in advance
Dear yt-users,
Hi, I want to ask you about profile plot. I'm analyzing Enzo data, and I'm
trying to plot metallicity-cellmass of different 12 datasets into one
curve. I can plot 12 curves on one image, but that's not what I want. Does
anyone know some good way, or links to documentation?
I've attached the 12-curve plot. I want to sum up all the curves to get one
curve.
Thanks,
Y.T.[image: 埋め込み画像 2]
Dear YT people,
I need to do integration of density field along line of sight. I know the
ProjectionPlot function plots the integration of a field along line of
sight.
yt.ProjectionPlot(ds, 'z', 'density, center= 'm')
However, I was wondering if it is possible to get the projection as an
array (or new field) , so that I can make a ProfilePlot of the integrated
field along line of sight and another field ('Mass')
In other words, I want to do the following:
sp = ds.sphere("max", (200, "kpc"))
proj = yt.ProfilePlot(sp, 'Integrated_Density_along_Line_Of_Sight', 'Mass)
Thanks
Tazkera
Hey yt-users,
I am trying to use OffAxis Slice and Projection plots using planes defined
by two light rays in Enzo data.
I have recently tried added callbacks for visualization of the clumps of
gas and star particles but whenever I use annotate_clumps and
annotate_particles with OffAxis plots I always get an error saying that
they do not have the method.
I assume that this is a consequence of how the OffAxis plots are made and
there is no easy way around this but I wanted to check to make sure before
I give up on OffAxis plots.
If you don't understand what I mean here is a short bit of pseudo code to
explain.
L=[1,1,0]
cut = SlicePlot(ds, L, 'Density')
cut.annotate_particles((300,'kpc'), ptype=2)
AttributeError: 'OffAxisSlicePlot' object has no attribute
'annotate_particles'
Thanks,
Joe Tomlinson
Dear user group,
I am trying to smooth particle data output from GIZMO onto an arbitrary grid, then save the object as data set and reload in order to do volume rendering. However I can not handle the reloaded data set.
To clarify, I smooth yt sample data — FIRE_M12i_ref11 onto a 64**3 grid, the code is like this:
1 import yt
2
3 ytname='FIRE_M12i_ref11/snapshot_600.hdf5'
4 ds=yt.load(ytname)
5
6 # define the region
7 left = ds.domain_left_edge
8 right = ds.domain_right_edge
9
10 #now create an abitrary grid and save
11 arb = ds.arbitrary_grid(left, right,dims=[64, 64, 64])
12
13 fn = arb.save_as_dataset(fields=[('PartType0','density')])
14
15 arb_ds = yt.load('snapshot_600_arbitrary_grid.h5')
16 print arb_ds.field_list
And it returns an error:
Traceback (most recent call last):
File "arbgrid_clean.py", line 16, in <module>
print arb_ds.field_list
...
...
File "/Users/heavyfat/anaconda/lib/python2.7/site-packages/yt/frontends/ytdata/io.py", line 244, in _initialize_index
pos[:,0] = _get_position_array(ptype, f, "x")
ValueError: could not broadcast input array from shape (64,64,64) into shape (262144)
So, how I can save/load a usable arbitrary grid dataset?
Thanks and looking forward to your suggestions.
Best regards,
Qi
Folk,
Do you plan any more training workshops/hackatons in the future? I work
with a couple of students who would benefit from such, self-learning
from the docs is kind of slow.
Thanks,
Nick Gnedin
Dear yt-users,
Hi, I have a question on ProfilePlot. I want to make profile plot of dark
matter density, taking gas density as a bin field, weighted by dark matter
mass in the cell.I could make the plot, but the plot looks strange (it
looks like chopped in small pieces). Also, I tried other plot changing
n_bins like 64,32,16,8,... but they still be "chopped", or sometimes there
were no line at all. For comparison, I made a plot weighted by cell_mass
(which I don't want), and this look OK. To my understanding, if and only if
there is at least 1 cell which fall into each bin, there should be some
nonzero value no matter what weight I use, so the range of density which
has nonzero dark matter density doesn't depend on the choice of weight
field. It seems there is a discrepancy between these two plots.
Could you tell me what's wrong with me?
I tried on yt example dataset, IsolatedGalaxy/galaxy0030/galaxy0030.
I'm working with yt-3.4.0.
this is my code:
import yt
from yt.data_objects.particle_filters import add_particle_filter
def stars(pfilter, data):
filter = data[(pfilter.filtered_type, "particle_type")] == 2
return filter
def DMparticles(pfilter, data):
filter = data[(pfilter.filtered_type, "particle_type")] == 1
return filter
add_particle_filter("stars", function=stars, filtered_type='io',
requires=["particle_type"])
add_particle_filter("DMparticles", function=DMparticles, filtered_type='io',
requires=["particle_type"])
def only_DM(field, data):
return data['deposit','DMparticles_density']
def DM_in_cell_mass(field, data):
return (data['only_DM_Density']*data['cell_volume'])
ds_all=yt.load("~/IsolatedGalaxy/galaxy0030/galaxy0030")
ds_all.add_particle_filter('stars')
ds_all.add_particle_filter('DMparticles')
ds_all.add_field(("gas", "only_DM_Density"), units="g/cm**3",
function=only_DM)
ds_all.add_field(("gas", "DM_cell_mass"), units="g",
function=DM_in_cell_mass)
sp = ds_all.sphere([0.5, 0.5, 0.5], (10, "kpc"))
lineplot_gas_DM_density_128 = yt.ProfilePlot(sp, "density", [
"only_DM_Density"], weight_field="DM_cell_mass", n_bins=128)
lineplot_gas_DM_density_gasweighted_128 = yt.ProfilePlot(sp, "density", [
"only_DM_Density"], weight_field="cell_mass", n_bins=128)
lineplot_gas_DM_density_gasweighted_128.save("128_gasweighted")
lineplot_gas_DM_density_128.save("128_DMweighted")
Sincerely,
Y.T.
Dear yt users,
Hi, I have a question on derived field. I want to define "Dark Matter cell
mass", which can be defined by (Dark matter density) * (cell_volume). To
check that "Dark Matter cell mass" defined well, I also tried to define
"my_cell_mass", which should give the same value as the default
'cell_mass', but it gave me an error, and I don't have any idea what the
problem is. Could you help me with the problem?
I'm working on Enzo data.
Here is my python code (I'm sorry that it's lengthy):
import yt
from yt.data_objects.particle_filters import add_particle_filter
def stars(pfilter, data):
filter = data[(pfilter.filtered_type, "particle_type")] == 2
return filter
def DMparticles(pfilter, data):
filter = data[(pfilter.filtered_type, "particle_type")] == 1
return filter
add_particle_filter("stars", function=stars, filtered_type='io',
requires=["particle_type"])
add_particle_filter("DMparticles", function=DMparticles,
filtered_type='io', requires=["particle_type"])
def only_DM(field, data):
return data['deposit','DMparticles_density']
def DM_in_cell_mass(field, data):
return (data['only_DM_Density']*data['cell_volume'])
def my_cell_mass(field, data):
return (data['density']*data['cell_volume'])
ds_all=yt.load("/.../redshift00??")
ds_all.add_particle_filter('stars')
ds_all.add_particle_filter('DMparticles')
ds_all.add_field(("gas", "only_DM_Density"), units="g/cm**3",
function=only_DM)
ds_all.add_field(("gas", "DM_in_cell_mass"), units="g",
function=DM_in_cell_mass)
ds_all.add_field(("gas", "my_cell_mass"), units="g", function=my_cell_mass)
sp = ds_all.sphere([centerx, centery, centerz], ((somevalue), "kpc"))
sp['cell_volume']
YTArray([ 4.44089210e-16, 4.44089210e-16, 4.44089210e-16, ...,
6.93889390e-18, 6.93889390e-18, 6.93889390e-18]) code_length**3
sp[('gas', 'my_cell_mass')]
YTFieldNotFound: Could not find field '('gas', 'my_cell_mass')' in redshift00??.
Best,
Y.T.