Created
July 12, 2023 16:11
-
-
Save joaofig/dec25cb2e221d9d58155f6c64afad306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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