3 Convert a Numpy file produced by NumpyDepoSaver into a vtk file which 4 can be visualized with paraview. 9 from wirecell
import units
10 from collections
import defaultdict
11 from tvtk.api
import tvtk, write_data
12 from tvtk.common
import configure_input
17 def main(infile, outname=None, toffset=1*units.us, speed=1.6*units.mm/units.us):
18 if outname
is None or outname ==
"-":
19 outname = os.path.splitext(infile)[0]
24 toffset = eval(toffset)
27 print(
"toffset=%f us, speed=%f mm/us" %
28 (toffset/units.us, speed/(units.mm/units.us)))
30 arrs = numpy.load(infile)
31 depos = arrs[
'depo_data_0']
46 rx = x + (t-toffset)*speed
48 p = dict(point=[-rx,y,z], values=dict(time=t,charge=q))
52 ofile = outname +
"-depos.vtp" 54 write_data(pointdata, ofile)
57 if '__main__' == __name__:
std::enable_if< internal::is_string< String >::value >::type print(std::FILE *f, const text_style &ts, const String &format_str, const Args &...args)
def main(infile, outname=None, toffset=1 *units.us, speed=1.6 *units.mm/units.us)