Skip to content

Commit

Permalink
Rewrite some docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
RuneDominik committed Jan 22, 2024
1 parent 6ca459a commit b00e56e
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions pyirf/interpolation/visible_edges_extrapolator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Extrapolators for Parametrized and DiscretePDF components blending all extrapolating from
all visible simplices
Extrapolators for Parametrized and DiscretePDF components that combine extrapolations
from all visible simplices (by blending over visible edges) to get a smooth extrapolation
outside the grids convex hull.
"""
import numpy as np
from scipy.spatial import Delaunay
Expand All @@ -13,8 +14,9 @@

def find_visible_facets(grid_points, target_point):
"""
Utility function to find all facets of a convex hull that are visible from
a point outside. To do so, this function constructs a triangulation containing
Find all facets of a convex hull visible from an outside point.
To do so, this function constructs a triangulation containing
the target point and returns all facets that span a triangulation simplex with
it.
Expand Down Expand Up @@ -59,7 +61,7 @@ def find_visible_facets(grid_points, target_point):

def compute_extrapolation_weights(visible_facet_points, target_point, m):
"""
Utility function to compute extrapolation weight according to [1].
Compute extrapolation weight according to [1].
Parameters
----------
Expand Down Expand Up @@ -93,7 +95,7 @@ def compute_extrapolation_weights(visible_facet_points, target_point, m):

class ParametrizedVisibleEdgesExtrapolator(ParametrizedNearestSimplexExtrapolator):
"""
Extrapolator class extending the ParametrizedNearestSimplexExtrapolator.
Extrapolator using blending over visible edges.
While the ParametrizedNearestSimplexExtrapolator does not result in a smooth
extrapolation outside of the grid due to using only the nearest available
Expand Down Expand Up @@ -148,23 +150,6 @@ def __init__(self, grid_points, params, m=1):
self.m = m

def extrapolate(self, target_point):
"""
Takes a grid of scalar values for a bunch of different parameters
and extrapolates it to given value of those parameters. Falls back
to ParametrizedNearestSimplexExtrapolator's behavior for 1D grids or
cases, where only one simplex is visible in 2D.
Parameters
----------
target_point: numpy.ndarray
Value for which the extrapolation is performed (target point)
Returns
-------
values: numpy.ndarray, shape=(1,...)
Extrapolated values
"""
if self.grid_dim == 1:
return super().extrapolate(target_point)
elif self.grid_dim == 2:
Expand Down

0 comments on commit b00e56e

Please sign in to comment.