Esempio n. 1
0
    def srw_info(self):
        """
        Print self._srwl_wf string representation. Used for debugging.

        :return: string
        """
        return srw_obj2str(self._srwl_wf)
Esempio n. 2
0
    def __str__(self):
        """
        String representaion of beamline (used with print function).

        :return: string
        """
        res = ''
        for po in self.propagation_options:
            tolal_elements = max(len(po['optical_elements']),
                                 len(po['propagation_parameters']))
            for ti in range(tolal_elements):
                try:
                    elem = po['optical_elements'][ti]
                except IndexError:
                    elem = wpg.optical_elements.Empty()

                try:
                    pp = po['propagation_parameters'][ti]
                except IndexError:
                    pp = None

                s1 = elem.__doc__
                s2 = 'Prop. parameters = {0}'.format(pp)
                if isinstance(elem, srwlib.SRWLOpt):
                    s3 = '\t' + '\n\t'.join(srw_obj2str(elem).split('\n'))
                else:
                    s3 = '\t' + str(elem)

                res += '{0}\n{1}\n{2}\n'.format(s1, s2, s3)
        return res
Esempio n. 3
0
    def __str__(self):
        """
        String representaion of beamline (used with print function).

        :return: string
        """
        res = ''
        for po in self.propagation_options:
            tolal_elements = max(
                len(po['optical_elements']), len(po['propagation_parameters']))
            for ti in range(tolal_elements):
                try:
                    elem = po['optical_elements'][ti]
                except IndexError:
                    elem = wpg.optical_elements.Empty()

                try:
                    pp = po['propagation_parameters'][ti]
                except IndexError:
                    pp = None

                s1 = elem.__doc__
                s2 = 'Prop. parameters = {0}'.format(pp)
                if isinstance(elem, srwlib.SRWLOpt):
                    s3 = '\t' + '\n\t'.join(srw_obj2str(elem).split('\n'))
                else:
                    s3 = '\t' + str(elem)

                res += '{0}\n{1}\n{2}\n'.format(s1, s2, s3)
        return res
Esempio n. 4
0
    def srw_info(self):
        """
        Print self._srwl_wf string representation. Used for debugging.

        :return: string
        """
        return srw_obj2str(self._srwl_wf)
Esempio n. 5
0
    def __str__(self):
        """
        String representaion of beamline (used with print function).

        :return: string
        """
        res = ""
        for po in self.propagation_options:
            tolal_elements = max(len(po["optical_elements"]),
                                 len(po["propagation_parameters"]))
            for ti in range(tolal_elements):
                try:
                    elem = po["optical_elements"][ti]
                except IndexError:
                    elem = optical_elements.Empty()

                try:
                    pp = po["propagation_parameters"][ti]
                except IndexError:
                    pp = None

                s1 = elem.__doc__
                s2 = "Prop. parameters = {0}".format(pp)
                if isinstance(elem, srwlib.SRWLOpt):
                    s3 = "\t" + "\n\t".join(srw_obj2str(elem).split("\n"))
                else:
                    s3 = "\t" + str(elem)

                res += "{0}\n{1}\n{2}\n".format(s1, s2, s3)
        return res
Esempio n. 6
0
    def __str__(self):
        """
        String representation to enable print function.

        :return: String representation
        """
        mesh_str = 'Mesh:\n\t\t' + \
            '\n\t\t'.join(srw_obj2str(self.params.Mesh).split('\n')) + '\n\t'
        radiation_str = mesh_str + \
            '\n\t'.join(srw_obj2str(self.params).split('\n'))

        radiation_str = 'Radiation:\n\t' + radiation_str + '\n'

        data_ehor = '\tarrEhor = array of shape ' + \
            str(self.data.arrEhor.shape) + \
            ' // the 2-nd dimension is (re,im)\n'
        data_ever = '\tarrEver = array of shape ' + \
            str(self.data.arrEver.shape) + \
            ' // the 2-nd dimension is (re,im)\n'

        data_str = data_ehor + data_ever

        return radiation_str + data_str
Esempio n. 7
0
    def __str__(self):
        """
        String representation to enable print function.

        :return: String representation
        """
        mesh_str = 'Mesh:\n\t\t' + \
            '\n\t\t'.join(srw_obj2str(self.params.Mesh).split('\n')) + '\n\t'
        radiation_str = mesh_str + \
            '\n\t'.join(srw_obj2str(self.params).split('\n'))

        radiation_str = 'Radiation:\n\t' + radiation_str + '\n'

        data_ehor = '\tarrEhor = array of shape ' + \
            str(self.data.arrEhor.shape) + \
            ' // the 2-nd dimension is (re,im)\n'
        data_ever = '\tarrEver = array of shape ' + \
            str(self.data.arrEver.shape) + \
            ' // the 2-nd dimension is (re,im)\n'

        data_str = data_ehor + data_ever

        return radiation_str + data_str
Esempio n. 8
0
    def __str__(self):
        """
        String representation to enable print function.

        :return: String representation
        """
        mesh_str = ("Mesh:\n\t\t" +
                    "\n\t\t".join(srw_obj2str(self.params.Mesh).split("\n")) +
                    "\n\t")
        radiation_str = mesh_str + "\n\t".join(
            srw_obj2str(self.params).split("\n"))

        radiation_str = "Radiation:\n\t" + radiation_str + "\n"

        data_ehor = ("\tarrEhor = array of shape " +
                     str(self.data.arrEhor.shape) +
                     " // the 2-nd dimension is (re,im)\n")
        data_ever = ("\tarrEver = array of shape " +
                     str(self.data.arrEver.shape) +
                     " // the 2-nd dimension is (re,im)\n")

        data_str = data_ehor + data_ever

        return radiation_str + data_str