1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
import yt
# Load the dataset.
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
# Create a 15 kpc radius sphere, centered on the center of the sim volume
sp = ds.sphere("center", (15.0, "kpc"))
# Get the angular momentum vector for the sphere.
L = sp.quantities.angular_momentum_vector()
print(f"Angular momentum vector: {L}")
# Create an off-axis ProjectionPlot of density centered on the object with the L
# vector as its normal and a width of 25 kpc on a side
p = yt.ProjectionPlot(
ds, L, fields=("gas", "density"), center=sp.center, width=(25, "kpc")
)
p.save()
|