From dcf1255b4b655b23a2f11738a55c3479f8eb2f7f Mon Sep 17 00:00:00 2001 From: nikunjgoel95 Date: Sat, 10 Oct 2020 13:26:06 -0400 Subject: [PATCH] Fix runtime bug in Radius of Gyration of Doryab Location. --- src/features/location_doryab/location_base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/features/location_doryab/location_base.py b/src/features/location_doryab/location_base.py index 6d29bc04..af5866c6 100644 --- a/src/features/location_doryab/location_base.py +++ b/src/features/location_doryab/location_base.py @@ -343,8 +343,10 @@ def radius_of_gyration(locationData,sampling_frequency): time_in_cluster = locationData[locationData["location_label"]==labels].shape[0]* sampling_frequency rog = rog + (time_in_cluster * distance) - + time_all_clusters = valid_clusters.shape[0] * sampling_frequency + if time_all_clusters == 0: + return 0 final_rog = (1/time_all_clusters) * rog return np.sqrt(final_rog)