Skip to content

Commit

Permalink
fixed documentaion for ufuncs and lattice
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Feb 14, 2024
1 parent d55f5c9 commit 69a1028
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 68 deletions.
3 changes: 3 additions & 0 deletions docs/api/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ The typing types is shown below:

AtomsArgument
AtomsLike
Axis
Axies
Axes
Coord
CoordOrScalar
FuncType
Expand Down
2 changes: 1 addition & 1 deletion src/sisl/_core/_ufuncs_atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def remove(atom: Atom, orbitals: IndexArgument) -> Atom:
See Also
--------
sub : retain a selected set of orbitals
Atom.sub : retain a selected set of orbitals
"""
orbs = np.delete(_a.arangei(atom.no), orbitals)
return atom.sub(orbs)
Expand Down
55 changes: 28 additions & 27 deletions src/sisl/_core/_ufuncs_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def write(geometry: Geometry, sile: SileLike, *args, **kwargs) -> None:
See Also
--------
read : reads a `Geometry` from a given `Sile`/file
Geometry.read : reads a `Geometry` from a given `Sile`/file
write : generic sisl function dispatcher
"""
# This only works because, they *must*
# have been imported previously
Expand Down Expand Up @@ -634,10 +635,10 @@ def insert(geometry: Geometry, atom: AtomsArgument, other: GeometryLike) -> Geom
See Also
--------
add : add geometries
append : appending geometries
prepend : prending geometries
attach : attach a geometry
Geometry.add : add geometries
Geometry.append : appending geometries
Geometry.prepend : prending geometries
Geometry.attach : attach a geometry
"""
atom = geometry._sanitize_atoms(atom)
if atom.size > 1:
Expand Down Expand Up @@ -691,8 +692,8 @@ def tile(geometry: Geometry, reps: int, axis: int) -> Geometry:
See Also
--------
repeat : equivalent but different ordering of final structure
untile : opposite method of this
Geometry.repeat : equivalent but different ordering of final structure
Geometry.untile : opposite method of this
"""
if reps < 1:
raise ValueError(
Expand Down Expand Up @@ -769,8 +770,8 @@ def untile(
See Also
--------
tile : opposite method of this
repeat : equivalent geometry as `tile` but different ordering of final structure
Geometry.tile : opposite method of this
Geometry.repeat : equivalent geometry as `tile` but different ordering of final structure
"""
if geometry.na % reps != 0:
raise ValueError(
Expand Down Expand Up @@ -848,8 +849,8 @@ def repeat(geometry: Geometry, reps: int, axis: int) -> Geometry:
See Also
--------
tile : equivalent geometry as `repeat` but different ordering of final structure
unrepeat : opposite method of this
Geometry.tile : equivalent geometry as `repeat` but different ordering of final structure
Geometry.unrepeat : opposite method of this
"""
if reps < 1:
raise ValueError(
Expand Down Expand Up @@ -886,7 +887,7 @@ def unrepeat(geometry: Geometry, reps: int, axis: int, *args, **kwargs) -> Geome
See Also
--------
repeat : opposite method of this
Geometry.repeat : opposite method of this
"""
atoms = np.arange(geometry.na).reshape(-1, reps).T.ravel()
return geometry.sub(atoms).untile(reps, axis, *args, **kwargs)
Expand Down Expand Up @@ -946,7 +947,7 @@ def sub(geometry: Geometry, atoms: AtomsArgument) -> Geometry:
See Also
--------
Lattice.fit : update the supercell according to a reference supercell
remove : the negative of this routine, i.e. remove a subset of atoms
Geometry.remove : the negative of this routine, i.e. remove a subset of atoms
"""
atoms = geometry.sc2uc(atoms)
return geometry.__class__(
Expand All @@ -971,7 +972,7 @@ def remove(geometry: Geometry, atoms: AtomsArgument) -> Geometry:
See Also
--------
sub : the negative of this routine, i.e. retain a subset of atoms
Geometry.sub : the negative of this routine, i.e. retain a subset of atoms
"""
atoms = geometry.sc2uc(atoms)
if atoms.size == 0:
Expand Down Expand Up @@ -1042,7 +1043,7 @@ def rotate(
See Also
--------
Quaternion : class to rotate
Lattice.rotate : rotation passed to the contained supercell
Lattice.rotate : rotation for a Lattice object
"""
if origin is None:
origin = [0.0, 0.0, 0.0]
Expand Down Expand Up @@ -1280,10 +1281,10 @@ def append(
See Also
--------
add : add geometries
prepend : prending geometries
attach : attach a geometry
insert : insert a geometry
Geometry.add : add geometries
Geometry.prepend : prending geometries
Geometry.attach : attach a geometry
Geometry.insert : insert a geometry
"""
if isinstance(other, Lattice):
# Only extend the supercell.
Expand Down Expand Up @@ -1368,10 +1369,10 @@ def prepend(
See Also
--------
add : add geometries
append : appending geometries
attach : attach a geometry
insert : insert a geometry
Geometry.add : add geometries
Geometry.append : appending geometries
Geometry.attach : attach a geometry
Geometry.insert : insert a geometry
"""
if isinstance(other, Lattice):
# Only extend the supercell.
Expand Down Expand Up @@ -1436,10 +1437,10 @@ def add(
See Also
--------
append : appending geometries
prepend : prending geometries
attach : attach a geometry
insert : insert a geometry
Geometry.append : appending geometries
Geometry.prepend : prending geometries
Geometry.attach : attach a geometry
Geometry.insert : insert a geometry
Examples
--------
Expand Down
2 changes: 1 addition & 1 deletion src/sisl/_core/_ufuncs_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def write(grid: Grid, sile: SileLike, *args, **kwargs) -> None:
See Also
--------
read : reads a `Grid` from a given `Sile`/file
Grid.read : reads a `Grid` from a given `Sile`/file
"""
# this only works because, they *must*
# have been imported previously
Expand Down
4 changes: 2 additions & 2 deletions src/sisl/_core/_ufuncs_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def write(lattice: Lattice, sile: SileLike, *args, **kwargs) -> None:
See Also
--------
read : reads a `Lattice` from a given `Sile`/file
Lattice.read : reads a `Lattice` from a given `Sile`/file
"""
# This only works because, they *must*
# have been imported previously
Expand Down Expand Up @@ -327,7 +327,7 @@ def untile(lattice: Lattice, reps: int, axis: int) -> Lattice:
See Also
--------
tile : opposite of this method
Lattice.tile : opposite of this method
"""
cell = np.copy(lattice.cell)
cell[axis] /= reps
Expand Down
16 changes: 8 additions & 8 deletions src/sisl/_core/_ufuncs_sparse_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def tile(SA: SparseAtom, reps: int, axis: int) -> SparseAtom:
See Also
--------
repeat: a different ordering of the final geometry
untile : opposite of this method
SparseAtom.repeat: a different ordering of the final geometry
SparseAtom.untile : opposite of this method
Geometry.tile: the same ordering as the final geometry
Geometry.repeat: a different ordering of the final geometry
"""
Expand Down Expand Up @@ -171,7 +171,7 @@ def repeat(SA: SparseAtom, reps: int, axis: int) -> SparseAtom:
--------
Geometry.repeat: the same ordering as the final geometry
Geometry.tile: a different ordering of the final geometry
tile: a different ordering of the final geometry
SparseAtom.tile: a different ordering of the final geometry
"""
# Create the new sparse object
g = SA.geometry.repeat(reps, axis)
Expand Down Expand Up @@ -260,8 +260,8 @@ def tile(SO: SparseOrbital, reps: int, axis: int) -> SparseOrbital:
See Also
--------
repeat: a different ordering of the final geometry
untile : opposite of this method
SparseOrbital.repeat: a different ordering of the final geometry
SparseOrbital.untile : opposite of this method
Geometry.tile: the same ordering as the final geometry
Geometry.repeat: a different ordering of the final geometry
"""
Expand Down Expand Up @@ -346,7 +346,7 @@ def repeat(SO: SparseOrbital, reps: int, axis: int) -> SparseOrbital:
--------
Geometry.repeat: the same ordering as the final geometry
Geometry.tile: a different ordering of the final geometry
tile: a different ordering of the final geometry
SparseOrbital.tile: a different ordering of the final geometry
"""
# Create the new sparse object
g = SO.geometry.repeat(reps, axis)
Expand Down Expand Up @@ -460,7 +460,7 @@ def sub(SA: SparseAtom, atoms: AtomsArgument) -> SparseAtom:
--------
Geometry.remove : the negative of `Geometry.sub`
Geometry.sub : equivalent to the resulting `Geometry` from this routine
remove : the negative of `sub`, i.e. remove a subset of atoms
SparseAtom.remove : the negative of `sub`, i.e. remove a subset of atoms
"""
atoms = SA.sc2uc(atoms)
geom = SA.geometry.sub(atoms)
Expand Down Expand Up @@ -501,7 +501,7 @@ def sub(SO: SparseOrbital, atoms: AtomsArgument) -> SparseOrbital:
--------
Geometry.remove : the negative of `Geometry.sub`
Geometry.sub : equivalent to the resulting `Geometry` from this routine
remove : the negative of `sub`, i.e. remove a subset of atoms
SparseOrbital.remove : the negative of `sub`, i.e. remove a subset of atoms
"""
atoms = SO.sc2uc(atoms)
orbs = SO.a2o(atoms, all=True)
Expand Down
Loading

0 comments on commit 69a1028

Please sign in to comment.