def create(): from pyrateoptics.raytracer.surface_shape import Conic from pyrateoptics.raytracer.surface import Surface from pyrateoptics.raytracer.aperture import CircularAperture lc = LocalCoordinates.p(name="----LCglobal----") lc2 = LocalCoordinates.p(name="----LCap----", tiltx=0.1, decx=0.2) lc3 = LocalCoordinates.p(name="----LCsh----", tiltx=-0.1, decx=-0.2) lc.addChild(lc2) lc.addChild(lc3) ap = CircularAperture.p(lc2) sh = Conic.p(lc3, curv=0.01, cc=-1) su = Surface.p(lc, sh, ap, name="mysurface") return su
def initApCircular(self, minradius=0., maxradius=1.0, **kwargs): apclass = None if "surface" in kwargs: apclass = kwargs["surface"].aperture minradius = apclass.annotations["minradius"] maxradius = apclass.annotations["maxradius"] else: apclass = CircularAperture.p( self.__obj.LocalCoordinatesLink.Proxy.getLC(), minradius=minradius, maxradius=maxradius) self.__obj.addProperty("App::PropertyFloat", "minradius", "Aperture", "minradius").minradius = minradius self.__obj.addProperty("App::PropertyFloat", "maxradius", "Aperture", "maxradius").maxradius = maxradius self.__obj.apertureclass = apclass
def initApCircular(self, semidiameter=1.0, tx=0., ty=0., **kwargs): apclass = None if "surface" in kwargs: apclass = kwargs["surface"].aperture semidiameter = apclass.semidiameter tx = apclass.tx ty = apclass.ty else: apclass = CircularAperture.p( self.__obj.LocalCoordinatesLink.Proxy.getLC(), semidiameter=semidiameter, tx=tx, ty=ty) self.__obj.addProperty("App::PropertyFloat", "semidiameter", "Aperture", "semidiameter").semidiameter = semidiameter self.__obj.addProperty("App::PropertyFloat", "tx", "Aperture", "decentration x").tx = tx self.__obj.addProperty("App::PropertyFloat", "ty", "Aperture", "decentration y").ty = ty self.__obj.apertureclass = apclass
lc1 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf1", decz=-dropletradius), refname=lccomprism.name) # objectDist lc2 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="surf2", decz=dropletradius), refname=lccomprism.name) lc3 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="surf3", decz=0), refname=lccomprism.name) lc4 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="image", decz=-2.*dropletradius), refname=lccomprism.name) stopsurf = Surface.p(lc0, aperture=CircularAperture.p(lc0, maxradius=7*dropletradius)) frontsurf = Surface.p(lc1, shape=Asphere.p(lc1, curv=1./dropletradius), aperture=CircularAperture.p(lc1, maxradius=dropletradius)) rearsurf = Surface.p(lc2, shape=Asphere.p(lc2, curv=-1./dropletradius), aperture=CircularAperture.p(lc2, maxradius=dropletradius)) midsurf = Surface.p(lc3, shape=Asphere.p(lc3, curv=0), aperture=CircularAperture.p(lc3, maxradius=dropletradius)) image = Surface.p(lc4, aperture=CircularAperture.p(lc4, maxradius=7.*dropletradius)) elem = OpticalElement.p(lc0, name="droplet") database_basepath = "refractiveindex.info-database/database"
refname=lc0.name) lc2 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf2", decz=5.0, tiltx=10 * math.pi / 180.0), refname=lc1.name) lc3 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="image", decz=-5.0, tiltx=-10 * math.pi / 180.0), refname=lc2.name) stopsurf = Surface.p(lc0) frontsurf = Surface.p(lc1, shape=Conic.p(lc1, curv=0), aperture=CircularAperture.p(lc1, maxradius=10.0)) rearsurf = Surface.p(lc2, shape=Conic.p(lc2, curv=0), aperture=CircularAperture.p(lc3, maxradius=10.0)) image = Surface.p(lc3) elem = OpticalElement.p(lc0, name="crystalelem") no = 1.5 neo = 1.8 myeps = np.array([[no, 0, 0], [0, no, 0], [0, 0, neo]]) crystal = AnisotropicMaterial.p(lc1, myeps) elem.addMaterial("crystal", crystal)
LocalCoordinates.p(name="stop", decz=0.0), refname=s.rootcoordinatesystem.name) lc1 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="surf1", decz=-1.048), refname=lc0.name) # objectDist lc2 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="surf2", decz=4.0), refname=lc1.name) lc3 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="surf3", decz=2.5), refname=lc2.name) lc4 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="image", decz=97.2), refname=lc3.name) stopsurf = Surface.p(lc0) frontsurf = Surface.p(lc1, shape=Conic.p(lc1, curv=1./62.8), aperture=CircularAperture.p(lc1, maxradius=12.7)) cementsurf = Surface.p(lc2, shape=Conic.p(lc2, curv=-1./45.7), aperture=CircularAperture.p(lc2, maxradius=12.7)) rearsurf = Surface.p(lc3, shape=Conic.p(lc3, curv=-1./128.2), aperture=CircularAperture.p(lc3, maxradius=12.7)) image = Surface.p(lc4) elem = OpticalElement.p(lc0, name="thorlabs_AC_254-100-A") bk7 = ConstantIndexGlass.p(lc1, n=1.5168) sf5 = ConstantIndexGlass.p(lc2, n=1.6727) elem.addMaterial("BK7", bk7) elem.addMaterial("SF5", sf5)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf1", decz=-10.0, tiltx=30. * degree), refname=lccomprism.name) # objectDist lc2 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf2", decz=10.0, tiltx=-30. * degree), refname=lccomprism.name) lc3 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="image", decz=50.0), refname=lccomprism.name) stopsurf = Surface.p(lc0) frontsurf = Surface.p(lc1, shape=Conic.p(lc1, curv=0), aperture=CircularAperture.p(lc1, maxradius=20.0)) rearsurf = Surface.p(lc2, shape=Conic.p(lc2, curv=0), aperture=CircularAperture.p(lc2, maxradius=20.0)) image = Surface.p(lc3) elem = OpticalElement.p(lc0, name="prism") glass = ModelGlass.p(lc1) elem.addMaterial("glass", glass) elem.addSurface("stop", stopsurf, (None, None)) elem.addSurface("surf1", frontsurf, (None, "glass")) elem.addSurface("surf2", rearsurf, ("glass", None)) elem.addSurface("image", image, (None, None))
decz=-100, decy=-35), refname=lc4.name) lc5ap = s.addLocalCoordinateSystem(LocalCoordinates.p(name="oaparaap", decz=0, decy=35), refname=lc5.name) lc6 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="image2", decz=55, tiltx=1 * math.pi / 32), refname=lc5.name) objectsurf = Surface.p(lc0) m1surf = Surface.p(lc1, shape=Conic.p(lc1, curv=-0.01), aperture=CircularAperture.p(lc1, maxradius=20.)) m2surf = Surface.p(lc2, shape=Conic.p(lc2, curv=0.01), aperture=CircularAperture.p(lc2, maxradius=12.7)) m3surf = Surface.p(lc3, shape=Conic.p(lc3, curv=-0.006), aperture=CircularAperture.p(lc3, maxradius=20.7)) image1 = Surface.p(lc4) oapara = Surface.p(lc3, shape=Conic.p(lc5, curv=0.01, cc=-1.), aperture=CircularAperture.p(lc5ap, maxradius=30.0)) image2 = Surface.p(lc6, aperture=CircularAperture.p(lc6, maxradius=20.0)) elem = OpticalElement.p(lc0, name="TMA") # elem.addMaterial("crystal", crystal)
decy=-30.892, decz=43.083, tiltx=-si * 50.668 * degree, tiltThenDecenter=False), refname=lc0.name) objsurf = Surface.p(lc0) D1surf = Surface.p(lcD1) S1surf = Surface.p(lcS1, shape=Biconic.p(lcS1, curvy=si * 1. / 108.187, curvx=si * 1. / 73.105, coefficients=[(0., 0.), (-si * 5.542e-7, -0.08), (-si * 8.176e-11, -1.379)]), aperture=CircularAperture.p(lcS1, maxradius=40.0)) D1Psurf = Surface.p(lcD1prime) D2surf = Surface.p(lcD2) S2surf = Surface.p(lcS2, shape=Biconic.p(lcS2, curvy=si * 1. / 69.871, curvx=si * 1. / 60.374, ccy=-0.1368, ccx=-0.123, coefficients=[(0., 0.), (si * 7.233e-11, 29.075), (si * 4.529e-12, -2.085)]), aperture=CircularAperture.p(lcS2, maxradius=40.0)) D2Psurf = Surface.p(lcD2prime) D3surf = Surface.p(lcD3) S3surf = Surface.p(lcS3,
def initDemoSystem(self): s = OpticalSystem.p() lc0 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="object", decz=0.0), refname=s.rootcoordinatesystem.name) lc1 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf1", decz=2.0), refname=lc0.name) # objectDist lc2 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf2", decz=3.0), refname=lc1.name) lc3 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf3", decz=5.0, tiltx=0.0 * math.pi / 180.0), refname=lc2.name) lc4 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf4", decz=3.0), refname=lc3.name) lc5 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf5", decz=3.0), refname=lc4.name) lc6 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf6", decz=2.0), refname=lc5.name) lc7 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="surf7", decz=3.0), refname=lc6.name) lc8 = s.addLocalCoordinateSystem(LocalCoordinates.p(name="image", decz=19.0), refname=lc7.name) objectsurf = Surface.p(lc0) surf1 = Surface.p(lc1, shape=Conic.p(lc1, curv=1 / -5.922), aperture=CircularAperture.p(lc1, maxradius=10.0)) surf2 = Surface.p(lc2, shape=Conic.p(lc2, curv=1 / -3.160), aperture=CircularAperture.p(lc2, maxradius=10.0)) surf3 = Surface.p(lc3, shape=Conic.p(lc3, curv=1 / 15.884), aperture=CircularAperture.p(lc3, maxradius=10.0)) surf4 = Surface.p(lc4, shape=Conic.p(lc4, curv=1 / -12.756), aperture=CircularAperture.p(lc4, maxradius=10.0)) stopsurf = Surface.p(lc5, aperture=CircularAperture.p(lc5, maxradius=10.0)) surf6 = Surface.p(lc6, shape=Conic.p(lc6, curv=1 / 3.125), aperture=CircularAperture.p(lc6, maxradius=10.0)) surf7 = Surface.p(lc7, shape=Conic.p(lc7, curv=1 / 1.479), aperture=CircularAperture.p(lc7, maxradius=10.0)) image = Surface.p(lc8) elem = OpticalElement.p(lc0, name="lenssystem") glass = material_isotropic.ConstantIndexGlass.p(lc0, n=1.7) glass2 = material_isotropic.ConstantIndexGlass.p(lc0, n=1.5) elem.addMaterial("glass", glass) elem.addMaterial("glass2", glass2) elem.addSurface("object", objectsurf, (None, None)) elem.addSurface("surf1", surf1, (None, "glass")) elem.addSurface("surf2", surf2, ("glass", None)) elem.addSurface("surf3", surf3, (None, "glass")) elem.addSurface("surf4", surf4, ("glass", None)) elem.addSurface("stop", stopsurf, (None, None)) elem.addSurface("surf6", surf6, (None, "glass2")) elem.addSurface("surf7", surf7, ("glass2", None)) elem.addSurface("image", image, (None, None)) for mysurf in elem.surfaces.values(): print(mysurf.aperture.annotations) s.addElement("lenssys", elem) return s
lc5ap = s.addLocalCoordinateSystem( LocalCoordinates.p(name="oaparaap", decz=0, decy=35), refname=lc5.name) lc6 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="image2", decz=52.8, tiltx=1*math.pi/32), refname=lc5.name) lc7 = s.addLocalCoordinateSystem( LocalCoordinates.p(name="image3", decz=5), refname=lc6.name) objectsurf = Surface.p(lc0) m1surf = Surface.p(lc1, shape=Conic.p(lc1, curv=-0.01)) m2surf = Surface.p(lc2, shape=Conic.p(lc2, curv=0.01)) m3surf = Surface.p(lc3, shape=Conic.p(lc3, curv=-0.006)) image1 = Surface.p(lc4) oapara = Surface.p(lc3, shape=Conic.p(lc5, curv=0.01, cc=-1.)) image2 = Surface.p(lc6, aperture=CircularAperture.p(lc6, maxradius=20.0)) image3 = Surface.p(lc7, aperture=CircularAperture.p(lc7, maxradius=20.0)) elem = OpticalElement.p(lc0, name="TMA") elem.addMaterial("air", air) elem.addSurface("object", objectsurf, (None, None)) elem.addSurface("m1", m1surf, (None, None)) elem.addSurface("m2", m2surf, (None, None)) elem.addSurface("m3", m3surf, (None, None)) elem.addSurface("image1", image1, (None, None)) elem.addSurface("oapara", oapara, (None, None)) elem.addSurface("image2", image2, (None, None)) elem.addSurface("image3", image3, (None, None))