Skip to content

Commit

Permalink
add parameter to compute_ppa_speed and compute_ppa_perimeter
Browse files Browse the repository at this point in the history
  • Loading branch information
rongxiangsu committed Sep 4, 2023
1 parent fa5a941 commit 94875b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions ortega/ortega.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,21 +527,25 @@ def __get_spatial_intersect_pairs(self):
intersection_pairs = get_spatial_intersect_pairs(self.ellipses_list_id1, self.ellipses_list_id2)
return intersection_pairs

def compute_ppa_speed(self):
def compute_ppa_speed(self, lim: List[float] = [0, 0]):
if len(lim) != 2:
raise ValueError("Parameter 'lim' must be a list of two floats!")
speed_list = [
[e.speed for e in self.ellipses_list_id1],
[e.speed for e in self.ellipses_list_id2]
[e.speed for e in self.ellipses_list_id1 if e.speed > lim[0]],
[e.speed for e in self.ellipses_list_id2 if e.speed > lim[1]]
]
print(f"Descriptive statistics of PPA speed for id {self.id1}:")
print(pd.Series(speed_list[0]).describe())
print(f"Descriptive statistics of PPA speed for id {self.id2}:")
print(pd.Series(speed_list[1]).describe())
return speed_list

def compute_ppa_perimeter(self):
def compute_ppa_perimeter(self, lim: List[float] = [0, 0]):
if len(lim) != 2:
raise ValueError("Parameter 'lim' must be a list of two floats!")
size_list = [
[e.el.length for e in self.ellipses_list_id1],
[e.el.length for e in self.ellipses_list_id2]
[e.el.length for e in self.ellipses_list_id1 if e.el.length > lim[0]],
[e.el.length for e in self.ellipses_list_id2 if e.el.length > lim[1]]
]
print(f"Descriptive statistics of PPA perimeter for id {self.id1}:")
print(pd.Series(size_list[0]).describe())
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if __name__ == "__main__":
setup(
name='ortega',
version='1.0.13',
version='1.0.14',
author='MOVE lab@UCSB',
author_email="rongxiangsu@ucsb.edu",
packages=["ortega"],
Expand Down

0 comments on commit 94875b5

Please sign in to comment.