from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 1.414 * 0.0025 target = polygon(([-tgtlen / 2, -tgtrad], [tgtlen / 2, -tgtrad], [tgtlen / 2, tgtrad], [-tgtlen / 2, tgtrad])) ################################################################ ###### Lead collar (for collimating photons) #seg 1 x1_collar = 0.074 z1_collar = 2.75 x2_collar = 0.185 #*1.414 The collar is a rectangle (in CAD), but the narrow dimension is the one relevant for here z2_collar = 2.75 x3_collar = 0.185 #*1.414 z3_collar = 2.95
#!/usr/bin/python from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] target = polygon( ([0,0.0], [1.0 ,0.0] , [1.0 ,0.01], [0 ,0.01]) ) mypoly2 = polygon( ([2,0], [3, 0], [3,1], [2,1]), isDetector=True ) mypoly3 = polygon( ([1.7, 0.1], [1.85, 0.1], [1.85,0.2], [1.7,0.2]) ) mypoly4 = polygon( ([1.7, 0.4], [1.8, 0.4], [1.8,1.0], [1.7,1.0]) ) mirror = polygon( ([1.5, -0.5], [1.6, -0.5], [1.6,-0.4], [1.5,-0.4]) ) sources.append(target) allpolys.append(mypoly2) allpolys.append(mypoly3) allpolys.append(mypoly4) allpolys.append(mirror) print sources print allpolys
#!/usr/bin/python from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 tgtrad = 0.04 target = polygon( ([-tgtlen/2,-tgtrad], [tgtlen/2, -tgtrad], [tgtlen/2,tgtrad], [-tgtlen/2,tgtrad]) ) uscoll1_r1 = 0.023 uscoll1_r2 = 0.030 uscoll1_thick = 0.2 uscoll1_z = 5.575 uscoll1_up = polygon( ([uscoll1_z-uscoll1_thick/2, uscoll1_r1], [uscoll1_z+uscoll1_thick/2, uscoll1_r1], [uscoll1_z+uscoll1_thick/2, uscoll1_r2], [uscoll1_z-uscoll1_thick/2, uscoll1_r2] )) uscoll1_down = polygon( ([uscoll1_z-uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r1], [uscoll1_z-uscoll1_thick/2, -uscoll1_r1] )) uscoll2_r1 = 0.026 uscoll2_r2 = 0.034 uscoll2_r3 = 0.110
from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 0.0025 target = polygon( ([-tgtlen/2,-tgtrad], [tgtlen/2, -tgtrad], [tgtlen/2,tgtrad], [-tgtlen/2,tgtrad]) ) uscoll1_r1 = 0.023 uscoll1_r2 = 0.030 uscoll1_thick = 0.2 uscoll1_z = 5.575 uscoll1_up = polygon( ([uscoll1_z-uscoll1_thick/2, uscoll1_r1], [uscoll1_z+uscoll1_thick/2, uscoll1_r1], [uscoll1_z+uscoll1_thick/2, uscoll1_r2], [uscoll1_z-uscoll1_thick/2, uscoll1_r2] ), notSource=False) uscoll1_down = polygon( ([uscoll1_z-uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r1], [uscoll1_z-uscoll1_thick/2, -uscoll1_r1] ), notSource=False) uscoll2_r1 = 0.026 uscoll2_r2 = 0.034 uscoll2_r3 = 0.110
from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 0.0025 target = polygon( ([-tgtlen/2,-tgtrad], [tgtlen/2, -tgtrad], [tgtlen/2,tgtrad], [-tgtlen/2,tgtrad]) ) uscoll1_r1_up = 0.024 uscoll1_r1_dn = 0.015529 uscoll1_r2 = 0.031703 uscoll1_thick = 0.5 uscoll1_z = 5.425-0.25 uscoll1_up = polygon( ([uscoll1_z-uscoll1_thick/2, uscoll1_r1_up], [uscoll1_z+uscoll1_thick/2, uscoll1_r1_dn], [uscoll1_z+uscoll1_thick/2, uscoll1_r2], [uscoll1_z-uscoll1_thick/2, uscoll1_r2] ), notSource=False) uscoll1_down = polygon( ([uscoll1_z-uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r2], [uscoll1_z+uscoll1_thick/2, -uscoll1_r1_dn], [uscoll1_z-uscoll1_thick/2, -uscoll1_r1_up] ), notSource=False) uscoll2_r1 = 0.026 uscoll2_r2 = 0.034
from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 0.0025 target = polygon(([-tgtlen / 2, -tgtrad], [tgtlen / 2, -tgtrad], [tgtlen / 2, tgtrad], [-tgtlen / 2, tgtrad])) ################################################################# ######inner photon collimator (Col 1) # Previous implementation assumed it was a solid shape from front face to back face, # but this neglects the fact that it tapers inwards a lot in the first 30cm and then # untapers in the last 10cm - updating by splitting into 5 segments x1_inner_photon_1 = 0.024 z1_inner_photon_1 = 5.175 x2_inner_photon_1 = 0.031703 z2_inner_photon_1 = 5.175
from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 0.0025 target = polygon(([-tgtlen / 2, -tgtrad], [tgtlen / 2, -tgtrad], [tgtlen / 2, tgtrad], [-tgtlen / 2, tgtrad])) uscoll1_r1 = 0.023 uscoll1_r2 = 0.030 uscoll1_thick = 0.2 uscoll1_z = 5.575 uscoll1_up = polygon(([uscoll1_z - uscoll1_thick / 2, uscoll1_r1], [ uscoll1_z + uscoll1_thick / 2, uscoll1_r1 ], [uscoll1_z + uscoll1_thick / 2, uscoll1_r2 ], [uscoll1_z - uscoll1_thick / 2, uscoll1_r2]), notSource=False) uscoll1_down = polygon(([uscoll1_z - uscoll1_thick / 2, -uscoll1_r2], [ uscoll1_z + uscoll1_thick / 2, -uscoll1_r2
from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtlen = 1.5 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 0.0025 target = polygon(([-tgtlen / 2, -tgtrad], [tgtlen / 2, -tgtrad], [tgtlen / 2, tgtrad], [-tgtlen / 2, tgtrad])) uscoll1_r1_up = 0.024 uscoll1_r1_dn = 0.015529 uscoll1_r2 = 0.031703 uscoll1_thick = 0.5 uscoll1_z = 5.425 - 0.25 uscoll1_up = polygon(([uscoll1_z - uscoll1_thick / 2, uscoll1_r1_up], [ uscoll1_z + uscoll1_thick / 2, uscoll1_r1_dn ], [uscoll1_z + uscoll1_thick / 2, uscoll1_r2 ], [uscoll1_z - uscoll1_thick / 2, uscoll1_r2]), notSource=False) uscoll1_down = polygon(([uscoll1_z - uscoll1_thick / 2, -uscoll1_r2], [
gi.require_version('Gtk', '3.0') from gi.repository import Gtk from drawlight import drawlight sources = [] allpolys = [] tgtoffset = 0.5 tgtlen = 1.25 #tgtrad = 0.04 #tgtrad = 0.002 tgtrad = 1.4142 * 0.0025 target = polygon(([-tgtlen / 2, -tgtrad], [tgtlen / 2, -tgtrad], [tgtlen / 2, tgtrad], [-tgtlen / 2, tgtrad])) ################################################################ ###### Lead collar (for collimating photons) #seg 1 x1_collar = 0.074 #+0.05 z1_collar = 2.851 #+1.5 x2_collar = 0.185 #*1.414 The collar is a rectangle (in CAD), but the narrow dimension is the one relevant for here z2_collar = 2.851 #+1.5 x3_collar = 0.185 #*1.414 z3_collar = 3.051 #+1.5
#!/usr/bin/python from poly import polygon from poly import face from gi.repository import Gtk from drawlight import drawlight mypoly1 = polygon( ([0,0.5], [1.0 ,0.5] , [1.0 ,0.51], [0 ,0.51]) ) mypoly2 = polygon( ([2,0], [3, 0], [3,1], [2,1]) ) print mypoly1.pts print mypoly2.pts mypoly2.light( [mypoly1], () ) for aface in mypoly2.faces: print [aface.v1, aface.v2], aface.lit1 if aface.getlitfaces(): for lface in aface.getlitfaces(): print lface.v1, lface.v2 print "" mydraw = drawlight( [mypoly1, mypoly2] ) Gtk.main()