Skip to content

Commit

Permalink
added explicit parameter, and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
BalzaniEdoardo committed Oct 10, 2024
1 parent bd11a00 commit b35a272
Showing 1 changed file with 71 additions and 8 deletions.
79 changes: 71 additions & 8 deletions src/nemos/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class Basis(Base, abc.ABC):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
Expand Down Expand Up @@ -1403,7 +1403,12 @@ class SplineBasis(Basis, abc.ABC):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -1422,6 +1427,8 @@ def __init__(
order: int = 2,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
) -> None:
self.order = order
Expand All @@ -1430,6 +1437,8 @@ def __init__(
mode=mode,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)

Expand Down Expand Up @@ -1554,7 +1563,12 @@ class MSplineBasis(SplineBasis):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs:
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand Down Expand Up @@ -1590,6 +1604,8 @@ def __init__(
order: int = 2,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
) -> None:
super().__init__(
Expand All @@ -1598,6 +1614,8 @@ def __init__(
order=order,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)

Expand Down Expand Up @@ -1712,7 +1730,12 @@ class BSplineBasis(SplineBasis):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -1737,6 +1760,8 @@ def __init__(
order: int = 4,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
):
super().__init__(
Expand All @@ -1745,6 +1770,8 @@ def __init__(
order=order,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)

Expand Down Expand Up @@ -1831,7 +1858,12 @@ class CyclicBSplineBasis(SplineBasis):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -1851,6 +1883,8 @@ def __init__(
order: int = 4,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
):
super().__init__(
Expand All @@ -1859,6 +1893,8 @@ def __init__(
order=order,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)
if self.order < 2:
Expand Down Expand Up @@ -1973,7 +2009,12 @@ class RaisedCosineBasisLinear(Basis):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -1993,13 +2034,17 @@ def __init__(
width: float = 2.0,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
) -> None:
super().__init__(
n_basis_funcs,
mode=mode,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)
self._n_input_dimensionality = 1
Expand Down Expand Up @@ -2166,7 +2211,12 @@ class RaisedCosineBasisLog(RaisedCosineBasisLinear):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -2188,6 +2238,8 @@ def __init__(
enforce_decay_to_zero: bool = True,
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
) -> None:
super().__init__(
Expand All @@ -2197,6 +2249,8 @@ def __init__(
window_size=window_size,
bounds=bounds,
**kwargs,
label=label,
n_basis_input=n_basis_input
)
# The samples are scaled appropriately in the self._transform_samples which scales
# and applies the log-stretch, no additional transform is needed.
Expand Down Expand Up @@ -2320,7 +2374,12 @@ class OrthExponentialBasis(Basis):
bounds :
The bounds for the basis domain in `mode="eval"`. The default `bounds[0]` and `bounds[1]` are the
minimum and the maximum of the samples provided when evaluating the basis.
If a sample is outside the bonuds, the basis will return NaN.
If a sample is outside the bounds, the basis will return NaN.
label :
The label of the basis, intended to be descriptive of the task variable being processed.
For example: velocity, position, spike_counts.
n_basis_input :
Number of input to be processed by the basis in "conv" mode.
**kwargs :
Only used in "conv" mode. Additional keyword arguments that are passed to
`nemos.convolve.create_convolutional_predictor`
Expand All @@ -2333,13 +2392,17 @@ def __init__(
mode="eval",
window_size: Optional[int] = None,
bounds: Optional[Tuple[float, float]] = None,
label: Optional[str] = None,
n_basis_input: Optional[int] = None,
**kwargs,
):
super().__init__(
n_basis_funcs,
mode=mode,
window_size=window_size,
bounds=bounds,
label=label,
n_basis_input=n_basis_input,
**kwargs,
)
self.decay_rates = decay_rates
Expand Down

0 comments on commit b35a272

Please sign in to comment.