Skip to content

Instantly share code, notes, and snippets.

@pshriwise
Created May 13, 2016 18:32
Show Gist options
  • Save pshriwise/82e510ae3a858f26a20a3affb7ae1ddf to your computer and use it in GitHub Desktop.
Save pshriwise/82e510ae3a858f26a20a3affb7ae1ddf to your computer and use it in GitHub Desktop.
python script used to add a total source intensity tag from an expanded r2s step 2 source .h5m. Raw
from pyne.mesh import Mesh,IMeshTag
import numpy as np
import sys
m = Mesh(sys.argv[1])
m.source_density_total = IMeshTag(size=1, dtype=float)
total = np.array(m.source_density_total[:])
for name, tag in m.tags.items():
if "source_density_" in name:
total += np.array(tag[:])
m.source_density_total[:] = total[:]
fout = sys.argv[1].split(".")
m.mesh.save(fout[0]+"_w_total.vtk")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment