In [ ]:
%matplotlib inline
import os
import util
import numpy as np
import yt
import logging
logging.getLogger('yt').setLevel(logging.WARNING)
import matplotlib
matplotlib.rcParams['figure.dpi'] = 100
from matplotlib import pyplot as plt

#def _jetmomentum_z(field, data):
#    return data['gas', 'density'] * data['gas', 'velocity_z'] * data['flash', 'jet ']

#yt.add_field( 'jetmomentum_z', function=_jetmomentum_z, units='g/cm**2/s', take_log=False)

In [ ]:
dir ='/home/ychen/data/0only_0529_h1/'
regex = 'data/MHD_Jet*_plt_cnt_???0'

fields_grid = ['density', 'velocity_z']

ts = yt.DatasetSeries(os.path.join(dir,regex))

ds = ts[60]

In [ ]:


In [ ]:
proj_axis = 'x'
field = 'magnetic_field_strength'
center=(0.0,0.0,0.0)
#LeftEdge = yt.YTArray([-80, -80, -160], 'kpc')
#RightEdge = yt.YTArray([80, 80, 160], 'kpc')
#if False:
ds = ts[63]
plot = yt.SlicePlot(ds, 'x', field, center=center)
plot.zoom(12)
plot.set_buff_size((512,1024))
#plot.set_figure_size(6)
#plot.annotate_grids()
#plot.set_cmap('density', 'gist_heat_r')
#plot.set_log(field, False)
plot.annotate_timestamp(0.05, 0.95, time_format="{time:6.3f} {units}", time_unit='Myr', text_args={'color':'w'})
#plot.set_zlim(field, 1E3, 3E9)
#plot.set_cmap(field, 'algae')
plot.show()

In [ ]:
plot.annotate_clear()
plot.annotate_line_integral_convolution('magnetic_field_y', 'magnetic_field_z', lim=(0.25,0.65), \
                                        cmap='binary', alpha=0.8, kernellen=32)#, const_alpha=True)
#plot.annotate_quiver('velocity_y', 'velocity_z', 30, scale=1E10)
#plot.annotate_velocity(15, scale=3E9)
#plot.annotate_streamlines('velocity_y', 'velocity_z', factor=4, density=4)
#plot.set_log(field, False)

#plot.zoom(8)
plot.show()

In [ ]: