예제 #1
0
import core.helpers

wavelength = 0.5876e-3

# definition of optical system

#v = np.ones(3)# + 0.001*np.random.random(3)
#myeps = np.diag(v)


s = OpticalSystem() 

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

#air = AnisotropicMaterial(lc0, myeps)  # tests for anisotropic mirror
air = ConstantIndexGlass(lc0, 1.0)
s.material_background = air

lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="m1", decz=50.0, tiltx=-math.pi/8), refname=lc0.name) # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="m2_stop", decz=-50.0, decy=-20, tiltx=math.pi/16), refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="m3", decz=50.0, decy=-30, tiltx=3*math.pi/32), refname=lc2.name)
lc4 = s.addLocalCoordinateSystem(LocalCoordinates(name="image1", decz=-50, decy=-15, tiltx=-math.pi/16), refname=lc3.name)
lc5 = s.addLocalCoordinateSystem(LocalCoordinates(name="oapara", decz=-100, decy=-35), refname=lc4.name)
lc5ap = s.addLocalCoordinateSystem(LocalCoordinates(name="oaparaap", decz=0, decy=35), refname=lc5.name)
lc6 = s.addLocalCoordinateSystem(LocalCoordinates(name="image2", decz=55, tiltx=1*math.pi/32), refname=lc5.name)
lc7 = s.addLocalCoordinateSystem(LocalCoordinates(name="image3", decz=5), refname=lc6.name)

objectsurf = Surface(lc0)
m1surf = Surface(lc1, shape=surfShape.Conic(lc1, curv=-0.01), apert=CircularAperture(lc1, 20.))
m2surf = Surface(lc2, shape=surfShape.Conic(lc2, curv=0.01), apert=CircularAperture(lc2, 12.7))
m3surf = Surface(lc3, shape=surfShape.Conic(lc3, curv=-0.006), apert=CircularAperture(lc3, 12.7))
예제 #2
0
stopsurf = Surface(lc0)
frontsurf = Surface(lc1,
                    shape=surfShape.Conic(lc1),
                    apert=CircularAperture(lc1, 12.7))
backsurf = Surface(lc2,
                   shape=surfShape.Asphere(lc2,
                                           curv=-1. / 50.0,
                                           cc=-1.,
                                           acoeffs=[0.0, 0.0, 0.0]),
                   apert=CircularAperture(lc2, 12.7))
image = Surface(lc3)

elem = OpticalElement(lc0, label="asphereelement")

bk7 = ConstantIndexGlass(lc1, n=1.5168)

elem.addMaterial("BK7", bk7)

elem.addSurface("stop", stopsurf, (None, None))
elem.addSurface("front", frontsurf, (None, "BK7"))
elem.addSurface("rear", backsurf, ("BK7", None))
elem.addSurface("image", image, (None, None))

s.addElement("asph", elem)

rstobj = raster.MeridionalFan()
(px, py) = rstobj.getGrid(20)

rpup = 11.43
o = np.vstack((rpup * px, rpup * py, -5. * np.ones_like(px)))
예제 #3
0
 def initConstantIndex(self, index=1.0):
     self.__obj.addProperty("App::PropertyFloat", "index", "Material",
                            "constant index").index = index
     self.__obj.matclass = ConstantIndexGlass(index)
예제 #4
0
    print("file.zmx relative to local directory")
    print("u for utf16 file; a for ascii file (try both)")
    exit()

file_to_read = sys.argv[1]
u_or_a = sys.argv[2]
enpd = float(sys.argv[3])
num_rays = int(sys.argv[4])

ascii_read = True if u_or_a == "a" else False

p = ZMXParser(file_to_read, ascii=ascii_read)
lctmp = LocalCoordinates("tmp")

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

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

rstobj = raster.MeridionalFan()
(px, py) = rstobj.getGrid(num_rays)

rpup = enpd * 0.5  #7.5
o = np.vstack((rpup * px, rpup * py, -5. * np.ones_like(px)))

k = np.zeros_like(o)
k[1, :] = math.sin(0.0)
k[2, :] = math.cos(0.0)

ey = np.zeros_like(o)
예제 #5
0
파일: demo_hud.py 프로젝트: NelisW/pyrate
import core.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",
예제 #6
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))
예제 #7
0
try:
    database_basepath = "refractiveindex.info-database/database"     
    shelf = "3d"
    book  = "liquids"
    page  = "water"    


    gcat = refractiveindex_dot_info_glasscatalog(database_basepath)

    waterdict = gcat.getMaterialDict(shelf, book, page)
    water = CatalogMaterial(lc0, waterdict, name="water (catalogue)")

except:
    logging.warn("refractive index database not found. please download it and symlink\n\
            to it in your local pyrate directory")
    water = ConstantIndexGlass(lc0, n=1.336, name="water (failsafe)")

logging.info("wavelength %f, index %f" % (wave_red, water.getIndex(None, wave_red).real))
logging.info("wavelength %f, index %f" % (wave_blue, water.getIndex(None, wave_blue).real))

elem.addMaterial("water", water)

elem.addSurface("stop", stopsurf, (None, None))
elem.addSurface("surf1", frontsurf, (None, "water"))
elem.addSurface("surf2", rearsurf, ("water", "water"))
elem.addSurface("surf4", frontsurf, ("water", None))
elem.addSurface("image", image, (None, None))

s.addElement("droplet", elem)

rstobj = raster.MeridionalFan()
예제 #8
0
stopsurf = Surface(lc0)
frontsurf = Surface(lc1,
                    shape=surfShape.Conic(lc1, curv=1. / 62.8),
                    apert=CircularAperture(lc1, 12.7))
cementsurf = Surface(lc2,
                     shape=surfShape.Conic(lc2, curv=-1. / 45.7),
                     apert=CircularAperture(lc2, 12.7))
rearsurf = Surface(lc3,
                   shape=surfShape.Conic(lc3, curv=-1. / 128.2),
                   apert=CircularAperture(lc3, 12.7))
image = Surface(lc4)

elem = OpticalElement(lc0, label="thorlabs_AC_254-100-A")

bk7 = ConstantIndexGlass(lc1, n=1.5168)
sf5 = ConstantIndexGlass(lc2, n=1.6727)

elem.addMaterial("BK7", bk7)
elem.addMaterial("SF5", sf5)

elem.addSurface("stop", stopsurf, (None, None))
elem.addSurface("front", frontsurf, (None, "BK7"))
elem.addSurface("cement", cementsurf, ("BK7", "SF5"))
elem.addSurface("rear", rearsurf, ("SF5", None))
elem.addSurface("image", image, (None, None))

s.addElement("AC254-100", elem)

rstobj = raster.MeridionalFan()
(px, py) = rstobj.getGrid(20)