示例#1
0
文件: aim.py 项目: mniehus/pyrate
    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))
示例#2
0
文件: aim.py 项目: 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))
示例#3
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")])
示例#4
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")])