예제 #1
0
파일: spect.py 프로젝트: zwq1230/odl
    def __repr__(self):
        """Return ``repr(self)``."""
        posargs = [self.motion_partition, self.det_partition]
        optargs = [('det_radius', self.det_radius, -1)]

        if not np.allclose(self.axis, self._default_config['axis']):
            optargs.append(['axis', array_str(self.axis), ''])

        if self._orig_to_det_init_arg is not None:
            optargs.append([
                'orig_to_det_init',
                array_str(self._orig_to_det_init_arg), ''
            ])

        if self._det_axes_init_arg is not None:
            optargs.append([
                'det_axes_init',
                tuple(array_str(a) for a in self._det_axes_init_arg), None
            ])

        if not np.array_equal(self.translation, (0, 0, 0)):
            optargs.append(['translation', array_str(self.translation), ''])

        sig_str = signature_string(posargs, optargs, sep=',\n')
        return '{}(\n{}\n)'.format(self.__class__.__name__, indent(sig_str))
 def __repr__(self):
     """Return ``repr(self)``."""
     if self.ndim == 1:
         return '{}({:.4}, {:.4})'.format(self.__class__.__name__,
                                          self.min_pt[0], self.max_pt[0])
     else:
         return '{}({}, {})'.format(self.__class__.__name__,
                                    array_str(self.min_pt),
                                    array_str(self.max_pt))
 def __repr__(self):
     """Return ``repr(self)``."""
     posargs = [array_str(self.array)]
     optargs = [('exponent', self.exponent, 2.0)]
     inner_str = signature_string(posargs, optargs, sep=',\n',
                                  mod=['!s', ':.4'])
     return '{}(\n{}\n)'.format(self.__class__.__name__, indent(inner_str))
예제 #4
0
 def repr_part(self):
     """String usable in a space's ``__repr__`` method."""
     optargs = [('weighting', array_str(self.array, nprint=10), ''),
                ('exponent', self.exponent, 2.0)]
     return signature_string([],
                             optargs,
                             sep=',\n',
                             mod=[[], ['!s', ':.4']])
예제 #5
0
 def __repr__(self):
     """Return ``repr(self)``."""
     maxsize_full_print = 2 * np.get_printoptions()['edgeitems']
     self_str = array_str(self, nprint=maxsize_full_print)
     if self.ndim == 1 and self.size <= maxsize_full_print:
         return '{!r}.element({})'.format(self.space, self_str)
     else:
         return '{!r}.element(\n{}\n)'.format(self.space, indent(self_str))
예제 #6
0
    def repr_part(self):
        """Return a string usable in a space's ``__repr__`` method."""
        # Lazy import to improve `import odl` time
        import scipy.sparse

        if scipy.sparse.isspmatrix(self.matrix):
            optargs = [('matrix', str(self.matrix), '')]
        else:
            optargs = [('matrix', array_str(self.matrix, nprint=10), '')]

        optargs.append(('exponent', self.exponent, 2.0))
        return signature_string([], optargs, mod=[[], ['!s', ':.4']])
    def __repr__(self):
        """Return ``repr(self)``."""
        if self.matrix_issparse:
            posargs = ['<{} sparse matrix, format {}, {} nonzero entries>'
                       ''.format(self.matrix.shape, self.matrix.format,
                                 self.matrix.nnz)]
        else:
            posargs = [array_str(self.matrix, nprint=10)]

        optargs = [('exponent', self.exponent, 2.0)]
        inner_str = signature_string(posargs, optargs, sep=',\n',
                                     mod=['!s', ''])
        return '{}(\n{}\n)'.format(self.__class__.__name__, indent(inner_str))
예제 #8
0
 def __str__(self):
     """Return ``str(self)``."""
     return array_str(self)
예제 #9
0
 def __repr__(self):
     """Return ``repr(self)``."""
     posargs = [self.partition]
     optargs = [('center', array_str(self.center), None)]
     inner_str = signature_string(posargs, optargs, sep=',\n')
     return '{}(\n{}\n)'.format(self.__class__.__name__, indent(inner_str))