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

Correct typos in docstrings #269

Merged
merged 3 commits into from
Nov 27, 2023
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
36 changes: 18 additions & 18 deletions pyirf/interpolation/component_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class BaseComponentEstimator:
"""
Base class for all Estimators working on specific IRF components.

While usable, it is encuraged to use the actual class for the respective IRF
component as it ensures further checks and if nessecarry e.g. unit handling.
While usable, it is encouraged to use the actual class for the respective IRF
component as it ensures further checks and if necessary e.g. unit handling.
"""

def __init__(self, grid_points):
Expand Down Expand Up @@ -81,7 +81,7 @@ def __init__(self, grid_points):
self.triangulation = Delaunay(self.grid_points)

def _target_in_grid(self, target_point):
"""Check wether target_point lies within grids convex hull, uses
"""Check whether target_point lies within grids convex hull, uses
simple comparison for 1D and Delaunay triangulation for >1D."""
if self.grid_dim == 1:
return (target_point >= self.grid_points.min()) and (
Expand Down Expand Up @@ -128,7 +128,7 @@ def __call__(self, target_point):

if target_point.shape[1] != self.grid_dim:
raise ValueError(
"Missmatch between target-point and grid dimension."
"Mismatch between target-point and grid dimension."
f" Grid has dimension {self.grid_dim}, target has dimension"
f" {target_point.shape[1]}."
)
Expand All @@ -148,8 +148,8 @@ class DiscretePDFComponentEstimator(BaseComponentEstimator):
"""
Base class for all Estimators working on IRF components that represent discretized PDFs.

While usable, it is encuraged to use the actual class for the respective IRF
component as it ensures further checks and if nessecarry e.g. unit handling.
While usable, it is encouraged to use the actual class for the respective IRF
component as it ensures further checks and if necessary e.g. unit handling.
"""

def __init__(
Expand All @@ -175,7 +175,7 @@ def __init__(
binned_pdf: np.ndarray, shape=(n_points, ..., n_bins)
Discretized PDFs for all grid points and arbitrary further dimensions
(in IRF term e.g. field-of-view offset bins). Actual interpolation dimension,
meaning the dimensions that contains actual histograms, has to be along
meaning the dimensions that contain actual histograms, have to be along
the last axis.
interpolator_cls:
pyirf interpolator class, defaults to QuantileInterpolator.
Expand All @@ -195,7 +195,7 @@ def __init__(
TypeError:
When bin_edges is not a np.ndarray.
TypeError:
When binned_pdf is not a np.ndarray..
When binned_pdf is not a np.ndarray.
TypeError:
When interpolator_cls is not a DiscretePDFInterpolator subclass.
TypeError:
Expand All @@ -220,15 +220,15 @@ def __init__(
raise TypeError("Input binned_pdf is not a numpy array.")
elif self.n_points != binned_pdf.shape[0]:
raise ValueError(
f"Shape missmatch, number of grid_points ({self.n_points}) and "
f"Shape mismatch, number of grid_points ({self.n_points}) and "
f"number of histograms in binned_pdf ({binned_pdf.shape[0]}) "
"not matching."
)
elif not isinstance(bin_edges, np.ndarray):
raise TypeError("Input bin_edges is not a numpy array.")
elif binned_pdf.shape[-1] != (bin_edges.shape[0] - 1):
raise ValueError(
f"Shape missmatch, bin_edges ({bin_edges.shape[0] - 1} bins) "
f"Shape mismatch, bin_edges ({bin_edges.shape[0] - 1} bins) "
f"and binned_pdf ({binned_pdf.shape[-1]} bins) not matching."
)

Expand Down Expand Up @@ -271,8 +271,8 @@ class ParametrizedComponentEstimator(BaseComponentEstimator):
Base class for all Estimators working on IRF components that represent parametrized
or scalar quantities.

While usable, it is encuraged to use the actual class for the respective IRF
component as it ensures further checks and if nessecarry e.g. unit handling.
While usable, it is encouraged to use the actual class for the respective IRF
component as it ensures further checks and if necessary e.g. unit handling.
"""

def __init__(
Expand All @@ -294,7 +294,7 @@ def __init__(
Grid points at which interpolation templates exist
params: np.ndarray, shape=(n_points, ..., n_params)
Corresponding parameter values at each point in grid_points.
First dimesion has to correspond to number of grid_points.
First dimension has to correspond to the number of grid_points.
interpolator_cls:
pyirf interpolator class, defaults to GridDataInterpolator.
interpolator_kwargs: dict
Expand All @@ -317,7 +317,7 @@ def __init__(
TypeError:
When params is not a np.ndarray.
ValueError:
When number of points grid_points and params is not matching.
When number of points grid_points and params do not match.

Note
----
Expand All @@ -332,7 +332,7 @@ def __init__(
raise TypeError("Input params is not a numpy array.")
elif self.n_points != params.shape[0]:
raise ValueError(
"Shape missmatch, number of grid_points and rows in params not matching."
"Shape mismatch, number of grid_points and rows in params not matching."
)

# Make sure that 1D input is sorted in increasing order
Expand Down Expand Up @@ -411,7 +411,7 @@ def __init__(
None which is the same as passing an empty dict.
min_effective_area: astropy.units.Quantity[area]
Minimum value of effective area to be considered for interpolation. Values
lower then this value are set to this value. Defaults to 1 m**2.
lower than this value are set to this value. Defaults to 1 m**2.


Note
Expand Down Expand Up @@ -576,7 +576,7 @@ def __init__(
or e.g. missing a fov_offset axis, the axis containing n_migration_bins
has to be specified through axis.
interpolator_cls:
pyirf interpolator class, defaults to GridDataInterpolator.
pyirf interpolator class, defaults to QuantileInterpolator.
interpolator_kwargs: dict
Dict of all kwargs that are passed to the interpolator, defaults to
None which is the same as passing an empty dict.
Expand Down Expand Up @@ -662,7 +662,7 @@ def __init__(
This is assumed as default. If these axes are in different order
the axis containing n_source_offset_bins has to be specified through axis.
interpolator_cls:
pyirf interpolator class, defaults to GridDataInterpolator.
pyirf interpolator class, defaults to QuantileInterpolator.
interpolator_kwargs: dict
Dict of all kwargs that are passed to the interpolator, defaults to
None which is the same as passing an empty dict.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, grid_points):
interp(target2D_twopoints)

with pytest.raises(
ValueError, match="Missmatch between target-point and grid dimension."
ValueError, match="Mismatch between target-point and grid dimension."
):
interp = DummyEstimator(grid_points2D_good)
interp(target1D_inGrid)
Expand Down Expand Up @@ -163,7 +163,7 @@ def extrapolate(self, target_point):

grid_points = np.array([1, 2, 3])
params_good = np.array([[1], [2], [3]])
params_shape_missmatch = np.array([[1], [2]])
params_shape_mismatch = np.array([[1], [2]])

with pytest.raises(
TypeError,
Expand All @@ -184,11 +184,11 @@ def extrapolate(self, target_point):

with pytest.raises(
ValueError,
match="Shape missmatch, number of grid_points and rows in params not matching.",
match="Shape mismatch, number of grid_points and rows in params not matching.",
):
ParametrizedComponentEstimator(
grid_points=grid_points,
params=params_shape_missmatch,
params=params_shape_mismatch,
interpolator_cls=DummyInterpolator,
)

Expand Down Expand Up @@ -276,7 +276,7 @@ def extrapolate(self, target_point):
with pytest.raises(
ValueError,
match=re.escape(
"Shape missmatch, number of grid_points (3) and "
"Shape mismatch, number of grid_points (3) and "
"number of histograms in binned_pdf (2) not matching."
),
):
Expand All @@ -290,7 +290,7 @@ def extrapolate(self, target_point):
with pytest.raises(
ValueError,
match=re.escape(
"Shape missmatch, bin_edges (10 bins) "
"Shape mismatch, bin_edges (10 bins) "
"and binned_pdf (11 bins) not matching."
),
):
Expand Down
Loading