Example #1
0
    def current_focus(self):
        """Method calculates the focus of the lenses array currently inserted
        in the transfocator

        Returns
        -------
        float
            Returns the current focus of the beryllium lens array already
            inserted in the transfocator.

        """
        #makeing a list of lenses already in the transfocator, looping through
        #and adding them to the list if they are
        already_in = []
        for lens in self.xrt_lenses:
            if lens.inserted:
                already_in.append(lens)
        for lens in self.tfs_lenses:
            if lens.inserted == True:
                already_in.append(lens)
        logger.debug(
            "There are %s lenses already inserted in the Transfocator" %
            (len(already_in)))
        #makr the list of already-inserted lenses a LensCOnnect of arbitrary length
        already_in = LensConnect(*already_in)
        #get the current focal length/image
        focus = already_in.image(0.0)
        logger.debug("The current focus of the inserted lenses is %s" % focus)
        return focus
Example #2
0
class TransfocatorCombo(object):
    """Class creates and keeps track of the lens array lists and calculates the
    image of the combined xrt/tfs beryllium lens array

    Attributes
    ----------
    xrt : list
        A list of the xrt lenses with all the attributes of the LensConnect
        class
    tfs : list
        A list of the tfs lenses with all the attributes of the LensConnect
        class
    """

    #define TransfocatorCombo attributes
    #Note: onely one xrt can be entered for this but multiple tfs lenses can be
    #entered
    def __init__(self, xrt, tfs):
        self.xrt = LensConnect(xrt)
        self.tfs = LensConnect(*tfs)

    def image(self, z_obj):
        """Method calculates the image of the combined tfs and xrt lens array
        
        Returns
        -------
        float
            Returns the image of the xrt/tfs lens array
        """
        #
        xrt_image = self.xrt.image(z_obj)
        total_image = self.tfs.image(xrt_image)
        logger.debug(
            "the xrt image of the array is %s and the image of the combined xrt/tfs array is %s"
            % (xrt_image, total_image))
        return total_image