forked from AMReX-Astro/Castro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubch_zoom.py
More file actions
executable file
·52 lines (35 loc) · 1.06 KB
/
subch_zoom.py
File metadata and controls
executable file
·52 lines (35 loc) · 1.06 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
import argparse
import os
import sys
from functools import reduce
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import ImageGrid
import yt
from yt.fields.derived_field import ValidateSpatial
from yt.frontends.boxlib.api import CastroDataset
from yt.funcs import just_one
# assume that our data is in CGS
from yt.units import amu, cm
matplotlib.use('agg')
plotfile = "subch_plt00000"
fig = plt.figure()
ds = CastroDataset(plotfile)
xmin = 0 * cm
xmax = 1.e8 * cm
xctr = 0.5 * (xmin + xmax)
L_x = xmax - xmin
ymin = 5.42e9 * cm
ymax = 5.58e9 * cm
yctr = 0.5 * (ymin + ymax)
L_y = ymax - ymin
field = "Temp"
sp = yt.SlicePlot(ds, "theta", field, center=[xctr, yctr, 0.0*cm], width=[L_x, L_y, 0.0*cm], fontsize="14")
sp.set_buff_size((2400,2400))
sp.set_zlim(field, 5.e7, 4e9)
sp.set_cmap(field, "magma")
sp.annotate_contour(("gas", "density"), take_log=True, ncont=3, clim=(1.e4, 1.e6), plot_args={"colors": "white", "linestyles": ":"})
sp.set_axes_unit("km")
sp.save(f"subch_{field}_zoom.pdf")