Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
added comments from sync up
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-escobar committed Jan 26, 2024
1 parent 078a428 commit b224731
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controller/common/lut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ class LUT:
def __init__(self, lookup_table, interpolation_method="linear"):
self.table = np.array(lookup_table)
self.interpolation = interpolation_method
# look at python "match" statement to replace below
if self.interpolation != "linear" and self.interpolation != "spline":
raise ValueError(self.interpolation + " is an unknown interpolation method!")

# Devon suggestions
# rather then if else, store a reference to the function of the interpolation you want and call
# it here. You can define the reference in the constructor

# make self.interpolation field private
# also make the interpolation methods private

# add variable and return typing
def __call__(self, x):
if self.interpolation == "linear":
return self.linearInterpolation(x)
Expand Down

0 comments on commit b224731

Please sign in to comment.