Hi All I have been searching the documentation and can’t seem to figure out how to do this! Essentially I have a star defined via its density, and I define the edge of the star as to where the density has fallen to 5% of the max value. I calculate this radius using rays. The star has a different ‘edge’ depending on what direction (x,y,z) you take the ray as it is the result of a collision. I want to take in the 3 values for the edges, and sketch an ellipsoid that covers this definition. I then want to integrate this ellipsoid to find the total value of density. I use amr so total_quantity won’t work. So I essentially want a weighted variable sum for an ellipsoid. Can anyone help? Thanks James
Hi James,
Did you know there's an ellipsoid data object? You could do something like
this:
In [14]: el = ds.ellipsoid(ds.domain_center, 0.5, 0.25, 0.1, np.array([1,
1, 1]), np.pi/4)
In [15]: el['cell_mass']
Out[15]:
YTArray([4.45777680e+38, 4.45778381e+38, 4.45778677e+38, ...,
6.03437074e+36, 8.52994081e+36, 5.87109032e+37]) g
In [16]: el['cell_volume'].to('cm**3')
Out[16]:
YTArray([8.96887209e+68, 8.96887209e+68, 8.96887209e+68, ...,
5.34586435e+61, 5.34586435e+61, 5.34586435e+61]) cm**3
In [17]: for ax in 'xyz':
...: plot = yt.SlicePlot(ds, ax, ('gas', 'density'), data_source=el)
...: plot.save()
(see https://imgur.com/a/nqfl7yi for the resulting images using the enzo
IsolatedGalaxy dataset from yt-project.org/data)
I think you could just use the same script you use with spheres but use an
ellipsoid instead.
Note that in the example above I'm specifying the parameters of the
ellipsoid (the first three arguments) in code units, which in Enzo are
scaled to box size, your dataset might be different (for example if it uses
CGS units internally).
I don't the ellipsoid data object is as commonly used as the rest of the yt
data objects, if you notice any weirdness or bugs we'd love to hear about
it in the form of e-mails here or issues on github.
-Nathan
On Tue, Jul 31, 2018 at 5:21 AM, James Cook
Hi All
I have been searching the documentation and can’t seem to figure out how to do this! Essentially I have a star defined via its density, and I define the edge of the star as to where the density has fallen to 5% of the max value. I calculate this radius using rays. The star has a different ‘edge’ depending on what direction (x,y,z) you take the ray as it is the result of a collision. I want to take in the 3 values for the edges, and sketch an ellipsoid that covers this definition. I then want to integrate this ellipsoid to find the total value of density. I use amr so total_quantity won’t work.
So I essentially want a weighted variable sum for an ellipsoid.
Can anyone help?
Thanks
James
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
James Cook
-
Nathan Goldbaum