Skip to content

Commit

Permalink
📚 Fix autodoc reference warnings
Browse files Browse the repository at this point in the history
Added some to the `nitpick_ignore`, since I couldn't immediately figure out
why it isn't finding these...
  • Loading branch information
mbercx committed Nov 17, 2023
1 parent 48489f7 commit 9a764fc
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 48 deletions.
9 changes: 6 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"aiida": ("https://aiida.readthedocs.io/projects/aiida-core/en/latest", None),
"aiida": ("https://aiida.readthedocs.io/projects/aiida-core/en/latest/", None),
"aiida_pseudo": ("https://aiida-pseudo.readthedocs.io/en/latest/", None),
}

# Settings for the `sphinx_copybutton` extension
Expand All @@ -64,8 +65,6 @@
)
copybutton_prompt_is_regexp = True

nitpick_ignore = [("py:obj", "module")]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down Expand Up @@ -187,6 +186,10 @@
# Warnings to ignore when using the -n (nitpicky) option
# We should ignore any python built-in exception, for instance
nitpick_ignore = [
("py:obj", "module"),
("py:class", "numpy.array"),
("py:class", "np.array"),
("py:class", "ty.Tuple"),
("py:exc", "ArithmeticError"),
("py:exc", "AssertionError"),
("py:exc", "AttributeError"),
Expand Down
5 changes: 0 additions & 5 deletions src/aiida_wannier90_workflows/utils/bands/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,10 @@ def bands_distance(
"""Calculate bands distance with ``mu`` set as Ef to Ef+5.
:param bands_dft: [description]
:type bands_dft: orm.BandsData
:param bands_wannier: [description]
:type bands_wannier: orm.BandsData
:param fermi_energy: [description]
:type fermi_energy: float
:param exclude_list_dft: [description], defaults to None
:type exclude_list_dft: list, optional
:return: [description], unit is eV.
:rtype: np.array
"""
if isinstance(bands_dft, orm.BandsData):
dft_bands = bands_dft.get_bands()
Expand Down
2 changes: 0 additions & 2 deletions src/aiida_wannier90_workflows/utils/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ def identify_codes(
```
:param codes: a list of code identifier
:type codes: ty.Iterable[str, int, orm.Code]
:return: a dict with plugin name as key, ``Code`` as value.
:rtype: ty.Dict[str, orm.Code]
"""
results = {}

Expand Down
17 changes: 0 additions & 17 deletions src/aiida_wannier90_workflows/utils/kpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ def create_kpoints_from_distance(
this is not a ``calcfunction``, so the AiiDA database is unchanged.
:param structure: [description]
:type structure: [type]
:param distance: [description]
:type distance: [type]
:param force_parity: whether the generated mesh is even or odd.
:type force_parity: bool, aiida.orm.Bool
:return: [description]
:rtype: [type]
"""
kpoints = orm.KpointsData()
kpoints.set_cell_from_structure(structure)
Expand Down Expand Up @@ -89,7 +85,6 @@ def cartesian_product(*arrays: np.ndarray) -> np.ndarray:
"""Cartesian product.
:return: _description_
:rtype: np.ndarray
"""
la = len(arrays) # pylint: disable=invalid-name
dtype = np.result_type(*arrays)
Expand All @@ -103,10 +98,8 @@ def get_mesh_from_kpoints(kpoints: orm.KpointsData) -> ty.List:
"""From .
:param kpoints: contains a N1 * N2 * N3 mesh
:type kpoints: aiida.orm.KpointsData
:raises AttributeError: if kmesh does not contains a mesh
:return: an explicit list of kpoints
:rtype: aiida.orm.KpointsData
"""
try: # test if it is a mesh
mesh, _ = kpoints.get_kpoints_mesh()
Expand Down Expand Up @@ -137,11 +130,8 @@ def create_kpoints_from_mesh(
"""Create KpointsData from a given distance.
:param structure: [description]
:type structure: [type]
:param mesh: [description]
:type mesh: [type]
:return: [description]
:rtype: [type]
"""
kpoints = orm.KpointsData()
kpoints.set_cell_from_structure(structure)
Expand All @@ -159,11 +149,8 @@ def get_explicit_kpoints_from_mesh(
"""Create an explicit list of kpoints with a given distance.
:param structure: [description]
:type structure: [type]
:param mesh: [description]
:type mesh: [type]
:return: [description]
:rtype: [type]
"""
kpoints = create_kpoints_from_mesh(structure, mesh)
kpoints = get_explicit_kpoints(kpoints)
Expand All @@ -178,9 +165,7 @@ def get_path_from_kpoints(kpoints: orm.KpointsData) -> orm.Dict:
to the input `kpoint_path` (a Dict object) of Wannier90Calculation.
:param kpoints: the input KpointsData must contain `labels`.
:type kpoints: orm.KpointsData
:return: the returned Dict object contains two keys: `path` and `point_coords`.
:rtype: orm.Dict
"""
assert kpoints.labels is not None, "`kpoints` must have `labels`"
assert len(kpoints.labels) >= 2
Expand Down Expand Up @@ -231,9 +216,7 @@ def get_kpoints_from_bands(bands: orm.BandsData) -> orm.KpointsData:
"""Create a ``KpointsData`` from a ``BandsData``.
:param bands: the input ``BandsData`` object .
:type bands: aiida.orm.BandsData
:return: the returned ``KpointsData`` must contain ``labels``.
:rtype: aiida.orm.KpointsData
"""
kpoints = orm.KpointsData()

Expand Down
5 changes: 0 additions & 5 deletions src/aiida_wannier90_workflows/utils/parser/center.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ def generate_supercell(
"""Generate a supercell for finding nearest neighbours.
:param cell: each row is a lattice vector
:type cell: np.array
:param size: number of repetitions = 2*size + 1, defaults to 2
:type size: int, optional
:return: supercell and the translation index
:rtype: list[np.array, np.array]
"""
# Generate a supercell (2D: square, 3D: cube).
# If the angles between lattice vectors are small, a 3*3*3 supercell is not enough
Expand Down Expand Up @@ -221,9 +218,7 @@ def get_wigner_seitz(cell: np.array, search_size: int = 2) -> np.array:
"""Get Wigner-Seitz cell.
:param cell: each row is a lattice vector.
:type cell: np.array
:return: Wigner-Seitz cell
:rtype: np.array
"""
import itertools

Expand Down
7 changes: 0 additions & 7 deletions src/aiida_wannier90_workflows/utils/pseudo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ def get_pseudo_and_cutoff(
"""Get pseudo potential and cutoffs of a given pseudo family and structure.
:param pseudo_family: [description]
:type pseudo_family: str
:param structure: [description]
:type structure: orm.StructureData
:raises ValueError: [description]
:raises ValueError: [description]
:return: [description]
:rtype: ty.Tuple[ty.Mapping[str, PseudoPotentialData], float, float]
"""
try:
pseudo_set = (PseudoDojoFamily, SsspFamily, CutoffsPseudoPotentialFamily)
Expand Down Expand Up @@ -88,11 +85,8 @@ def get_semicore_list(structure: orm.StructureData, pseudo_orbitals: dict) -> li
"""Get semicore states (a subset of pseudo wavefunctions) in the pseudopotential.
:param structure: [description]
:type structure: orm.StructureData
:param pseudo_orbitals: [description]
:type pseudo_orbitals: dict
:return: [description]
:rtype: list
"""
from copy import deepcopy

Expand Down Expand Up @@ -147,7 +141,6 @@ def get_wannier_number_of_bands(
"""Estimate number of bands for a Wannier90 calculation.
:param structure: crystal structure
:type structure: aiida.orm.StructureData
:param pseudos: dictionary of pseudopotentials
:type pseudos: dict of aiida.orm.UpfData
:param only_valence: return only occupied number of badns
Expand Down
9 changes: 0 additions & 9 deletions src/aiida_wannier90_workflows/utils/scdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,9 @@ def fit_scdm_mu_sigma(
This is the AiiDA wrapper of `fit_scdm_mu_sigma_raw`.
:param pw2wan_parameters: pw2wannier90 input parameters (the one to update with this calcfunction)
:type pw2wan_parameters: orm.Dict
:param bands: band structure of the projwfc output
:type bands: orm.BandsData
:param projections: projectability of the projwfc output
:type projections: orm.ProjectionData
:param sigma_factor: sigma_factor of SCDM
:type sigma_factor: orm.Float
"""
bands_array, projections_array = get_projectability_arrays(bands, projections)
return fit_scdm_mu_sigma_raw(
Expand Down Expand Up @@ -128,9 +124,7 @@ def sort_projectability_arrays(bands: np.array, projections: np.array):
"""Sort projectability arrays by energy in ascending order.
:param bands: output of projwfc, it was computed in the nscf calc
:type bands: np.array, shape num_kpoints * num_bands
:param projections: output of projwfc
:type projections: np.array, shape num_kpoints * num_bands
"""
# Flattening (projection modulus squared according to QE, energies)
projwfc_flat = projections.flatten()
Expand All @@ -153,11 +147,8 @@ def get_energy_of_projectability(
"""Return energy corresponds to projectability = thresholds.
:param bands: [description]
:type bands: orm.BandsData
:param projections: [description]
:type projections: orm.ProjectionData
:param thresholds: [description]
:type thresholds: float
"""
bands_array, projections_array = get_projectability_arrays(bands, projections)
sorted_bands, sorted_projwfc = sort_projectability_arrays(
Expand Down

0 comments on commit 9a764fc

Please sign in to comment.