3D visualization

3d-images

the package Opyndx can give nice 3d output.

import Opyndx

to visualize the conductors, one can do:

conductors.visualize()

or

condviz = conductors.getdxobject()

fullviz = Opyndx.DXCollection(condviz)

Opyndx.DXImage(fullviz)

The last option has the advantage that you can also visualize other things, for example particles, by adding more containers to DXCollection().

particles

There is a function called viewparticles that can be used. Here is an example code that draws the particles, using the particle kinetic energy to determine the color. Note that 'ke' here can actually be any quantity. This also includes code to draw a nice colorbar. You would then do DXImage(dd) to display it.

dotsize = 1.0e-3/warp.ave(ke)

ppp,colormap = Opyndx.viewparticles(x,y,z,ke,color='auto',colorbar=1,

ratio=1.,

type=0.2,

scale=[1./dotsize,1./dotsize,1./dotsize],

cmin=cmin,cmax=cmax,

display=0)

dd = Opyndx.DXCollection(ppp)

cb = Opyndx.DXColorBar(colormap,horizontal=1,position=[0.95,0.03],

label='MeV',

ticklocations=Opyndx.DXRealList(ticklocations),

ticklabels=Opyndx.DXMakeStringList(ticklabels))

dd.addobject(cb)