def testline(): from CoilViewer import seglistviewer from RingArray import fieldplot Rring=1.0 seglist=[[2,(-5.0,0.0,0.0),(5.0,0.0,0.0)]] seglistviewer(seglist) filename="/tmp/tmp.txt" fieldfind(Rring,seglist,filename) fieldplot(filename,XYZS=[False,True,True,True])
def commandlineapp(): import sys from RingArray import fieldplot coilfile=sys.argv[1] fieldfile=sys.argv[2] print coilfile if coilfile.split(".")[-1] == "xml": c=smoothcoil().XML_load(coilfile,globals()) print "opened using xml" elif coilfile.split(".")[-1] == "cPickle": c=smoothcoil().load(coilfile) print "opened using cPickle" Rring=c.Rformer seglist=c.seglist seglistviewer(seglist) fieldfind(Rring,seglist,fieldfile) fieldplot(fieldfile,XYZS=[True,False,True,True])
def testring(): from sensecoiltypes import HelixSeg from CoilViewer import seglistviewer from RingArray import fieldplot numsegs=30 Rring=1.0 dphi=2*pi/float(numsegs) seglist=[] phistart=0 phiend=dphi for i in range(numsegs): seglist.append(HelixSeg(2,phistart,-Rring,phiend,-Rring,Rring).xyzSeg()) seglist.append(HelixSeg(3,phiend,Rring,phistart,Rring,Rring).xyzSeg()) phistart=phistart+dphi phiend=phiend+dphi seglistviewer(seglist) filename="/tmp/tmp.txt" fieldfind(Rring,seglist,filename) fieldplot(filename,XYZS=[False,True,True,True])