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)