コード例 #1
0
from pyrateoptics.raytracer.analysis.optical_system_analysis import\
    OpticalSystemAnalysis

logging.basicConfig(level=logging.INFO)

wavelength = standard_wavelength

# definition of optical system

db_path = "refractiveindex.info-database/database"

(s,
 seq) = build_rotationally_symmetric_optical_system(
     [(-5.922, 0, 2.0, 1.7, "surf1", {}), (-3.160, 0, 3.0, None, "surf2", {}),
      (15.884, 0, 5.0, 1.7, "surf3", {}), (-12.756, 0, 3.0, None, "surf4", {}),
      (0, 0, 3.0, None, "stop", {
          "is_stop": True
      }), (3.125, 0, 2.0, 1.5, "surf5", {}),
      (1.479, 0, 3.0, None, "surf6", {}), (0, 0, 19.0, None, "surf7", {})],
     material_db_path=db_path)


def mytiming():
    if sys.version_info.major >= 3:
        return time.perf_counter()
    else:
        return time.clock()


nrays = 100000
nrays_draw = 21
コード例 #2
0
ファイル: demo_doublegauss.py プロジェクト: theinze/pyrate
# gcat = material_glasscat.GlassCatalog(db_path)
# print gcat.find_pages_with_long_name("BK7")


# Step 1: set up system of glass plates
########################################

rba = RayBundleAnalysis(None)

(s, seq) = build_rotationally_symmetric_optical_system(
        [(0,     0,     10.,    "N-SK16",         "lens1front", {}),
         (0,     0,     5,     None,             "lens1rear", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem2front", {}),
         (0,     0,     5,     "F5",             "elem2cement", {}),
         (0,     0,     5,     None,             "elem2rear", {}),
         (0,     0,     5,     None,             "stop", {"stop": True}),
         (0,     0,     5,     "F5",             "elem3front", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem3cement", {}),
         (0,     0,     5,     None,             "elem3rear", {}),
         (0,     0,     5,     "N-SK16",         "lens4front", {}),
         (0,     0,     5,     None,             "lens4rear", {}),
         (0,     0,     150.,     None,          "image", {})
         ], material_db_path=db_path, name="os")


def bundle_step1(nrays=100, rpup=7.5):
    """
    Creates an on-axis collimated RayBundle for step 1.
    """

    (px, py) = RectGrid().getGrid(nrays)
    o = np.vstack((rpup*px, rpup*py, np.zeros_like(px)))
コード例 #3
0
ファイル: demo_tilted_image.py プロジェクト: theinze/pyrate
from pyrateoptics import build_rotationally_symmetric_optical_system, draw
from pyrateoptics.raytracer.globalconstants import degree
from pyrateoptics.raytracer.analysis.optical_system_analysis import\
    OpticalSystemAnalysis
from pyrateoptics.raytracer.ray import RayBundle
from pyrateoptics.sampling2d.raster import MeridionalFan
from pyrateoptics.raytracer.helpers import build_pilotbundle_complex

alpha = 10. * degree

epd = 5.

(s, seq) = build_rotationally_symmetric_optical_system(
    [(0, 0, 0., None, "object", {}),
     (100., 0, 5, 1.5, "lens1front", {
         "is_stop": True
     }), (0., 0, 5, None, "lens1rear", {}),
     (0, 0, 196.228, None, "image", {})],
    name="os")

imsurf = s.elements["stdelem"].surfaces["image"]
imsurf.rootcoordinatesystem.tiltx.set_value(alpha)
imsurf.rootcoordinatesystem.update()
objsurf = s.elements["stdelem"].surfaces["object"]
osa = OpticalSystemAnalysis(s, seq, name="Analysis")
(x01, k01, E01) = osa.collimated_bundle(11, {
    "radius": epd,
    "raster": MeridionalFan()
})
(x02, k02, E02) = osa.collimated_bundle(11, {
    "radius": epd,
コード例 #4
0
ファイル: demo_benchmark.py プロジェクト: joha2/pyrate
from pyrateoptics.analysis.optical_system_analysis import OpticalSystemAnalysis


logging.basicConfig(level=logging.INFO)

wavelength = standard_wavelength

# definition of optical system

db_path = "refractiveindex.info-database/database"

(s, seq) = build_rotationally_symmetric_optical_system(
        [(-5.922, 0, 2.0, 1.7, "surf1", {}),
         (-3.160, 0, 3.0, None, "surf2", {}),
         (15.884, 0, 5.0, 1.7, "surf3", {}),
         (-12.756, 0, 3.0, None, "surf4", {}),
         (0, 0, 3.0, None, "stop", {"is_stop": True}),
         (3.125, 0, 2.0, 1.5, "surf5", {}),
         (1.479, 0, 3.0, None, "surf6", {}),
         (0, 0, 19.0, None, "surf7", {})
         ], material_db_path=db_path)

nrays = 100000
nrays_draw = 21

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

(x0, k0, E0) = osa.divergent_bundle(nrays,
                                    {"radius": 10.*degree,
                                     "raster": raster.RectGrid()})
t0 = time.clock()
initialraybundle = RayBundle(x0=x0, k0=k0, Efield0=E0)
コード例 #5
0
from pyrateoptics.raytracer.analysis.optical_system_analysis import\
    OpticalSystemAnalysis

from pyrateoptics.raytracer.config import ConfigFile

logging.basicConfig(level=logging.INFO)

wavelength = standard_wavelength

# definition of optical system

(s, seq) = build_rotationally_symmetric_optical_system(
        [(-5.922, 0, 2.0, 1.7, "surf1", {}),
         (-3.160, 0, 3.0, None, "surf2", {}),
         (15.884, 0, 5.0, 1.7, "surf3", {}),
         (-12.756, 0, 3.0, None, "surf4", {}),
         (0, 0, 3.0, None, "stop", {"is_stop": True}),
         (3.125, 0, 2.0, 1.5, "surf5", {}),
         (1.479, 0, 3.0, None, "surf6", {}),
         (0, 0, 19.0, None, "surf7", {})
         ], material_db_path=ConfigFile().get_refractive_index_database_path())


def mytiming():
    if sys.version_info.major >= 3:
        return time.perf_counter()
    else:
        return time.clock()


nrays = 100000
nrays_draw = 21
コード例 #6
0
ファイル: demo_tilted_image.py プロジェクト: joha2/pyrate
import numpy as np

from pyrateoptics import build_rotationally_symmetric_optical_system, draw
from pyrateoptics.raytracer.globalconstants import degree
from pyrateoptics.analysis.optical_system_analysis import OpticalSystemAnalysis
from pyrateoptics.raytracer.ray import RayBundle
from pyrateoptics.sampling2d.raster import MeridionalFan
from pyrateoptics.raytracer.helpers import build_pilotbundle_complex

alpha = 10.*degree

epd = 5.

(s, seq) = build_rotationally_symmetric_optical_system(
        [(0, 0, 0., None, "object", {}),
         (100., 0, 5, 1.5, "lens1front", {"is_stop": True}),
         (0., 0, 5, None, "lens1rear", {}),
         (0, 0, 196.228, None, "image", {})], name="os")

imsurf = s.elements["stdelem"].surfaces["image"]
imsurf.rootcoordinatesystem.tiltx.setvalue(alpha)
imsurf.rootcoordinatesystem.update()
objsurf = s.elements["stdelem"].surfaces["object"]
osa = OpticalSystemAnalysis(s, seq, name="Analysis")
(x01, k01, E01) = osa.collimated_bundle(11, {"radius": epd,
                                             "raster": MeridionalFan()})
(x02, k02, E02) = osa.collimated_bundle(11, {"radius": epd,
                                             "raster": MeridionalFan(),
                                             "anglex": 1.*degree})
(x03, k03, E03) = osa.collimated_bundle(11, {"radius": epd,
                                             "raster": MeridionalFan(),
コード例 #7
0
ファイル: demo_doublegauss.py プロジェクト: joha2/pyrate
# gcat = material_glasscat.refractiveindex_dot_info_glasscatalog(db_path)
# print gcat.findPagesWithLongNameContaining("BK7")


# Step 1: set up system of glass plates
########################################

rba = RayBundleAnalysis(None)

(s, seq) = build_rotationally_symmetric_optical_system(
        [(0,     0,     10.,    "N-SK16",         "lens1front", {}),
         (0,     0,     5,     None,             "lens1rear", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem2front", {}),
         (0,     0,     5,     "F5",             "elem2cement", {}),
         (0,     0,     5,     None,             "elem2rear", {}),
         (0,     0,     5,     None,             "stop", {"stop": True}),
         (0,     0,     5,     "F5",             "elem3front", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem3cement", {}),
         (0,     0,     5,     None,             "elem3rear", {}),
         (0,     0,     5,     "N-SK16",         "lens4front", {}),
         (0,     0,     5,     None,             "lens4rear", {}),
         (0,     0,     150.,     None,          "image", {})
         ], material_db_path=db_path, name="os")


def bundle_step1(nrays=100, rpup=7.5):
    """
    Creates an on-axis collimated RayBundle for step 1.
    """

    (px, py) = RectGrid().getGrid(nrays)
    o = np.vstack((rpup*px, rpup*py, np.zeros_like(px)))