aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkcuts_dvpT.py241
1 files changed, 144 insertions, 97 deletions
diff --git a/mkcuts_dvpT.py b/mkcuts_dvpT.py
index ca48547..f45813b 100644
--- a/mkcuts_dvpT.py
+++ b/mkcuts_dvpT.py
@@ -68,6 +68,7 @@ def main():
op_cs2 = FractionOperator(func_pre, func_rho)
# Init Master Lists
+ # @note Might note use all...
rhoZall = []
rhoXall = []
velZall = []
@@ -96,49 +97,63 @@ def main():
source = output.amr_source(["rho", "vel", "P"])
# Compute Slice Maps
- rhoZ = SliceMap(source, camZ, op_rho, z=0.0)
- rhoX = SliceMap(source, camX, op_rho, z=0.0)
- velZ = SliceMap(source, camZ, op_vel, z=0.0)
- velX = SliceMap(source, camX, op_vel, z=0.0)
- preZ = SliceMap(source, camZ, op_pre, z=0.0)
- preX = SliceMap(source, camX, op_pre, z=0.0)
- cs2Z = SliceMap(source, camZ, op_cs2, z=0.0)
- cs2X = SliceMap(source, camX, op_cs2, z=0.0)
+ if args.d or args.T or args.lT:
+ rhoZ = SliceMap(source, camZ, op_rho, z=0.0)
+ rhoX = SliceMap(source, camX, op_rho, z=0.0)
+ if args.v:
+ velZ = SliceMap(source, camZ, op_vel, z=0.0)
+ velX = SliceMap(source, camX, op_vel, z=0.0)
+ if args.p or args.T or args.lT:
+ preZ = SliceMap(source, camZ, op_pre, z=0.0)
+ preX = SliceMap(source, camX, op_pre, z=0.0)
+ if args.T or args.lT:
+ cs2Z = SliceMap(source, camZ, op_cs2, z=0.0)
+ cs2X = SliceMap(source, camX, op_cs2, z=0.0)
# Convert Human Mind Parsable Units Pt 1 - (CGS)
- rhoZ *= output.info["unit_density"].express(C.g_cc)
- rhoX *= output.info["unit_density"].express(C.g_cc)
- velZ *= output.info["unit_velocity"].express(C.cm / C.s)
- velX *= output.info["unit_velocity"].express(C.cm / C.s)
- preZ *= output.info["unit_pressure"].express(C.barye)
- preX *= output.info["unit_pressure"].express(C.barye)
+ if args.d or args.T or args.lT:
+ rhoZ *= output.info["unit_density"].express(C.g_cc)
+ rhoX *= output.info["unit_density"].express(C.g_cc)
+ if args.v:
+ velZ *= output.info["unit_velocity"].express(C.cm / C.s)
+ velX *= output.info["unit_velocity"].express(C.cm / C.s)
+ if args.p or args.T or args.lT:
+ preZ *= output.info["unit_pressure"].express(C.barye)
+ preX *= output.info["unit_pressure"].express(C.barye)
# Convert Human Mind Parsable Units Pt 2 - (km/s)
# Sound Speed
- factor = output.info["unit_pressure"].express(C.barye) / \
- output.info["unit_density"].express(C.g_cc)
- cs2Z *= factor / 100.**2. / 1000.**2.
- cs2X *= factor / 100.**2. / 1000.**2.
+ if args.T or args.lT:
+ factor = output.info["unit_pressure"].express(C.barye) / \
+ output.info["unit_density"].express(C.g_cc)
+ cs2Z *= factor / 100.**2. / 1000.**2.
+ cs2X *= factor / 100.**2. / 1000.**2.
# Total Flow Speed
- velZ *= 1.0 / 100. / 1000.
- velX *= 1.0 / 100. / 1000.
+ if args.v:
+ velZ *= 1.0 / 100. / 1000.
+ velX *= 1.0 / 100. / 1000.
# Compute Temperature
- gamma = 1.4
- TX = (cs2X * 100.**2. * 1000.**2.) * 2. * C.mH.express(C.kg) / \
- gamma / C.kB.express(C.cm**2 * C.kg / C.s**2 / C.K)
- TZ = (cs2Z * 100.**2. * 1000.**2.) * 2. * C.mH.express(C.kg) / \
- gamma / C.kB.express(C.cm**2 * C.kg / C.s**2 / C.K)
+ if args.T or args.lT:
+ gamma = 1.4
+ TX = (cs2X * 100.**2. * 1000.**2.) * 2. * C.mH.express(C.kg) / \
+ gamma / C.kB.express(C.cm**2 * C.kg / C.s**2 / C.K)
+ TZ = (cs2Z * 100.**2. * 1000.**2.) * 2. * C.mH.express(C.kg) / \
+ gamma / C.kB.express(C.cm**2 * C.kg / C.s**2 / C.K)
# Append to Master List
- rhoZall.append(rhoZ)
- rhoXall.append(rhoX)
- velZall.append(velZ)
- velXall.append(velX)
- preZall.append(preZ)
- preXall.append(preX)
- TZall.append(TZ)
- TXall.append(TX)
+ if args.d:
+ rhoZall.append(rhoZ)
+ rhoXall.append(rhoX)
+ if args.v:
+ velZall.append(velZ)
+ velXall.append(velX)
+ if args.p:
+ preZall.append(preZ)
+ preXall.append(preX)
+ if args.T or args.lT:
+ TZall.append(TZ)
+ TXall.append(TX)
print ""
print "// Scanning Snapshots"
@@ -149,92 +164,124 @@ def main():
for ii, iout in enumerate(iouts):
# Load from Master List
- rhoZ = rhoZall[ii]
- rhoX = rhoXall[ii]
- velZ = velZall[ii]
- velX = velXall[ii]
- preZ = preZall[ii]
- preX = preXall[ii]
- TZ = TZall[ii]
- TX = TXall[ii]
+ if args.d:
+ rhoZ = rhoZall[ii]
+ rhoX = rhoXall[ii]
+ if args.v:
+ velZ = velZall[ii]
+ velX = velXall[ii]
+ if args.p:
+ preZ = preZall[ii]
+ preX = preXall[ii]
+ if args.T or args.lT:
+ TZ = TZall[ii]
+ TX = TXall[ii]
# MinMax
if first:
- rhoZmax = np.nanmax(rhoZ); rhoZmin = np.nanmin(rhoZ)
- rhoXmax = np.nanmax(rhoX); rhoXmin = np.nanmin(rhoX)
- velZmax = np.nanmax(velZ); velZmin = np.nanmin(velZ)
- velXmax = np.nanmax(velX); velXmin = np.nanmin(velX)
- preZmax = np.nanmax(preZ); preZmin = np.nanmin(preZ)
- preXmax = np.nanmax(preX); preXmin = np.nanmin(preX)
- TZmax = np.nanmax(TZ); TZmin = np.nanmin(TZ)
- TXmax = np.nanmax(TX); TXmin = np.nanmin(TX)
+ if args.d:
+ rhoZmax = np.nanmax(rhoZ); rhoZmin = np.nanmin(rhoZ)
+ rhoXmax = np.nanmax(rhoX); rhoXmin = np.nanmin(rhoX)
+ if args.v:
+ velZmax = np.nanmax(velZ); velZmin = np.nanmin(velZ)
+ velXmax = np.nanmax(velX); velXmin = np.nanmin(velX)
+ if args.p:
+ preZmax = np.nanmax(preZ); preZmin = np.nanmin(preZ)
+ preXmax = np.nanmax(preX); preXmin = np.nanmin(preX)
+ if args.T or args.lT:
+ TZmax = np.nanmax(TZ); TZmin = np.nanmin(TZ)
+ TXmax = np.nanmax(TX); TXmin = np.nanmin(TX)
first = False
else:
# Max
- if np.nanmax(rhoZ) > rhoZmax: rhoZmax = np.nanmax(rhoZ)
- if np.nanmax(rhoX) > rhoXmax: rhoXmax = np.nanmax(rhoX)
- if np.nanmax(preZ) > preZmax: preZmax = np.nanmax(preZ)
- if np.nanmax(preX) > preXmax: preXmax = np.nanmax(preX)
- if np.nanmax(velZ) > velZmax: velZmax = np.nanmax(velZ)
- if np.nanmax(velX) > velXmax: velXmax = np.nanmax(velX)
- if np.nanmax(TZ) > TZmax: TZmax = np.nanmax(TZ)
- if np.nanmax(TX) > TXmax: TXmax = np.nanmax(TX)
+ if args.d:
+ if np.nanmax(rhoZ) > rhoZmax: rhoZmax = np.nanmax(rhoZ)
+ if np.nanmax(rhoX) > rhoXmax: rhoXmax = np.nanmax(rhoX)
+ if args.p:
+ if np.nanmax(preZ) > preZmax: preZmax = np.nanmax(preZ)
+ if np.nanmax(preX) > preXmax: preXmax = np.nanmax(preX)
+ if args.v:
+ if np.nanmax(velZ) > velZmax: velZmax = np.nanmax(velZ)
+ if np.nanmax(velX) > velXmax: velXmax = np.nanmax(velX)
+ if args.T or args.lT:
+ if np.nanmax(TZ) > TZmax: TZmax = np.nanmax(TZ)
+ if np.nanmax(TX) > TXmax: TXmax = np.nanmax(TX)
# Min
- if np.nanmin(rhoZ) > rhoZmin: rhoZmin = np.nanmin(rhoZ)
- if np.nanmin(rhoX) > rhoXmin: rhoXmin = np.nanmin(rhoX)
- if np.nanmin(preZ) > preZmin: preZmin = np.nanmin(preZ)
- if np.nanmin(preX) > preXmin: preXmin = np.nanmin(preX)
- if np.nanmin(velZ) > velZmin: velZmin = np.nanmin(velZ)
- if np.nanmin(velX) > velXmin: velXmin = np.nanmin(velX)
- if np.nanmin(TZ) > TZmin: TZmin = np.nanmin(TZ)
- if np.nanmin(TX) > TXmin: TXmin = np.nanmin(TX)
+ if args.d:
+ if np.nanmin(rhoZ) > rhoZmin: rhoZmin = np.nanmin(rhoZ)
+ if np.nanmin(rhoX) > rhoXmin: rhoXmin = np.nanmin(rhoX)
+ if args.p:
+ if np.nanmin(preZ) > preZmin: preZmin = np.nanmin(preZ)
+ if np.nanmin(preX) > preXmin: preXmin = np.nanmin(preX)
+ if args.v:
+ if np.nanmin(velZ) > velZmin: velZmin = np.nanmin(velZ)
+ if np.nanmin(velX) > velXmin: velXmin = np.nanmin(velX)
+ if args.T or args.lT:
+ if np.nanmin(TZ) > TZmin: TZmin = np.nanmin(TZ)
+ if np.nanmin(TX) > TXmin: TXmin = np.nanmin(TX)
print ""
print "// Plotting Snapshots"
print ""
# Log10?
- rhoZmax = np.log10(rhoZmax)
- rhoXmax = np.log10(rhoXmax)
- preZmax = np.log10(preZmax)
- preXmax = np.log10(preXmax)
- lTZmax = np.log10(TZmax)
- lTXmax = np.log10(TXmax)
- rhoZmin = np.log10(rhoZmin)
- rhoXmin = np.log10(rhoXmin)
- preZmin = np.log10(preZmin)
- preXmin = np.log10(preXmin)
- lTZmin = np.log10(TZmin)
- lTXmin = np.log10(TXmin)
+ if args.d:
+ rhoZmax = np.log10(rhoZmax)
+ rhoXmax = np.log10(rhoXmax)
+ if args.p:
+ preZmax = np.log10(preZmax)
+ preXmax = np.log10(preXmax)
+ if args.lT:
+ lTZmax = np.log10(TZmax)
+ lTXmax = np.log10(TXmax)
+ if args.d:
+ rhoZmin = np.log10(rhoZmin)
+ rhoXmin = np.log10(rhoXmin)
+ if args.p:
+ preZmin = np.log10(preZmin)
+ preXmin = np.log10(preXmin)
+ if args.lT:
+ lTZmin = np.log10(TZmin)
+ lTXmin = np.log10(TXmin)
# Plot Snapshots
for ii, iout in enumerate(iouts):
# Load from Master List
- rhoZ = rhoZall[ii]
- rhoX = rhoXall[ii]
- velZ = velZall[ii]
- velX = velXall[ii]
- preZ = preZall[ii]
- preX = preXall[ii]
- TZ = TZall[ii]
- TX = TXall[ii]
+ if args.d:
+ rhoZ = rhoZall[ii]
+ rhoX = rhoXall[ii]
+ if args.v:
+ velZ = velZall[ii]
+ velX = velXall[ii]
+ if args.p:
+ preZ = preZall[ii]
+ preX = preXall[ii]
+ if args.T or args.lT:
+ TZ = TZall[ii]
+ TX = TXall[ii]
# Log10?
- rhoZ = np.log10(rhoZ)
- rhoX = np.log10(rhoX)
- preZ = np.log10(preZ)
- preX = np.log10(preX)
- lTX = np.log10(TX)
- lTZ = np.log10(TZ)
+ if args.d:
+ rhoZ = np.log10(rhoZ)
+ rhoX = np.log10(rhoX)
+ if args.p:
+ preZ = np.log10(preZ)
+ preX = np.log10(preX)
+ if args.lT:
+ lTX = np.log10(TX)
+ lTZ = np.log10(TZ)
# Mark Arrays vs. NaN
- rhoZ = np.ma.masked_array(rhoZ, mask=np.isnan(rhoZ))
- rhoX = np.ma.masked_array(rhoX, mask=np.isnan(rhoX))
- velZ = np.ma.masked_array(velZ, mask=np.isnan(velZ))
- velX = np.ma.masked_array(velX, mask=np.isnan(velX))
- preZ = np.ma.masked_array(preZ, mask=np.isnan(preZ))
- preX = np.ma.masked_array(preX, mask=np.isnan(preX))
+ if args.d:
+ rhoZ = np.ma.masked_array(rhoZ, mask=np.isnan(rhoZ))
+ rhoX = np.ma.masked_array(rhoX, mask=np.isnan(rhoX))
+ if args.v:
+ velZ = np.ma.masked_array(velZ, mask=np.isnan(velZ))
+ velX = np.ma.masked_array(velX, mask=np.isnan(velX))
+ if args.p:
+ preZ = np.ma.masked_array(preZ, mask=np.isnan(preZ))
+ preX = np.ma.masked_array(preX, mask=np.isnan(preX))
# Set Masked Colormap
# cmap = mpl.cm.hot