Skip to content

Commit 26ac12f

Browse files
fix docstring in problem zoo
1 parent 33242f4 commit 26ac12f

File tree

7 files changed

+32
-12
lines changed

7 files changed

+32
-12
lines changed

pina/problem/zoo/advection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class AdvectionProblem(SpatialProblem, TimeDependentProblem):
3333
DOI: `arXiv:2308.08468 <https://arxiv.org/abs/2308.08468>`_.
3434
3535
:Example:
36-
>>> problem = AdvectionProblem(c=1.0)
36+
37+
>>> problem = AdvectionProblem()
3738
"""
3839

3940
output_variables = ["u"]
@@ -53,7 +54,7 @@ def __init__(self, c=1.0):
5354
"""
5455
Initialization of the :class:`AdvectionProblem`.
5556
56-
:param c: The advection velocity parameter.
57+
:param c: The advection velocity parameter. Default is 1.0.
5758
:type c: float | int
5859
"""
5960
super().__init__()

pina/problem/zoo/allen_cahn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
2828
:math:`[-1, 1]` and temporal interval :math:`[0, 1]`.
2929
3030
.. seealso::
31+
3132
**Original reference**: Sokratis J. Anagnostopoulos, Juan D. Toscano,
3233
Nikolaos Stergiopulos, and George E. Karniadakis.
3334
*Residual-based attention and connection to information
@@ -37,6 +38,7 @@ class AllenCahnProblem(TimeDependentProblem, SpatialProblem):
3738
j.cma.2024.116805 <https://doi.org/10.1016/j.cma.2024.116805>`_.
3839
3940
:Example:
41+
4042
>>> problem = AllenCahnProblem()
4143
"""
4244

@@ -57,9 +59,9 @@ def __init__(self, alpha=1e-4, beta=5):
5759
"""
5860
Initialization of the :class:`AllenCahnProblem`.
5961
60-
:param alpha: The diffusion coefficient.
62+
:param alpha: The diffusion coefficient. Default is 1e-4.
6163
:type alpha: float | int
62-
:param beta: The reaction coefficient.
64+
:param beta: The reaction coefficient. Default is 5.0.
6365
:type beta: float | int
6466
"""
6567
super().__init__()

pina/problem/zoo/diffusion_reaction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ class DiffusionReactionProblem(TimeDependentProblem, SpatialProblem):
3434
:math:`[-\pi, \pi]` and temporal interval :math:`[0, 1]`.
3535
3636
.. seealso::
37+
3738
**Original reference**: Si, Chenhao, et al. *Complex Physics-Informed
3839
Neural Network.* arXiv preprint arXiv:2502.04917 (2025).
3940
DOI: `arXiv:2502.04917 <https://arxiv.org/abs/2502.04917>`_.
4041
4142
:Example:
43+
4244
>>> problem = DiffusionReactionProblem()
4345
"""
4446

@@ -63,7 +65,7 @@ def __init__(self, alpha=1e-4):
6365
"""
6466
Initialization of the :class:`DiffusionReactionProblem`.
6567
66-
:param alpha: The diffusion coefficient.
68+
:param alpha: The diffusion coefficient. Default is 1e-4.
6769
:type alpha: float | int
6870
"""
6971
super().__init__()

pina/problem/zoo/helmholtz.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ class HelmholtzProblem(SpatialProblem):
1414
:math:`[-1, 1] \times [-1, 1]`.
1515
1616
.. seealso::
17+
1718
**Original reference**: Si, Chenhao, et al. *Complex Physics-Informed
1819
Neural Network.* arXiv preprint arXiv:2502.04917 (2025).
1920
DOI: `arXiv:2502.04917 <https://arxiv.org/abs/2502.04917>`_.
2021
2122
:Example:
23+
2224
>>> problem = HelmholtzProblem()
2325
"""
2426

@@ -44,7 +46,7 @@ def __init__(self, alpha=3.0):
4446
"""
4547
Initialization of the :class:`HelmholtzProblem` class.
4648
47-
:param alpha: Parameter of the forcing term.
49+
:param alpha: Parameter of the forcing term. Default is 3.0.
4850
:type alpha: float | int
4951
"""
5052
super().__init__()

pina/problem/zoo/inverse_poisson_2d_square.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ def _load_tensor_from_url(url, labels, timeout=10):
2626
and None is returned.
2727
2828
:param str url: URL to the remote `.pth` tensor file.
29-
:param list[str] | tuple[str] labels: Labels for the resulting LabelTensor.
30-
:param int timeout: Timeout for the request in seconds.
29+
:param labels: Labels for the resulting LabelTensor.
30+
:type labels: list[str] | tuple[str]
31+
:param int timeout: Timeout for the request in seconds. Default is 10s.
3132
:return: A LabelTensor object if successful, otherwise None.
3233
:rtype: LabelTensor | None
3334
"""
@@ -71,12 +72,14 @@ def laplace_equation(input_, output_, params_):
7172
class InversePoisson2DSquareProblem(SpatialProblem, InverseProblem):
7273
r"""
7374
Implementation of the inverse 2-dimensional Poisson problem in the square
74-
domain :math:`[0, 1] \times [0, 1]`,
75-
with unknown parameter domain :math:`[-1, 1] \times [-1, 1]`.
76-
The `"data"` condition is added only if the required files are
77-
downloaded successfully.
75+
domain :math:`[0, 1] \times [0, 1]`, with unknown parameter domain
76+
:math:`[-1, 1] \times [-1, 1]`.
77+
78+
The `"data"` condition is added only if the required files are downloaded
79+
successfully.
7880
7981
:Example:
82+
8083
>>> problem = InversePoisson2DSquareProblem()
8184
"""
8285

@@ -108,6 +111,7 @@ def __init__(self, load=True, data_size=1.0):
108111
109112
:param bool load: If True, it attempts to load data from remote URLs.
110113
Set to False to skip data loading (e.g., if no internet connection).
114+
Default is True.
111115
:param float data_size: The fraction of the total data to use for the
112116
"data" condition. If set to 1.0, all available data is used.
113117
If set to 0.0, no data is used. Default is 1.0.

pina/problem/zoo/poisson_2d_square.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Poisson2DSquareProblem(SpatialProblem):
2828
:math:`[0, 1] \times [0, 1]`.
2929
3030
:Example:
31+
3132
>>> problem = Poisson2DSquareProblem()
3233
"""
3334

pina/problem/zoo/supervised_problem.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class SupervisedProblem(AbstractProblem):
1313
:class:`~pina.condition.input_target_condition.InputTargetCondition`.
1414
1515
:Example:
16+
1617
>>> import torch
1718
>>> input_data = torch.rand((100, 10))
1819
>>> output_data = torch.rand((100, 10))
@@ -33,10 +34,17 @@ def __init__(
3334
:type input_: torch.Tensor | LabelTensor | Graph | Data
3435
:param output_: Output data of the problem.
3536
:type output_: torch.Tensor | LabelTensor | Graph | Data
37+
:param list[str] input_variables: List of names of the input variables.
38+
If None, the input variables are inferred from `input_`.
39+
Default is None.
40+
:param list[str] output_variables: List of names of the output
41+
variables. If None, the output variables are inferred from
42+
`output_`. Default is None.
3643
"""
3744
# Set input and output variables
3845
self.input_variables = input_variables
3946
self.output_variables = output_variables
47+
4048
# Set the condition
4149
self.conditions["data"] = Condition(input=input_, target=output_)
4250
super().__init__()

0 commit comments

Comments
 (0)