Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Feb 23, 2024
1 parent 03dc518 commit 24e15e4
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 33 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ select = [
# "ERA001",
"RUF",
"D409",
"D416",
"TCH",
"TID251",
"T20",
Expand All @@ -98,7 +97,7 @@ skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.lint.pydocstyle]
convention = "google"
convention = "numpy"

[tool.mypy]
ignore_missing_imports = true
Expand Down
32 changes: 16 additions & 16 deletions src/pyrho/charge_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ChargeDensity(MSONable):
Defines a charge density with a PGrid object along with the atomic structure.
Attributes:
Attributes
----------
pgrids: Dict[str, PGrid]
Dictionaries whose values are periodic ``PGrid`` objects
Expand Down Expand Up @@ -67,7 +67,7 @@ def normalized_data(self) -> dict[str, npt.NDArray]:
Since different codes use different normalization methods for
volumetric data we should convert them to the same units (electrons / Angstrom^3)
Returns:
Returns
-------
dict[str, NDArray]:
The normalized data in units of (electrons / Angstrom^3)
Expand All @@ -94,7 +94,7 @@ def normalized_pgrids(self) -> dict[str, PGrid]:
Since different codes use different normalization methods for
volumetric data we should convert them to the same units (electrons / Angstrom^3)
Returns:
Returns
-------
dict[str, PGrid]:
The normalized pgrids in units of (electrons / Angstrom^3)
Expand Down Expand Up @@ -134,7 +134,7 @@ def from_pmg(
- 'vasp' sum of the data / number of grid points == number of electrons
- None/"none" no normalization
Returns:
Returns
-------
ChargeDensity:
The charge density object
Expand Down Expand Up @@ -173,7 +173,7 @@ def get_data_in_cube(self, s: float, ngrid: int, key: str = "total") -> npt.NDAr
key:
The key to read from ``self.normalized_data``
Returns:
Returns
-------
NDArray:
Regridded data in a ngrid x ngrid x ngrid array
Expand Down Expand Up @@ -205,7 +205,7 @@ def get_transformed(
up_sample:
The factor to scale up the sampling of the grid data using Fourier interpolation
Returns:
Returns
-------
ChargeDensity:
The transformed ChargeDensity object
Expand Down Expand Up @@ -256,7 +256,7 @@ def to_Chgcar(self) -> Chgcar:
Scale and convert each key in the pgrids dictionary and create a ``Chgcar`` object
Returns:
Returns
-------
Chgcar:
The charge density object
Expand All @@ -271,7 +271,7 @@ def to_VolumetricData(
Scale and convert each key in the pgrids dictionary and create a ``VolumetricData`` object
Returns:
Returns
-------
VolumetricData:
The charge density object
Expand Down Expand Up @@ -299,7 +299,7 @@ def from_file(
The pymatgen object to read from the file (default: Chgcar).
the `from_file` method from this class will be called to read the file.
Returns:
Returns
-------
ChargeDensity: The ChargeDensity object
Expand All @@ -320,7 +320,7 @@ def from_hdf5(
The pymatgen object to read from the file (default: Chgcar).
the `from_file` method from this class will be called to read the file.
Returns:
Returns
-------
ChargeDensity: The ChargeDensity object
Expand All @@ -342,7 +342,7 @@ def get_matched_structure_mapping(
sc_struct: bigger cell
sm: StructureMatcher instance
Returns:
Returns
-------
sc_m : supercell matrix to apply to s1 to get s2
total_t : translation to apply on s1 * sc_m to get s2
Expand Down Expand Up @@ -372,7 +372,7 @@ def get_volumetric_like_sc(
):
"""Get the volumetric data in the supercell.
Parameters:
Parameters
----------
vd: VolumeData instance
sc_struct: supercell structure.
Expand All @@ -384,7 +384,7 @@ def get_volumetric_like_sc(
same as VASP's CHGCAR file. If None, no normalization is
done.
Returns:
Returns
-------
VolumetricData: volumetric data in the supercell
"""
Expand Down Expand Up @@ -422,7 +422,7 @@ def multiply_aug(data_aug: list[str], factor: int) -> list[str]:
factor:
The multiplication factor (some integer number of times it gets repeated)
Returns:
Returns
-------
List[str]:
Each line of the augmentation data.
Expand Down Expand Up @@ -477,7 +477,7 @@ def _normalize_data(
where the second `/vol` account for the different number of electrons in
different cells
Returns:
Returns
-------
NDArray:
The normalized grid data
Expand Down Expand Up @@ -505,7 +505,7 @@ def _scaled_data(
normalization:
The normalization method defaults to vasp
Returns:
Returns
-------
NDArray:
The un-normalized grid data
Expand Down
12 changes: 6 additions & 6 deletions src/pyrho/pgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PGrid(MSONable):
def __init__(self, grid_data: npt.NDArray, lattice: npt.NDArray):
"""Initialize the PGrid object.
Attributes:
Attributes
----------
grid_data:
Data stored on the regular rid
Expand Down Expand Up @@ -61,7 +61,7 @@ def _transform_data(
up_sample:
The factor to scale up the sampling of the grid data using Fourier interpolation
Returns:
Returns
-------
NDArray:
The transformed data
Expand Down Expand Up @@ -89,7 +89,7 @@ def __mul__(self, factor: float) -> PGrid:
factor:
The factor to multiply the grid data by
Returns:
Returns
-------
PGrid:
The new PGrid object
Expand All @@ -105,7 +105,7 @@ def __truediv__(self, factor: float) -> PGrid:
factor:
The factor to divide the grid data by
Returns:
Returns
-------
PGrid:
The new PGrid object
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_transformed(
up_sample:
The factor to scale up the sampling of the grid data using Fourier interpolation
Returns:
Returns
-------
PGrid:
The transformed PGrid object
Expand Down Expand Up @@ -161,7 +161,7 @@ def lossy_smooth_compression(
smear_std:
standard deviation of the Gaussian smoothing
Returns:
Returns
-------
NDArray:
Smoothed array
Expand Down
16 changes: 8 additions & 8 deletions src/pyrho/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pad_arr(arr_in: NDArray, shape: List[int]) -> NDArray:
shape:
Desired shape of the array
Returns:
Returns
-------
NDArray:
padded data
Expand Down Expand Up @@ -117,7 +117,7 @@ def interpolate_fourier(arr_in: NDArray, shape: List[int]) -> NDArray:
shape:
Desired shape shape of the interpolated data
Returns:
Returns
-------
NDArray:
Interpolated data in the desired shape
Expand All @@ -144,7 +144,7 @@ def roll_array(arr: NDArray, roll_vec: List[int]) -> NDArray:
roll_vec:
number of indices in each direction to roll
Returns:
Returns
-------
NDArray:
The rolled array
Expand Down Expand Up @@ -194,7 +194,7 @@ def get_sc_interp(
origin:
Shift applied to the origin in fractional coordinates
Returns:
Returns
-------
NDArray:
size ``(ndim x prod(grid_size))`` the cartesian coordinates of each point in the new data
Expand Down Expand Up @@ -238,7 +238,7 @@ def get_padded_array(data_in: NDArray) -> NDArray:
data_in:
Array to be padded
Returns:
Returns
-------
NDArray:
Padded array
Expand Down Expand Up @@ -267,7 +267,7 @@ def get_plane_spacing(lattice: NDArray) -> List[float]:
lattice:
List of lattice vectors in cartesian coordinates
Returns:
Returns
-------
List[float]:
List where the k-th element is is the spacing of planes generated by all
Expand Down Expand Up @@ -312,7 +312,7 @@ def get_ucell_frac_fit_sphere(lattice: np.ndarray, r: float = 0.2) -> Iterable[f
r:
width of the sphere
Returns:
Returns
-------
Iterable of floats
fraction of lattice vector in each direction need to fit the sphere
Expand Down Expand Up @@ -347,7 +347,7 @@ def gaussian_smear(
multiple:
``multiple * sigma`` is the cutoff radius for the smearing
Returns:
Returns
-------
NDArray:
The smear data array.
Expand Down
2 changes: 1 addition & 1 deletion src/pyrho/vis/scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_scatter_plot(
Plotter to use, either "matplotlib" or "plotly"
Returns:
Returns
-------
Figure | Axes:
`Figure` object or `Axes` object from matplotlib to be rendered in a notebook
Expand Down

0 comments on commit 24e15e4

Please sign in to comment.