Skip to content

Commit bd59674

Browse files
committed
update
1 parent 3939197 commit bd59674

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Exec/science/xrb_spherical/analysis/slice.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
import matplotlib.pyplot as plt
1111
from mpl_toolkits.axes_grid1 import ImageGrid
1212
from yt.frontends.boxlib.api import CastroDataset
13-
13+
from yt.units import km
1414

1515
def slice(fnames:List[str], fields:List[str],
1616
loc: str = "top", widthScale: float = 3.0,
17+
dr: [float] = 0.15,
1718
theta: Optional[float] = None) -> None:
1819
"""
1920
A slice plot of the datasets for different field parameters for Spherical2D geometry.
@@ -32,6 +33,9 @@ def slice(fnames:List[str], fields:List[str],
3233
3334
widthScale: scaling for the domain width of the slice plot
3435
36+
dr: user defined distance between lower r to upper r boundary. Assumed in unit km.
37+
This is used to change the center of the SlicePlot
38+
3539
theta: user defined theta center of the slice plot
3640
"""
3741

@@ -56,8 +60,9 @@ def slice(fnames:List[str], fields:List[str],
5660
# Some geometry properties
5761
rr = ds.domain_right_edge[0].in_units("km")
5862
rl = ds.domain_left_edge[0].in_units("km")
59-
dr = rr - rl
60-
r_center = 0.5 * (rr + rl)
63+
if dr is None:
64+
dr = rr - rl
65+
r_center = 0.5 * dr + rl
6166

6267
thetar = ds.domain_right_edge[1]
6368
thetal = ds.domain_left_edge[1]
@@ -104,6 +109,7 @@ def slice(fnames:List[str], fields:List[str],
104109
sp.set_cmap(field, "plasma_r")
105110
elif field == "enuc":
106111
sp.set_zlim(field, 1.e15, 1.e20)
112+
sp.set_log(field, linthresh=1.e11)
107113
elif field == "density":
108114
sp.set_zlim(field, 1.e-3, 5.e8)
109115

@@ -176,6 +182,9 @@ def slice(fnames:List[str], fields:List[str],
176182
parser.add_argument('-t', '--theta', type=float,
177183
help="""user defined theta center location of the plot domain.
178184
Alternative way of defining plotting center""")
185+
parser.add_argument('-r', '--dr', type=float,
186+
help="""Distance between upper r and lower r shown in the SlicePlot.
187+
This is used to control center and width of the SlicePlot""")
179188
parser.add_argument('-w', '--width', default=4.0, type=float,
180189
help="scaling for the domain width of the slice plot")
181190

@@ -190,5 +199,5 @@ def slice(fnames:List[str], fields:List[str],
190199
if loc not in loc_options:
191200
parser.error("loc must be one of the three: {top, mid, bot}")
192201

193-
slice(args.fnames, args.fields,
194-
loc=loc, theta=args.theta, widthScale=args.width)
202+
slice(args.fnames, args.fields, loc=loc,
203+
widthScale=args.width, dr=args.dr, theta=args.theta)

Exec/science/xrb_spherical/analysis/slice_sequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# Parallelize the plotting
3535
with ProcessPoolExecutor(max_workers=args.jobs) as executor:
3636
future_to_index = {
37-
executor.submit(slice, fname, args.fields,
37+
executor.submit(slice, [fname], args.fields,
3838
theta=front_thetas[i], widthScale=args.width): i
3939
for i, fname in enumerate(fnames)
4040
}

0 commit comments

Comments
 (0)