Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created July 12, 2023 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joaofig/dec25cb2e221d9d58155f6c64afad306 to your computer and use it in GitHub Desktop.
Save joaofig/dec25cb2e221d9d58155f6c64afad306 to your computer and use it in GitHub Desktop.
class PredictedPath():
def __init__(self,
probability: float = 1.0,
step: int = 1,
size: int = 0):
self.probability = probability
self.step = step
self.size = size
self.array: np.ndarray = np.zeros(size, dtype=int)
def __lt__(self, other):
return self.probability < other.probability
@classmethod
def from_seed(cls, h0: int, h1: int, size: int):
path = PredictedPath(probability=1.0,
step=2,
size=size)
path.array[0:2] = [h0, h1]
return path
def get_polyline(self):
return PolyLine(locations=locations_from_hex_list(self.array),
color="red",
opacity=0.5,
popup=f"{self.probability * 100:.2f}%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment