def __repr__(self): """Return ``repr(self)``.""" bdry_fracs = np.vstack(self.boundary_cell_fractions) default_bdry_fracs = np.all(np.isclose(bdry_fracs, 0.5) | np.isclose(bdry_fracs, 1.0)) # Get default shifts of min_pt and max_pt from corresponding # grid points csizes_l = np.fromiter((s[0] for s in self.cell_sizes_vecs), dtype=float) csizes_r = np.fromiter((s[-1] for s in self.cell_sizes_vecs), dtype=float) shift_l = ((bdry_fracs[:, 0].astype(float).squeeze() - 0.5) * csizes_l) shift_r = ((bdry_fracs[:, 1].astype(float).squeeze() - 0.5) * csizes_r) if self.is_uniform and default_bdry_fracs: constructor = 'uniform_partition' if self.ndim == 1: posargs = [self.min_pt[0], self.max_pt[0], self.shape[0]] else: posargs = [list(self.min_pt), list(self.max_pt), self.shape] optargs = [('nodes_on_bdry', self.nodes_on_bdry, False)] sig_str = signature_string(posargs, optargs) return '{}({})'.format(constructor, sig_str) else: constructor = 'nonuniform_partition' posargs = [list(v) for v in self.coord_vectors] optargs = [] # Defaults with and without nodes_on_bdry option nodes_def_min_pt = self.grid.min_pt - shift_l nodes_def_max_pt = self.grid.max_pt + shift_r def_min_pt = self.grid.min_pt - 0.5 * csizes_l def_max_pt = self.grid.max_pt + 0.5 * csizes_r # Since min/max_pt and nodes_on_bdry are mutex, we need a # couple of cases here if (np.allclose(self.min_pt, nodes_def_min_pt) and np.allclose(self.max_pt, nodes_def_max_pt)): # Append nodes_on_bdry to list of optional args optargs.append(('nodes_on_bdry', self.nodes_on_bdry, False)) else: # Append min/max_pt to list of optional args if not # default (need check here because array comparison is # ambiguous) if not np.allclose(self.min_pt, def_min_pt): p = self.min_pt[0] if self.ndim == 1 else list(self.min_pt) optargs.append((('min_pt', p, None))) if not np.allclose(self.max_pt, def_max_pt): p = self.max_pt[0] if self.ndim == 1 else list(self.max_pt) optargs.append((('max_pt', p, None))) sig_str = signature_string(posargs, optargs, sep=[',\n', ', ', ',\n']) return '{}(\n{}\n)'.format(constructor, indent_rows(sig_str))
def __repr__(self): """Return ``repr(self)``.""" if self.is_uniform: constructor = 'uniform_grid' posargs = [list(self.min_pt), list(self.max_pt), self.shape] inner_str = signature_string(posargs, []) return '{}({})'.format(constructor, inner_str) else: constructor = self.__class__.__name__ posargs = [array1d_repr(v) for v in self.coord_vectors] inner_str = signature_string(posargs, [], sep=[',\n', ', ', ', '], mod=['!s', '']) return '{}(\n{}\n)'.format(constructor, indent_rows(inner_str))
def __repr__(self): """Return ``repr(self)``. Examples -------- >>> CallbackPrintIteration(fmt='Current iter is {}.', display_step=2) CallbackPrintIteration(fmt='Current iter is {}.', display_step=2) """ optargs = [('fmt', self.fmt, self._default_fmt), ('display_step', self.display_step, 1)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.dist] optargs = [] inner_str = signature_string(posargs, optargs, mod=['!r', '']) return '{}({})'.format(self.__class__.__name__, inner_str)
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))
def repr_part(self): """String usable in a space's ``__repr__`` method.""" optargs = [('weighting', self.const, 1.0), ('exponent', self.exponent, 2.0), ('dist_using_inner', self.dist_using_inner, False)] return signature_string([], optargs, mod=[[], [':.4', '', '']])
def repr_part(self): """Return a string usable in a space's ``__repr__`` method.""" optargs = [('dist', self.dist, '')] return signature_string([], optargs, mod=['', '!r'])
def __repr__(self): """Return ``repr(self)``.""" optargs = [('fmt', self.fmt, 'Time elapsed = {:<5.03f} s'), ('step', self.step, 1)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" optargs = [('func', self.func, None), ('fmt', self.fmt, '{!r}')] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def repr_part(self): """String usable in a space's ``__repr__`` method.""" optargs = [('weighting', self.const, 1.0), ('exponent', self.exponent, 2.0)] return signature_string([], optargs, mod=':.4')
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.left, self.right] inner_str = signature_string(posargs, [], sep=',\n') return '{}(\n{}\n)'.format(self.__class__.__name__, indent_rows(inner_str))
def __repr__(self): """Return ``repr(self)``.""" optargs = [('seconds', self.seconds, 1.0)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
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']])
def __repr__(self): """Return ``repr(self)``.""" optargs = [('func', self.func, None), ('fmt', self.fmt, '{!r}'), ('step', self.step, 1)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.function] optargs = [('step', self.step, 1)] inner_str = signature_string(posargs, optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def repr_part(self): """String usable in a space's ``__repr__`` method.""" optargs = [('inner', self.inner, ''), ('dist_using_inner', self.dist_using_inner, False)] return signature_string([], optargs, mod=[[], ['!r', '']])
def __repr__(self): """Return ``repr(self)``.""" optargs = [('results', self.results, []), ('function', self.function, None), ('step', self.step, 1)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" if self.ndim == 0: return 'uniform_partition([], [], ())' bdry_fracs = np.vstack(self.boundary_cell_fractions) default_bdry_fracs = np.all( np.isclose(bdry_fracs, 0.5) | np.isclose(bdry_fracs, 1.0)) # Get default shifts of min_pt and max_pt from corresponding # grid points csizes_l = np.fromiter((s[0] for s in self.cell_sizes_vecs), dtype=float) csizes_r = np.fromiter((s[-1] for s in self.cell_sizes_vecs), dtype=float) shift_l = ((bdry_fracs[:, 0].astype(float).squeeze() - 0.5) * csizes_l) shift_r = ((bdry_fracs[:, 1].astype(float).squeeze() - 0.5) * csizes_r) if self.is_uniform and default_bdry_fracs: constructor = 'uniform_partition' if self.ndim == 1: posargs = [self.min_pt[0], self.max_pt[0], self.shape[0]] else: posargs = [list(self.min_pt), list(self.max_pt), self.shape] optargs = [('nodes_on_bdry', self.nodes_on_bdry, False)] sig_str = signature_string(posargs, optargs) return '{}({})'.format(constructor, sig_str) else: constructor = 'nonuniform_partition' posargs = [list(v) for v in self.coord_vectors] optargs = [] # Defaults with and without nodes_on_bdry option nodes_def_min_pt = self.grid.min_pt - shift_l nodes_def_max_pt = self.grid.max_pt + shift_r def_min_pt = self.grid.min_pt - 0.5 * csizes_l def_max_pt = self.grid.max_pt + 0.5 * csizes_r # Since min/max_pt and nodes_on_bdry are mutex, we need a # couple of cases here if (np.allclose(self.min_pt, nodes_def_min_pt) and np.allclose(self.max_pt, nodes_def_max_pt)): # Append nodes_on_bdry to list of optional args optargs.append(('nodes_on_bdry', self.nodes_on_bdry, False)) else: # Append min/max_pt to list of optional args if not # default (need check here because array comparison is # ambiguous) if not np.allclose(self.min_pt, def_min_pt): p = self.min_pt[0] if self.ndim == 1 else list(self.min_pt) optargs.append((('min_pt', p, None))) if not np.allclose(self.max_pt, def_max_pt): p = self.max_pt[0] if self.ndim == 1 else list(self.max_pt) optargs.append((('max_pt', p, None))) sig_str = signature_string(posargs, optargs, sep=[',\n', ', ', ',\n']) return '{}(\n{}\n)'.format(constructor, indent_rows(sig_str))
def __repr__(self): """Return ``repr(self)``.""" optargs = [('results', self.results, []), ('store_after_iters', self.store_after_iters, [])] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" optargs = [('results', self.results, []), ('function', self.function, None)] inner_str = signature_string([], optargs) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.const] optargs = [('exponent', self.exponent, 2.0)] return '{}({})'.format(self.__class__.__name__, signature_string(posargs, optargs))
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.displacement] optargs = [('templ_space', self.domain, self.displacement.space[0])] inner_str = signature_string(posargs, optargs, mod='!r', sep=',\n') return '{}(\n{}\n)'.format(self.__class__.__name__, indent(inner_str))
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.shape, dtype_str(self.dtype)] return "{}({})".format(self.__class__.__name__, signature_string(posargs, []))
def repr_part(self): """String usable in a space's ``__repr__`` method.""" optargs = [('inner', self.inner, '')] return signature_string([], optargs, mod='!r')
def repr_part(self): """Return a string usable in a space's ``__repr__`` method.""" optargs = [('norm', self.norm, ''), ('exponent', self.exponent, 2.0)] return signature_string([], optargs, mod=[[], ['!r', ':.4']])
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.norm] optargs = [('exponent', self.exponent, 2.0)] inner_str = signature_string(posargs, optargs, mod=['!r', ':.4']) return '{}({})'.format(self.__class__.__name__, inner_str)
def __repr__(self): """Return ``repr(self)``.""" posargs = [self.partition, self.axis] inner_str = signature_string(posargs, [], sep=[',\n', ', ', ', ']) return '{}({})'.format(self.__class__.__name__, indent_rows(inner_str))