from yt.mods import *
import h5py
Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline]. For more information, type 'help(pylab)'.
# If necessary files aren't in the current dir, download them
if not os.path.isfile("mcnp_n_impr_fluka.h5m"):
from urllib import urlretrieve
urlretrieve("http://data.pyne.io/mcnp_n_impr_fluka.h5m", "mcnp_n_impr_fluka.h5m")
if not os.path.isfile("fng_usrbin22.h5m"):
# fng_usrbin22.h5m is a large file
# needs to be downloaded in chunks
import requests
r = requests.get("http://data.pyne.io/fng_usrbin22.h5m", stream=True)
with open("fng_usrbin22.h5m" , 'wb') as file:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
file.write(chunk)
file.flush()
# Load data file
pf = load("fng_usrbin22.h5m")
yt : [INFO ] 2014-03-13 13:12:45,722 Parameters: current_time = 0.0 yt : [INFO ] 2014-03-13 13:12:45,722 Parameters: domain_dimensions = [ 99. 91.53 98.4 ] yt : [INFO ] 2014-03-13 13:12:45,724 Parameters: domain_left_edge = [-49.5 -14.1 -49.2] yt : [INFO ] 2014-03-13 13:12:45,726 Parameters: domain_right_edge = [ 49.5 77.43 49.2 ] yt : [INFO ] 2014-03-13 13:12:45,727 Parameters: cosmological_simulation = 0.0
# Create the desired slice plot
s = SlicePlot(pf, 'z', ('moab','TALLY_TAG'), origin='lower-native')
# Load the facet file
f = h5py.File("mcnp_n_impr_fluka.h5m", "r")
# Get the triangle vertices
coords = f["/tstt/nodes/coordinates"][:]
conn = f["/tstt/elements/Tri3/connectivity"][:]
points = coords[conn-1]
# Annotate slice-triangle intersection contours to the plot
s.annotate_triangle_facets(points, plot_args={"colors": 'black'})
s.display()
yt : [INFO ] 2014-03-13 13:12:50,194 Loading field plugins. yt : [INFO ] 2014-03-13 13:12:50,196 Loaded angular_momentum (6 new fields) yt : [INFO ] 2014-03-13 13:12:50,197 Loaded astro (12 new fields) yt : [INFO ] 2014-03-13 13:12:50,199 Loaded cosmology (18 new fields) yt : [INFO ] 2014-03-13 13:12:50,201 Loaded fluid (53 new fields) yt : [INFO ] 2014-03-13 13:12:50,204 Loaded fluid_vector (84 new fields) yt : [INFO ] 2014-03-13 13:12:50,207 Loaded geometric (99 new fields) yt : [INFO ] 2014-03-13 13:12:50,209 Loaded local (99 new fields) yt : [INFO ] 2014-03-13 13:12:50,210 Loaded magnetic_field (105 new fields) yt : [INFO ] 2014-03-13 13:12:51,827 xlim = -49.500000 49.500000 yt : [INFO ] 2014-03-13 13:12:51,828 ylim = -14.100000 77.430000 yt : [INFO ] 2014-03-13 13:12:51,829 Making a fixed resolution buffer of (('moab', 'TALLY_TAG')) 800 by 800 yt : [INFO ] 2014-03-13 13:12:56,140 xlim = -49.500000 49.500000 yt : [INFO ] 2014-03-13 13:12:56,141 ylim = -14.100000 77.430000 yt : [INFO ] 2014-03-13 13:12:56,142 Making a fixed resolution buffer of (('moab', 'TALLY_TAG')) 800 by 800 yt : [INFO ] 2014-03-13 13:12:56,163 Making a fixed resolution buffer of (('moab', 'TALLY_TAG')) 800 by 800
(359249, 3, 3) [[[ -3.95386577 1.43382287 -4.74354792] [ -4.27990341 1.27580297 -4.41751003] [ -3.96068764 1.43797612 -4.73672581]] [[ -3.95386577 1.43382287 -4.74354792] [ -3.94706583 1.42959726 -4.75034761] [ -4.27990341 1.27580297 -4.41751003]] [[ -4.27990341 1.27580297 -4.41751003] [ -3.94706583 1.42959726 -4.75034761] [ -4.27321005 1.27494466 -4.4242034 ]] ..., [[ -7.5856576 31.96999931 5.88114738] [ -7.56865215 31.96999931 5.90301657] [ -7.56865215 31.96999931 -5.90301657]] [[ -7.56865215 31.96999931 5.90301657] [ -7.55158329 31.96999931 5.92483664] [ -7.55158329 31.96999931 -5.92483664]] [[ -7.55158329 31.96999931 5.92483664] [ -7.53445148 31.96999931 5.94660711] [ -7.53445148 31.96999931 -5.94660711]]]