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
Good morning YT-users,
I'm trying to take derivatives on a 2d dataset, below is what I do and the error I get:
# - - - - - - A SIMPLE TEST TO TRY GETTING A 2D DERIVATIVE - - - - - - - - - -
...
ds_list = [yt.load('%s/DD%04d/data%04d'%(base_directory,n1,n1)) for n1 in frame_list]
ds = ds_list[0]
g = ds.index.grids[0]
ds.periodicity = (True, True, True)
ad = ds.all_data()
# this is to access the grad operator and the added derived field which are found further below:
map(xyz_derived_fields, ds_list)
# the following line breaks down
print(ad['deriv_vx'])
# - - - - - - - - - - - - ANOTHER .PY FILE - - - - - - - - - -
...
def grad(data,fieldname,direction):
iM2 = slice(None,-2)
iP2 = slice(2,None)
all = slice(1,-1)
all_all=[all]*3
dxi=1./(2*data.dds)
out = np.zeros_like(data[fieldname])
Right = [all]*3
Left = [all]*3
print(data.shape)
if data.shape[2] == 1:
all_all[2]=slice(None)
Right[2]=slice(None)
Left[2]=slice(None)
Right[direction] = iP2
Left[direction] = iM2
out[all_all] = (data[fieldname][Right] - data[fieldname][Left]) * dxi[direction]
return out
def xyz_derived_fields(target):
def deriv_vx(field,data):
return grad(data,'velocity_x',0)
MyValidators = [yt.ValidateSpatial(1,['velocity_x', 'velocity_y','velocity_z'])]
target.add_field('deriv_vx', function=deriv_vx, units='cm/s', validators=MyValidators)
# this is the error: - - - - - - - - - - -
/home/luzlourdes/yt-conda/lib/python2.7/site-packages/yt/units/yt_array.py:1161: VisibleDeprecationWarning: boolean index did not match indexed array along dimension 2; dimension is 4 but corresponding boolean dimension is 1
ret = super(YTArray, self).__getitem__(item)
[ 0. 0. 0. ..., 0. 0. 0.] cm/s
# - - - - - - - - - - - - - - - - - - - - -
May I use your knowledge and help on knowing what is happening and/or how we could go about solving this?
Please let me know if I could provide you with anything further.
Thank you,
Luz Jimenez Vela
Graduate Student at FSU
Hello,
When I do yt.off_axis_projection(…) I get an array as an output. My question is how I can get an output array for regular projection plots? And does the output array correspond to the actual image that it otherwise would have plotted?
Thanks,
Julie
Hi everyone,
I have recently started using YT to analyze my simulation data from RAMSES.
I would like to plot rotational curves for my simulated galaxy but am not
quite sure how to do it. Is there a specific function in YT to do so? Any
help is greatly appreciated.
Hi yt-users,
I am a newbie in using YT. I read through the documentation of field types
but I still have some confusion in understanding when to use different
field types, as in:
(1) 'io' vs 'all' (from what I understand, both are used for particles but
I don't get the minute difference)
(2) 'ramses' vs 'index' vs 'gas' (fluids described on the grid, I suppose?)
It would be really helpful if someone could provide an elaborate
explanation on these.
Hello all,
I am rather new to yt and have recently tried using the gradient fields
functionality. I'm attempting to write a script which involves basic
calculations with the gradient of the velocity field, however I keep
coming across the same error when assigning the gradient field to a
variable.
My current version of yt is 3.3.1 and my version of Python is 2.7.12.
The data dumps I'm reading from were produced by an Enzo cosmology
simulation (version 2.5).
The following code is a simplified version of the script which runs
successfully and outputs a slice plot of the velocity gradient:
import yt
from yt import derived_field
yt.enable_parallelism()
ds = yt.load("DD0045/output_0045")
val, loc = ds.find_max('density')
ds.periodicity = (True, True, True)
ds.add_gradient_fields(('gas', 'velocity_x'))
#grad_x = ds['velocity_x_gradient_x']
plt = yt.SlicePlot(ds, 'z', 'velocity_x_gradient_x', center= loc, width=
(6.0, 'pc')
plt.save("plot.png")
However, when I try to assign this gradient field to a variable by
removing the comment and adding the line "grad_x =
ds['velocity_x_gradient_x']" and plotting this instead I come across the
following error:
File
"/opt/apps/yt/3.3.1/yt-conda/lib/python2.7/site-packages/yt/data_objects/static_output.py",
line 352, in __getitem__
return self.parameters[key]
P015 yt : [ERROR ] 2018-01-25 10:49:00,443 KeyError:
'velocity_x_gradient_x'
I am unsure what I am doing wrong here. Any help will be very much
appreciated.
Thanks,
Sam Patrick
Hi,
I'm trying to obtain a projection plot of temperature for RAMSES data using:
*plot = yt.ProjectionPlot(ds, "z", "temperature", weight_field=None)*
However, I get a blank plot as attached in the picture below. Could someone
help me figure out what could have gone wrong?