コード例 #1
0
}), ("m2", {
    "is_mirror": True
})])]

obj_dx = 0.1
obj_dphi = 1. * degree

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

raysdict = {
    "opticalsystem": s,
    "startz": -5.,
    "radius": 10.,
    "raster": raster.MeridionalFan()
}
osa.aim(5, raysdict, bundletype="collimated", wave=wavelength)

r2 = osa.trace()[0]

kw = 5. * degree

pilotbundles = build_pilotbundle(
    objectsurf,
    crystal, (obj_dx, obj_dx), (obj_dphi, obj_dphi),
    kunitvector=np.array([0, math.sin(kw), math.cos(kw)]),
    num_sampling_points=3)
(pilotray2, r3) = s.para_seqtrace(pilotbundles[-1], osa.initial_bundles[0],
                                  sysseq)

draw(s, [(r2, "blue"), (r3, "orange"), (pilotray2, "red")])
コード例 #2
0
#pilotbundle = RayBundle(
#                x0 = np.array([[0], [0], [0]]),
#                k0 = np.array([[0], [kwave*math.sin(phi)], [kwave*math.cos(phi)]]),
#                Efield0 = np.array([[1], [0], [0]]), wave=wavelength
#                )
#pilotray = s.seqtrace(pilotbundle, sysseq_pilot)

pilotbundles = pyrateoptics.raytracer.helpers.build_pilotbundle(
    objectsurf,
    air, (obj_dx, obj_dx), (obj_dphi, obj_dphi),
    num_sampling_points=3)

rays_pilot = [s.seqtrace(p, sysseq) for p in pilotbundles]

(pilotray2, r3) = s.para_seqtrace(pilotbundles[-1],
                                  initialbundle,
                                  sysseq,
                                  use6x6=True)

(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], sysseq, use6x6=True)

logging.info(np.array_str(m_obj_stop, precision=5, suppress_small=True))
logging.info(np.array_str(m_stop_img, precision=5, suppress_small=True))

logging.info(str(s.sequence_to_hitlist(sysseq)))

### TODO:
### first tries to implement aiming, but the code is somewhat hard to use
### we need to get rid of the pilot ray in every call
### we need to convert between XK representation local 3D coordinates and
### global raybundle coordinates in a more easy way
###
コード例 #3
0
                 ])
                ]


obj_dx = 0.1
obj_dphi = 1.*degree

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

raysdict = {"opticalsystem": s, "startz": -5., "radius": 10.,
            "raster": raster.MeridionalFan()}
osa.aim(5, raysdict, bundletype="collimated", wave=wavelength)

r2 = osa.trace()[0]


kw = 5.*degree

pilotbundles = build_pilotbundle(objectsurf,
                                 crystal,
                                 (obj_dx, obj_dx),
                                 (obj_dphi, obj_dphi),
                                 kunitvector=np.array([0,
                                                       math.sin(kw),
                                                       math.cos(kw)]),
                                 num_sampling_points=3)
(pilotray2, r3) = s.para_seqtrace(pilotbundles[-1],
                                  osa.initial_bundles[0], sysseq)

draw(s, [(r2, "blue"), (r3, "orange"), (pilotray2, "red")])
コード例 #4
0
ファイル: demo_mirrors.py プロジェクト: joha2/pyrate
a = Aimy(s, sysseq, name="Aimy", stopsize=2., num_pupil_points=5)
a.pupil_raster = raster.MeridionalFan()


def correctKRayBundle(bundle):
    """
    Should get correct k from raybundle.
    """
    pass


initbundle1 = a.aim(np.array([0, 0]))
initbundle2 = a.aim(np.array([0, 0.5*degree]))
initbundle3 = a.aim(np.array([0, -0.5*degree]))

(pp1, r1p) = s.para_seqtrace(a.pilotbundle, initbundle1, sysseq)
(pp2, r2p) = s.para_seqtrace(a.pilotbundle, initbundle2, sysseq)
(pp3, r3p) = s.para_seqtrace(a.pilotbundle, initbundle3, sysseq)

r1r = s.seqtrace(initbundle1, sysseq)
r2r = s.seqtrace(initbundle2, sysseq)
r3r = s.seqtrace(initbundle3, sysseq)


draw(s, [(r1p, "blue"), (r2p, "green"), (r3p, "orange")])
# draw(s, [(r1r, "blue"), (r2r, "green"), (r3r, "orange")])


# TODO:
# first tries to implement aiming, but the code is somewhat hard to use
# we need to get rid of the pilot ray in every call
コード例 #5
0
ファイル: demo_hud.py プロジェクト: marcospindler10/pyrate
r1 = s.seqtrace(initialbundle1, sysseq)
r2 = s.seqtrace(initialbundle2, sysseq)
r3 = s.seqtrace(initialbundle3, sysseq)

obj_dx = 0.1
obj_dphi = 5 * degree
pilotbundles = pyrateoptics.raytracer.helpers.build_pilotbundle(
    objsurf,
    air, (obj_dx, obj_dx), (obj_dphi, obj_dphi),
    num_sampling_points=3)

rays_pilot = [s.seqtrace(p, sysseq) for p in pilotbundles[2:]]
# only last two bundles hit the next surface

(pilotray, r_pilot) = s.para_seqtrace(pilotbundles[-1],
                                      initialbundle1,
                                      sysseq,
                                      use6x6=True)

(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], sysseq, use6x6=True)

print(np.array_str(m_obj_stop, precision=5, suppress_small=True))
print(np.array_str(m_stop_img, precision=5, suppress_small=True))

#print(s.sequence_to_hitlist(sysseq))

fig = plt.figure(1)
ax = fig.add_subplot(111)
ax.axis('equal')
if StrictVersion(matplotlib.__version__) < StrictVersion('2.0.0'):
    ax.set_axis_bgcolor('white')
else:
コード例 #6
0
a = Aimy(s, sysseq, name="Aimy", stopsize=2., num_pupil_points=5)
a.pupil_raster = raster.MeridionalFan()


def correctKRayBundle(bundle):
    """
    Should get correct k from raybundle.
    """
    pass


initbundle1 = a.aim(np.array([0, 0]))
initbundle2 = a.aim(np.array([0, 0.5 * degree]))
initbundle3 = a.aim(np.array([0, -0.5 * degree]))

(pp1, r1p) = s.para_seqtrace(a.pilotbundle, initbundle1, sysseq)
(pp2, r2p) = s.para_seqtrace(a.pilotbundle, initbundle2, sysseq)
(pp3, r3p) = s.para_seqtrace(a.pilotbundle, initbundle3, sysseq)

r1r = s.seqtrace(initbundle1, sysseq)
r2r = s.seqtrace(initbundle2, sysseq)
r3r = s.seqtrace(initbundle3, sysseq)

draw(s, [(r1p, "blue"), (r2p, "green"), (r3p, "orange")])
# draw(s, [(r1r, "blue"), (r2r, "green"), (r3r, "orange")])

# TODO:
# first tries to implement aiming, but the code is somewhat hard to use
# we need to get rid of the pilot ray in every call
# we need to convert between XK representation local 3D coordinates and
# global raybundle coordinates in a more easy way