コード例 #1
0
ファイル: demo_rainbow.py プロジェクト: NelisW/pyrate
# definition of optical system
s = OpticalSystem() 

dropletradius = 0.1

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="stop", decz=0.0), refname=s.rootcoordinatesystem.name)
lccomprism = s.addLocalCoordinateSystem(LocalCoordinates(name="dropletcenter", decz=2.*dropletradius), refname=lc0.name)

lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1", decz=-dropletradius), refname=lccomprism.name) # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2", decz=dropletradius), refname=lccomprism.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf3", decz=0), refname=lccomprism.name)
lc4 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=-2.*dropletradius), refname=lccomprism.name)


stopsurf = Surface(lc0, apert=CircularAperture(lc0, 7*dropletradius))
frontsurf = Surface(lc1, shape=Asphere(lc1, curv=1./dropletradius), apert=CircularAperture(lc1, dropletradius))
rearsurf = Surface(lc2, shape=Asphere(lc2, curv=-1./dropletradius), apert=CircularAperture(lc2, dropletradius))
midsurf = Surface(lc3, shape=Asphere(lc3, curv=0), apert=CircularAperture(lc3, dropletradius))

image = Surface(lc4, apert=CircularAperture(lc4, 7.*dropletradius))


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



try:
    database_basepath = "refractiveindex.info-database/database"     
    shelf = "3d"
    book  = "liquids"
コード例 #2
0
ファイル: demo_hud.py プロジェクト: NelisW/pyrate
                                                      decz=43.083,
                                                      tiltx=-si * 50.668 *
                                                      degree,
                                                      tiltThenDecenter=False),
                                     refname=lc0.name)

objsurf = Surface(lc0)
D1surf = Surface(lcD1)
#S1surf = Surface(lcS1, shape=Conic(lcS1, curv=si*1./108.187, cc=0), apert=CircularAperture(lcS1, 100.0))
S1surf = Surface(lcS1,
                 shape=Biconic(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)]),
                 apert=CircularAperture(lcS1, 40.0))
D1Psurf = Surface(lcD1prime)
D2surf = Surface(lcD2)
#S2surf = Surface(lcS2, shape=Conic(lcS2, curv=si*1./69.871, cc=-0.1368), apert=CircularAperture(lcS2, 60.0))
S2surf = Surface(lcS2,
                 shape=Biconic(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)]),
                 apert=CircularAperture(lcS2, 40.0))
D2Psurf = Surface(lcD2prime)
D3surf = Surface(lcD3)
コード例 #3
0
ファイル: demo_mirrors.py プロジェクト: NelisW/pyrate
                                 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))
image1 = Surface(lc4)
oapara = Surface(lc3,
                 shape=surfShape.Conic(lc5, curv=0.01, cc=-1.),
                 apert=CircularAperture(lc5ap, 30.0))
image2 = Surface(lc6, apert=CircularAperture(lc6, 20.0))
image3 = Surface(lc7, apert=CircularAperture(lc7, 20.0))

elem = OpticalElement(lc0, name="TMA")
コード例 #4
0
# definition of optical system
s = OpticalSystem()

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="stop", decz=1.0),
                                 refname=s.rootcoordinatesystem.name)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1", decz=10.0),
                                 refname=lc0.name)  # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2", decz=5.0),
                                 refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=10.0),
                                 refname=lc2.name)

stopsurf = Surface(lc0)
frontsurf = Surface(lc1,
                    shape=surfShape.Conic(lc1, curv=0),
                    apert=CircularAperture(lc1, 10.0))
rearsurf = Surface(lc2,
                   shape=surfShape.Conic(lc2, curv=0),
                   apert=CircularAperture(lc3, 10.0))
image = Surface(lc3)

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

no = 1.5
neo = 1.8

myeps = np.array([[no, 0, 0], [0, no, 0], [0, 0, neo]])

crystal = AnisotropicMaterial(lc1, myeps)

elem.addMaterial("crystal", crystal)
コード例 #5
0
ファイル: demo_grin.py プロジェクト: rhambach/pyrate
                                 refname=s.rootcoordinatesystem.name)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1",
                                                  decz=10.0,
                                                  tiltx=5. * math.pi / 180.0),
                                 refname=lc0.name)  # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2",
                                                  decz=20.0,
                                                  tiltx=10. * math.pi / 180.0),
                                 refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=10.0),
                                 refname=lc2.name)

stopsurf = Surface(lc0)
surf1 = Surface(lc1,
                shape=surfShape.Conic(lc1, curv=1. / 24.0),
                apert=CircularAperture(lc1, 5.0))
surf2 = Surface(lc2,
                shape=surfShape.Conic(lc2, curv=-1. / 24.0),
                apert=CircularAperture(lc2, 5.0))
image = Surface(lc3)

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

grin_strength = 0.5


def nfunc(x):
    return grin_strength * np.exp(
        -x[0]**2 - 4. * x[1]**2) + 1.0  #(2.5 - (x**2 + 100.0*y**4)/10.**2)

コード例 #6
0
lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="stop", decz=0.0),
                                 refname=s.rootcoordinatesystem.name)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1", decz=-1.048),
                                 refname=lc0.name)  # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2", decz=4.0),
                                 refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf3", decz=2.5),
                                 refname=lc2.name)
lc4 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=97.2),
                                 refname=lc3.name)

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")

rnd_data1 = np.random.random((3, 3))  #np.eye(3)
rnd_data2 = np.random.random((3, 3))  #np.zeros((3, 3))#
rnd_data3 = np.random.random((3, 3))  #np.eye(3)
rnd_data4 = np.random.random((3, 3))  #np.zeros((3, 3))#
コード例 #7
0
ファイル: demo_doublet.py プロジェクト: NelisW/pyrate
logging.basicConfig(level=logging.DEBUG)

wavelength = 0.5876e-3

# definition of optical system
s = OpticalSystem() 

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="stop", decz=0.0), refname=s.rootcoordinatesystem.name)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1", decz=-1.048), refname=lc0.name) # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2", decz=4.0), refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf3", decz=2.5), refname=lc2.name)
lc4 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=97.2), refname=lc3.name)


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, name="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"))
コード例 #8
0
ファイル: demo_asphere.py プロジェクト: NelisW/pyrate
wavelength = 0.5876e-3

# definition of optical system
s = OpticalSystem()

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="stop", decz=0.0),
                                 refname=s.rootcoordinatesystem.name)
lc1 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf1", decz=5.0),
                                 refname=lc0.name)  # objectDist
lc2 = s.addLocalCoordinateSystem(LocalCoordinates(name="surf2", decz=20.0),
                                 refname=lc1.name)
lc3 = s.addLocalCoordinateSystem(LocalCoordinates(name="image", decz=100.0),
                                 refname=lc2.name)

stopsurf = Surface(lc0)
frontsurf = Surface(lc1, shape=Conic(lc1), apert=CircularAperture(lc1, 12.7))
backsurf = Surface(lc2,
                   shape=Asphere(lc2,
                                 curv=-1. / 50.0,
                                 cc=-1.,
                                 coefficients=[0.0, 0.0, 0.0]),
                   apert=CircularAperture(lc2, 12.7))
image = Surface(lc3)

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

bk7 = ConstantIndexGlass(lc1, n=1.5168)

elem.addMaterial("BK7", bk7)

elem.addSurface("stop", stopsurf, (None, None))
コード例 #9
0

# definition of optical system
s = OpticalSystem(matbackground=crystal) 

lc0 = s.addLocalCoordinateSystem(LocalCoordinates(name="object", decz=0.0), refname=s.rootcoordinatesystem.name)
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)

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, 20.7))
image1 = Surface(lc4)
oapara = Surface(lc3, shape=surfShape.Conic(lc5, curv=0.01, cc=-1.), apert=CircularAperture(lc5ap, 30.0))
image2 = Surface(lc6, apert=CircularAperture(lc6, 20.0))


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

#elem.addMaterial("crystal", crystal)

elem.addSurface("object", objectsurf, (None, None))
elem.addSurface("m1", m1surf, (None, None))
elem.addSurface("m2", m2surf, (None, None))
elem.addSurface("m3", m3surf, (None, None))