1010import matplotlib .pyplot as plt
1111from mpl_toolkits .axes_grid1 import ImageGrid
1212from yt .frontends .boxlib .api import CastroDataset
13-
13+ from yt . units import km
1414
1515def 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 )
0 commit comments