File: customized_profile_plot.py

package info (click to toggle)
yt 4.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 76,192 kB
  • sloc: python: 125,909; ansic: 6,303; cpp: 3,590; sh: 556; javascript: 352; makefile: 131; csh: 36
file content (29 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import yt
import yt.units as u

ds = yt.load("HiresIsolatedGalaxy/DD0044/DD0044")

center = [0.53, 0.53, 0.53]
normal = [0, 0, 1]
radius = 40 * u.kpc
height = 5 * u.kpc

disk = ds.disk(center, [0, 0, 1], radius, height)

profile = yt.create_profile(
    data_source=disk,
    bin_fields=[("index", "radius")],
    fields=[("gas", "velocity_cylindrical_theta")],
    n_bins=256,
    units=dict(radius="kpc", velocity_cylindrical_theta="km/s"),
    logs=dict(radius=False),
    weight_field=("gas", "mass"),
    extrema=dict(radius=(0, 40)),
)

plot = yt.ProfilePlot.from_profiles(profile)

plot.set_log(("gas", "velocity_cylindrical_theta"), False)
plot.set_ylim(("gas", "velocity_cylindrical_theta"), 60, 160)

plot.save()