コード例 #1
0
# TODO: add materials via command line

show_spot = parsed.showspot
file_to_read = parsed.file
enpd = parsed.epd
num_rays = parsed.numrays
bundletype = parsed.bundletype
anglex = parsed.anglex
reverse = parsed.reverse

p = ZMXParser(file_to_read, name='ZMXParser')
lctmp = LocalCoordinates("tmp")

matdict = {
    "BK7": ConstantIndexGlass(lctmp, 1.5168),
    "LAFN21": ConstantIndexGlass(lctmp, 1.788),
    "SF53": ConstantIndexGlass(lctmp, 1.72)
}

(s, seq) = p.createOpticalSystem(matdict)

if s is None:
    sys.exit()

initialbundles_dict = p.createInitialBundle()

osa = OpticalSystemAnalysis(s, seq, name="Analysis")

ray_paths = []
コード例 #2
0
ファイル: demo_hud.py プロジェクト: marcospindler10/pyrate
import pyrateoptics.raytracer.helpers

# definition of optical system

# Design: US patent no. 5701202 A, inventor: Koichi Takahashi
# and also: Bo Chen, Alois M. Herkommer, Opt. Express 24, 26999 (2016)

logging.basicConfig(level=logging.INFO)

s = OpticalSystem()

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="object", decz=0.0),
                                 refname=s.rootcoordinatesystem.name)

air = ConstantIndexGlass(lc0, 1.0)
glass = ConstantIndexGlass(lc0, 1.492)
s.material_background = air

si = -1.

lcD1 = s.addLocalCoordinateSystem(LocalCoordinates(name="D1", decz=30.002),
                                  refname=lc0.name)
lcS1 = s.addLocalCoordinateSystem(LocalCoordinates(name="S1",
                                                   decy=-24.028,
                                                   decz=26.360,
                                                   tiltx=-si * 14.7 * degree,
                                                   tiltThenDecenter=False),
                                  refname=lc0.name)
lcD1prime = s.addLocalCoordinateSystem(LocalCoordinates(
    name="D1prime",
コード例 #3
0
lc8 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=19.0),
                                 refname=lc7.name)

objectsurf = Surface(lc0)
surf1 = Surface(lc1, shape=surfShape.Conic(lc1, curv=1 / -5.922))
surf2 = Surface(lc2, shape=surfShape.Conic(lc2, curv=1 / -3.160))
surf3 = Surface(lc3, shape=surfShape.Conic(lc3, curv=1 / 15.884))
surf4 = Surface(lc4, shape=surfShape.Conic(lc4, curv=1 / -12.756))
stopsurf = Surface(lc5)
surf6 = Surface(lc6, shape=surfShape.Conic(lc6, curv=1 / 3.125))
surf7 = Surface(lc7, shape=surfShape.Conic(lc7, curv=0.1 * 1 / 1.479))
image = Surface(lc8)

elem = OpticalElement(lc0, name="lenssystem")

glass = ConstantIndexGlass(lc0, n=1.7)
glass2 = ConstantIndexGlass(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))
コード例 #4
0
 def initConstantIndex(self, index=1.0):
     self.__obj.addProperty("App::PropertyFloat", "index", "Material",
                            "constant index").index = index
     self.__obj.matclass = ConstantIndexGlass(index)