Esempio n. 1
0
    def update(self, system, seq):
        """
        Update the matrices from object to stop and
        from stop to image for a specific system and a
        specific sequence.
        """

        obj_dx = self.pilotbundle_delta_size  # pilot bundle properties
        obj_dphi = self.pilotbundle_delta_angle  # pilot bundle properties

        first_element_seq_name = seq[0]
        (first_element_name, first_element_seq) = first_element_seq_name
        (objsurfname, _) = first_element_seq[0]

        self.objectsurface = system.elements[first_element_name].\
            surfaces[objsurfname]
        self.start_material = system.material_background
        # TODO: pilotray starts always in background (how about immersion?)
        # if mat is None: ....

        if self.pilotbundle_generation.lower() == "real":
            self.info("call real sampled pilotbundle")
            pilotbundles = build_pilotbundle(
                self.objectsurface,
                self.start_material, (obj_dx, obj_dx), (obj_dphi, obj_dphi),
                num_sampling_points=self.pilotbundle_sampling_points)
            # TODO: wavelength?
        elif self.pilotbundle_generation.lower() == "complex":
            self.info("call complex sampled pilotbundle")
            pilotbundles = build_pilotbundle_complex(
                self.objectsurface,
                self.start_material, (obj_dx, obj_dx), (obj_dphi, obj_dphi),
                num_sampling_points=self.pilotbundle_sampling_points)

        self.info("choose " + str(self.pilotbundle_solution) + " raybundle")
        self.pilotbundle = pilotbundles[self.pilotbundle_solution]
        # one of the last two

        (self.m_obj_stop,
         self.m_stop_img) =\
            system.extractXYUV(
                self.pilotbundle,
                seq,
                pilotbundle_generation=self.pilotbundle_generation)

        self.info("show linear matrices")
        self.info(
            "obj -> stop:\n" +
            np.array_str(self.m_obj_stop, precision=10, suppress_small=True))
        self.info(
            "stop -> img:\n" +
            np.array_str(self.m_stop_img, precision=10, suppress_small=True))
Esempio n. 2
0
File: aim.py Progetto: joha2/pyrate
    def update(self, s, seq):

        obj_dx = self.pilotbundle_delta_size  # pilot bundle properties
        obj_dphi = self.pilotbundle_delta_angle  # pilot bundle properties

        first_element_seq_name = seq[0]
        (first_element_name, first_element_seq) = first_element_seq_name
        (objsurfname, objsurfoptions) = first_element_seq[0]

        self.objectsurface = s.elements[first_element_name].surfaces[objsurfname]
        self.start_material = s.material_background
        # TODO: pilotray starts always in background (how about immersion?)
        # if mat is None: ....

        if self.pilotbundle_generation.lower() == "real":
            self.info("call real sampled pilotbundle")
            pilotbundles = build_pilotbundle(
                self.objectsurface,
                self.start_material,
                (obj_dx, obj_dx),
                (obj_dphi, obj_dphi),
                num_sampling_points=self.pilotbundle_sampling_points)
                # TODO: wavelength?
        elif self.pilotbundle_generation.lower() == "complex":
            self.info("call complex sampled pilotbundle")
            pilotbundles = build_pilotbundle_complex(
                self.objectsurface,
                self.start_material,
                (obj_dx, obj_dx),
                (obj_dphi, obj_dphi),
                num_sampling_points=self.pilotbundle_sampling_points)

        self.info("choose " + str(self.pilotbundle_solution) + " raybundle")
        self.pilotbundle = pilotbundles[self.pilotbundle_solution]
        # one of the last two

        (self.m_obj_stop, self.m_stop_img) = s.extractXYUV(self.pilotbundle,
                                                           seq,
                                                           pilotbundle_generation=self.pilotbundle_generation)

        self.info("show linear matrices")
        self.info("obj -> stop:\n" + np.array_str(self.m_obj_stop, precision=10, suppress_small=True))
        self.info("stop -> img:\n" + np.array_str(self.m_stop_img, precision=10, suppress_small=True))
Esempio n. 3
0
    def update(self, s, seq):

        obj_dx = 0.1  # pilot bundle properties
        obj_dphi = 1. * degree  # pilot bundle properties

        first_element_seq_name = seq[0]
        (first_element_name, first_element_seq) = first_element_seq_name
        (objsurfname, objsurfoptions) = first_element_seq[0]

        self.objectsurface = s.elements[first_element_name].surfaces[
            objsurfname]
        self.start_material = s.material_background
        # TODO: pilotray starts always in background (how about immersion?)
        # if mat is None: ....

        #build_pilotbundle(
        #    self.objectsurface,
        #    self.start_material,
        #    (obj_dx, obj_dx),
        #    (obj_dphi, obj_dphi),
        #    num_sampling_points=3) # TODO: wavelength?

        self.info("call complex sampled pilotbundle")
        pilotbundles = build_pilotbundle_complex(self.objectsurface,
                                                 self.start_material,
                                                 (obj_dx, obj_dx),
                                                 (obj_dphi, obj_dphi),
                                                 num_sampling_points=3)

        self.info("choose last raybundle (hard coded)")
        self.pilotbundle = pilotbundles[-1]
        # TODO: one solution selected hard coded

        (self.m_obj_stop,
         self.m_stop_img) = s.extractXYUV(self.pilotbundle, seq)

        self.info("show linear matrices")
        self.info(
            np.array_str(self.m_obj_stop, precision=5, suppress_small=True))
        self.info(
            np.array_str(self.m_stop_img, precision=5, suppress_small=True))
Esempio n. 4
0
    "anglex": 1. * degree
})
(x03, k03, E03) = osa.collimated_bundle(11, {
    "radius": epd,
    "raster": MeridionalFan(),
    "anglex": -1. * degree
})

mybundle1 = RayBundle(x01, k01, E01)
mybundle2 = RayBundle(x02, k02, E02)
mybundle3 = RayBundle(x03, k03, E03)

raypaths1 = s.seqtrace(mybundle1, seq)
raypaths2 = s.seqtrace(mybundle2, seq)
raypaths3 = s.seqtrace(mybundle3, seq)

obj_dx = 0.1
obj_dphi = 0.1 * degree

pilotbundles = build_pilotbundle_complex(objsurf,
                                         s.material_background,
                                         (obj_dx, obj_dx),
                                         (obj_dphi, obj_dphi),
                                         num_sampling_points=3)
(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], seq)

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

draw(s, [raypaths1, raypaths2, raypaths3])
Esempio n. 5
0
                                    wave=standard_wavelength)

initialbundle1 = RayBundle(x0=o, k0=k1, Efield0=E1, wave=standard_wavelength)
initialbundle2 = RayBundle(x0=o, k0=k2, Efield0=E2, wave=standard_wavelength)
initialbundle3 = RayBundle(x0=o, k0=k3, Efield0=E3, wave=standard_wavelength)
print("performing sequential raytrace")
r1 = s.seqtrace(initialbundle1, sysseq)
r2 = s.seqtrace(initialbundle2, sysseq)
r3 = s.seqtrace(initialbundle3, sysseq)

obj_dx = 0.1
obj_dphi = 5 * degree

print("calculating pilotbundles")
pilotbundles = build_pilotbundle_complex(objsurf,
                                         air, (obj_dx, obj_dx),
                                         (obj_dphi, obj_dphi),
                                         num_sampling_points=3)

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

# print("para seqtrace")
# (pilotray, r_pilot) = s.para_seqtrace(pilotbundles[-1], initialbundle1,
#                                       sysseq)

print("calculating XYUV")
(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], sysseq)

print(np.array_str(m_obj_stop, precision=5, suppress_small=True))
print(np.array_str(m_stop_img, precision=5, suppress_small=True))
Esempio n. 6
0
initialbundle1 = RayBundle(x0=o, k0=k1, Efield0=E1, wave=standard_wavelength)
initialbundle2 = RayBundle(x0=o, k0=k2, Efield0=E2, wave=standard_wavelength)
initialbundle3 = RayBundle(x0=o, k0=k3, Efield0=E3, wave=standard_wavelength)
print("performing sequential raytrace")
r1 = s.seqtrace(initialbundle1, sysseq)
r2 = s.seqtrace(initialbundle2, sysseq)
r3 = s.seqtrace(initialbundle3, sysseq)

obj_dx = 0.1
obj_dphi = 5*degree

print("calculating pilotbundles")
pilotbundles = build_pilotbundle_complex(objsurf,
                                         air,
                                         (obj_dx, obj_dx),
                                         (obj_dphi, obj_dphi),
                                         num_sampling_points=3)

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

# print("para seqtrace")
# (pilotray, r_pilot) = s.para_seqtrace(pilotbundles[-1], initialbundle1,
#                                       sysseq)

print("calculating XYUV")
(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], sysseq)

print(np.array_str(m_obj_stop, precision=5, suppress_small=True))
Esempio n. 7
0
(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(),
                                             "anglex": -1.*degree})

mybundle1 = RayBundle(x01, k01, E01)
mybundle2 = RayBundle(x02, k02, E02)
mybundle3 = RayBundle(x03, k03, E03)

raypaths1 = s.seqtrace(mybundle1, seq)
raypaths2 = s.seqtrace(mybundle2, seq)
raypaths3 = s.seqtrace(mybundle3, seq)

obj_dx = 0.1
obj_dphi = 0.1*degree

pilotbundles = build_pilotbundle_complex(objsurf, s.material_background,
                                         (obj_dx, obj_dx),
                                         (obj_dphi, obj_dphi),
                                         num_sampling_points=3)
(m_obj_stop, m_stop_img) = s.extractXYUV(pilotbundles[-1], seq)

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

draw(s, [raypaths1, raypaths2, raypaths3])