Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: add missing versionadded/versionchanged to docstrings #261

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ More refined methods are also available.
| Cloud in Cell | CIC | 1 |
| Triangular Shaped Cloud | TSC | 2 |

*new in gpgi 0.12*
*new in gpgi 0.12.0*
User-defined alternative methods may be provided to `Dataset.deposit` as `method=my_func`.
Their signature need to be compatible with `gpgi.types.DepositionMethodT`.

Expand Down
83 changes: 48 additions & 35 deletions src/gpgi/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ def __init__(
the returned Dataset as an attribute (namely, ds.metadata). This special
attribute is accessible from boundary condition methods as the argument of the
same name.

.. versionadded: 0.4.0
"""
self.geometry = geometry

Expand Down Expand Up @@ -618,6 +620,8 @@ def is_sorted(self, *, axes: tuple[int, ...] | None = None) -> bool:
r"""
Return True if and only if particles are already sorted.

.. versionadded: 0.14.0

Parameters
----------
axes: tuple[int, ...]
Expand All @@ -631,6 +635,8 @@ def sorted(self, axes: tuple[int, ...] | None = None) -> Self:
r"""
Return a copy of this dataset with particles sorted by host cell index.

.. versionadded: 0.14.0

Parameters
----------
axes: tuple[int, ...]
Expand Down Expand Up @@ -682,58 +688,65 @@ def deposit(
Parameters
----------
particle_field_key (positional only): str
label of the particle field to deposit
label of the particle field to deposit

method (keyword only): 'ngp', 'cic' or 'tsc', or function
full names ('nearest_grid_point', 'cloud_in_cell', and
'triangular_shaped_cloud') are also valid
full names ('nearest_grid_point', 'cloud_in_cell', and
'triangular_shaped_cloud') are also valid

.. versionchanged:: 0.12.0
Added support for user-defined functions.

verbose (keyword only): bool (default False)
if True, print execution time for hot loops (indexing and deposition)

return_ghost_padded_array (keyword only): bool (default False)
if True, return the complete deposition array, including one extra
cell layer per direction and per side. This option is meant as a
debugging tool for methods that leak some particle data outside the
active domain (cic and tsc).
if True, return the complete deposition array, including one extra
cell layer per direction and per side. This option is meant as a
debugging tool for methods that leak some particle data outside the
active domain (cic and tsc).

weight_field (keyword only): str
label of another field to use as weights. Let u be the field to
deposit and w be the weight field. Let u' and w' be their equivalent
on-grid descriptions. u' is obtained as
label of another field to use as weights. Let u be the field to
deposit and w be the weight field. Let u' and w' be their equivalent
on-grid descriptions. u' is obtained as

w'(x) = Σ w(i) c(i,x)
u'(x) = (1/w'(x)) Σ u(i) w(i) c(i,x)

w'(x) = Σ w(i) c(i,x)
u'(x) = (1/w'(x)) Σ u(i) w(i) c(i,x)
where x is the spatial position, i is a particle index, and w(i,x)
are geometric coefficients associated with the deposition method.

where x is the spatial position, i is a particle index, and w(i,x)
are geometric coefficients associated with the deposition method.
.. versionadded: 0.7.0

boundaries and weight_field_boundaries (keyword only): dict
Maps from axis names (str) to boundary recipe keys (str, str)
representing left/right boundaries. By default all axes will use
'open' boundaries on both sides. Specifying boundaries for all axes
is not mandated, but note that recipes are applied in the order of
specified axes (any unspecified axes will be treated last).
Maps from axis names (str) to boundary recipe keys (str, str)
representing left/right boundaries. By default all axes will use
'open' boundaries on both sides. Specifying boundaries for all axes
is not mandated, but note that recipes are applied in the order of
specified axes (any unspecified axes will be treated last).

weight_field_boundaries is required if weight field is used in
combinations with boundaries.

weight_field_boundaries is required if weight field is used in
combinations with boundaries.
Boundary recipes are applied the weight field (if any) first.

Boundary recipes are applied the weight field (if any) first.
.. versionadded: 0.5.0

lock (keyword only): 'per-instance' (default), None, or threading.Lock
Fine tune performance for multi-threaded applications: define a
locking strategy around the deposition hotloop.
- 'per-instance': allow multiple Dataset instances to run deposition
concurrently, but forbid concurrent accesses to any specific
instance
- None: no locking is applied. Within some restricted conditions
(e.g. depositing a couple fields concurrently in a sorted dataset),
this may improve walltime performance, but it is also expected to
degrade it in a more general case as it encourages cache-misses
- an arbitrary threading.Lock instance may be supplied to implement
a custom strategy

.. versionadded:: 2.0.0
Fine tune performance for multi-threaded applications: define a
locking strategy around the deposition hotloop.
- 'per-instance': allow multiple Dataset instances to run deposition
concurrently, but forbid concurrent accesses to any specific
instance
- None: no locking is applied. Within some restricted conditions
(e.g. depositing a couple fields concurrently in a sorted dataset),
this may improve walltime performance, but it is also expected to
degrade it in a more general case as it encourages cache-misses
- an arbitrary threading.Lock instance may be supplied to implement
a custom strategy

.. versionadded:: 2.0.0
"""
if callable(method):
from inspect import signature
Expand Down