Skip to content

Commit e04444e

Browse files
committed
format doc string Returns: sections
1 parent ff94faa commit e04444e

29 files changed

+96
-94
lines changed

pymatgen/analysis/chempot_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ def get_centroid_2d(vertices: np.ndarray) -> np.ndarray:
677677
circumferentially
678678
679679
Returns:
680-
Array giving 2-d centroid coordinates
680+
np.array: Giving 2-d centroid coordinates.
681681
"""
682682
cx = 0
683683
cy = 0

pymatgen/analysis/diffraction/tem.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def get_interplanar_spacings(
134134
points (tuple): the desired hkl indices.
135135
136136
Returns:
137-
Dict of hkl to its interplanar spacing, in angstroms (float).
137+
dict[tuple[int, int, int], float]: hkl planes mapped to
138+
interplanar spacings, in angstroms (float).
138139
"""
139140
points_filtered = self.zone_axis_filter(points)
140141
if (0, 0, 0) in points_filtered:
@@ -152,7 +153,7 @@ def bragg_angles(
152153
interplanar_spacings (dict): dictionary of hkl to interplanar spacing
153154
154155
Returns:
155-
dict of hkl plane (3-tuple) to Bragg angle in radians (float)
156+
dict[tuple[int, int, int], float]: hkl planes mapped to Bragg angles [radians]
156157
"""
157158
plane = list(interplanar_spacings)
158159
interplanar_spacings_val = np.array(list(interplanar_spacings.values()))

pymatgen/analysis/eos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def _func(self, volume, params):
310310

311311

312312
class PourierTarantola(EOSBase):
313-
"""PourierTarantola EOS."""
313+
"""Pourier-Tarantola EOS."""
314314

315315
def _func(self, volume, params):
316316
"""Pourier-Tarantola equation from PRB 70, 224107."""

pymatgen/analysis/graphs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ def __eq__(self, other: object) -> bool:
13981398

13991399
edges_other = {(u, v, data["to_jimage"]) for u, v, data in other_sorted.graph.edges(keys=False, data=True)}
14001400

1401-
return (edges == edges_other) and (self.structure == other_sorted.structure)
1401+
return edges == edges_other and self.structure == other_sorted.structure
14021402

14031403
def diff(self, other: StructureGraph, strict: bool = True) -> dict:
14041404
"""
@@ -2799,7 +2799,7 @@ def __eq__(self, other: object) -> bool:
27992799

28002800
edges_other = set(other_sorted.graph.edges(keys=False))
28012801

2802-
return (edges == edges_other) and (self.molecule == other_sorted.molecule)
2802+
return edges == edges_other and self.molecule == other_sorted.molecule
28032803

28042804
def isomorphic_to(self, other: MoleculeGraph) -> bool:
28052805
"""

pymatgen/analysis/hhi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def get_hhi(self, comp_or_form):
5555
Gets the reserve and production HHI for a compound.
5656
5757
Args:
58-
comp_or_form (Composition or String): A Composition or String formula
58+
comp_or_form (CompositionLike): A Composition or String formula
5959
6060
Returns:
61-
A tuple representing the (HHI_production, HHI_reserve)
61+
tuple[float, float]: HHI_production, HHI_reserve
6262
"""
6363
try:
6464
if not isinstance(comp_or_form, Composition):

pymatgen/analysis/interface_reactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def minimum(self):
589589
mixing ratio x_min.
590590
591591
Returns:
592-
Tuple (x_min, E_min).
592+
tuple[float, float]: (x_min, E_min).
593593
"""
594594
return min(((x, energy) for _, x, energy, _, _ in self.get_kinks()), key=lambda tup: tup[1])
595595

pymatgen/analysis/local_env.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def get_cn(
303303
'take_max_species' will use Fe as the site specie.
304304
305305
Returns:
306-
cn (float): coordination number.
306+
float: coordination number.
307307
"""
308308
structure = _handle_disorder(structure, on_disorder)
309309
siw = self.get_nn_info(structure, n)
@@ -322,7 +322,7 @@ def get_cn_dict(self, structure: Structure, n: int, use_weights: bool = False):
322322
weight).
323323
324324
Returns:
325-
cn (dict): dictionary of CN of each element bonded to site
325+
dict[str, float]: coordination number of each element bonded to site with index n in structure.
326326
"""
327327
siw = self.get_nn_info(structure, n)
328328

@@ -409,6 +409,7 @@ def get_all_nn_info(self, structure: Structure):
409409
410410
Args:
411411
structure (Structure): Input structure
412+
412413
Returns:
413414
List of NN site information for each site in the structure. Each
414415
entry has the same format as `get_nn_info`
@@ -4063,7 +4064,7 @@ def get_cn(self, structure: Structure, n: int, **kwargs) -> float: # type: igno
40634064
'take_max_species' will use Fe as the site specie.
40644065
40654066
Returns:
4066-
cn (float): coordination number.
4067+
float: coordination number.
40674068
"""
40684069
use_weights = kwargs.get("use_weights", False)
40694070
if self.weighted_cn != use_weights:
@@ -4084,7 +4085,7 @@ def get_cn_dict(self, structure: Structure, n: int, use_weights: bool = False, *
40844085
weight).
40854086
40864087
Returns:
4087-
cn (dict): dictionary of CN of each element bonded to site
4088+
dict[int, list[dict]]: coordination number and list of coordinated sites
40884089
"""
40894090
if self.weighted_cn != use_weights:
40904091
raise ValueError("The weighted_cn parameter and use_weights parameter should match!")

pymatgen/analysis/magnetism/heisenberg.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,9 @@ def _get_unique_sites(structure):
128128
structure (Structure): ground state Structure object.
129129
130130
Returns:
131-
unique_site_ids (dict): maps tuples of equivalent site indices to a
132-
unique int identifier
133-
wyckoff_ids (dict): maps tuples of equivalent site indices to their
134-
wyckoff symbols
131+
tuple[dict, dict]: unique_site_ids maps tuples of equivalent site indices to a
132+
unique int identifier.
133+
wyckoff_ids maps tuples of equivalent site indices to their wyckoff symbols
135134
"""
136135
# Get a nonmagnetic representation of the supercell geometry
137136
s0 = CollinearMagneticStructureAnalyzer(
@@ -356,7 +355,7 @@ def get_exchange(self):
356355
solve for the exchange parameters.
357356
358357
Returns:
359-
ex_params (dict): Exchange parameter values (meV/atom).
358+
dict[str, float]: Exchange parameters (meV/atom).
360359
"""
361360
ex_mat = self.ex_mat
362361
# Solve the matrix equation for J_ij values
@@ -466,7 +465,7 @@ def estimate_exchange(self, fm_struct=None, afm_struct=None, fm_e=None, afm_e=No
466465
afm_e (float): afm energy/atom
467466
468467
Returns:
469-
j_avg (float): Average exchange parameter (meV/atom)
468+
float: Average J exchange parameter (meV/atom)
470469
"""
471470
# Get low energy orderings if not supplied
472471
if any(arg is None for arg in [fm_struct, afm_struct, fm_e, afm_e]):
@@ -503,7 +502,7 @@ def get_mft_temperature(self, j_avg):
503502
j_avg (float): j_avg (float): Average exchange parameter (meV/atom)
504503
505504
Returns:
506-
mft_t (float): Critical temperature (K)
505+
float: Critical temperature mft_t (K)
507506
"""
508507
n_sub_lattices = len(self.unique_site_ids)
509508
k_boltzmann = 0.0861733 # meV/K
@@ -545,7 +544,7 @@ def get_interaction_graph(self, filename=None):
545544
filename (str): if not None, save interaction graph to filename.
546545
547546
Returns:
548-
igraph (StructureGraph): Exchange interaction graph.
547+
StructureGraph: Exchange interaction graph.
549548
"""
550549
structure = self.ordered_structures[0]
551550
sgraph = self.sgraphs[0]
@@ -593,7 +592,7 @@ def _get_j_exc(self, i, j, dist):
593592
(10E-2 precision)
594593
595594
Returns:
596-
j_exc (float): Exchange parameter in meV
595+
float: Exchange parameter J_exc in meV
597596
"""
598597
# Get unique site identifiers
599598
i_index = 0
@@ -964,7 +963,7 @@ def _get_j_exc(self, i, j, dist):
964963
dist (float): distance (Angstrom) between sites +- tol
965964
966965
Returns:
967-
j_exc (float): Exchange parameter in meV
966+
float: Exchange parameter J_exc in meV
968967
"""
969968
# Get unique site identifiers
970969
i_index = 0

pymatgen/analysis/piezo_sensitivity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ def rand_piezo(struct, pointops, sharedops, BEC, IST, FCM, anumiter=10):
693693
IST (numpy array): Nx3x3x3 array representing the internal strain tensor
694694
FCM (numpy array): NxNx3x3 array representing the born effective charge tensor
695695
anumiter (int): number of iterations for acoustic sum rule convergence
696+
696697
Returns:
697698
list in the form of [Nx3x3 random born effective charge tenosr,
698699
Nx3x3x3 random internal strain tensor, NxNx3x3 random force constant matrix, 3x3x3 piezo tensor]

pymatgen/analysis/structure_analyzer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,8 @@ def parse_oxide(self) -> tuple[str, int]:
429429
Determines if an oxide is a peroxide/superoxide/ozonide/normal oxide.
430430
431431
Returns:
432-
oxide_type (str): Type of oxide
433-
ozonide/peroxide/superoxide/hydroxide/None.
434-
nbonds (int): Number of peroxide/superoxide/hydroxide bonds in structure.
432+
tuple[str, int]: Type of oxide (ozonide/peroxide/superoxide/hydroxide/None) and number of
433+
peroxide/superoxide/hydroxide bonds in structure.
435434
"""
436435
structure = self.structure
437436
relative_cutoff = self.relative_cutoff

0 commit comments

Comments
 (0)