From ce796486ab72380a8bd6643733636e4cbc449a52 Mon Sep 17 00:00:00 2001 From: Georgios Efstathiadis Date: Fri, 20 Oct 2023 17:53:30 -0400 Subject: [PATCH] style and naming changes --- forest/jasmine/tests/test_traj2stats.py | 43 +++++++++---------------- forest/jasmine/traj2stats.py | 5 +-- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/forest/jasmine/tests/test_traj2stats.py b/forest/jasmine/tests/test_traj2stats.py index befe606f..610de33e 100644 --- a/forest/jasmine/tests/test_traj2stats.py +++ b/forest/jasmine/tests/test_traj2stats.py @@ -487,8 +487,7 @@ def test_avg_mobility_trace_difference_no_common_timestamps( def test_create_mobility_trace_shape(sample_trajectory): - """Testing shape of mobility trace - """ + """Testing shape of mobility trace""" res = create_mobility_trace(sample_trajectory) @@ -496,8 +495,7 @@ def test_create_mobility_trace_shape(sample_trajectory): def test_create_mobility_trace_start_end_times(sample_trajectory): - """Testing start and end times of mobility trace - """ + """Testing start and end times of mobility trace""" res = create_mobility_trace(sample_trajectory) @@ -506,8 +504,7 @@ def test_create_mobility_trace_start_end_times(sample_trajectory): def test_get_pause_array_shape(sample_trajectory, coords2): - """Testing shape of pause array - """ + """Testing shape of pause array""" parameters = Hyperparameters() @@ -521,8 +518,7 @@ def test_get_pause_array_shape(sample_trajectory, coords2): def test_get_pause_array_times(sample_trajectory, coords2): - """Testing times spent in places of pause array - """ + """Testing times spent in places of pause array""" parameters = Hyperparameters() @@ -537,8 +533,7 @@ def test_get_pause_array_times(sample_trajectory, coords2): def test_get_pause_array_house(sample_trajectory): - """Testing case where house is in pause array - """ + """Testing case where house is in pause array""" house_coords = (51.45435654, -2.58555554) parameters = Hyperparameters() @@ -553,8 +548,7 @@ def test_get_pause_array_house(sample_trajectory): def test_extract_pause_from_row_shape(sample_trajectory): - """Testing shape of pause array - """ + """Testing shape of pause array""" pause_list = extract_pause_from_row( sample_trajectory[0, :] @@ -564,8 +558,7 @@ def test_extract_pause_from_row_shape(sample_trajectory): def test_extract_pause_from_row_time(sample_trajectory): - """Testing shape of pause array - """ + """Testing pause time of row""" pause_list = extract_pause_from_row( sample_trajectory[0, :] @@ -576,9 +569,8 @@ def test_extract_pause_from_row_time(sample_trajectory): assert pause_list[2] == true_val / 60 -def test_compute_window_and_count_window(sample_trajectory): - """Testing window size is correct - """ +def test_compute_window_size(sample_trajectory): + """Testing window size is correct""" window, _ = compute_window_and_count( sample_trajectory[0, 3], sample_trajectory[-1, 6], 1 @@ -587,9 +579,8 @@ def test_compute_window_and_count_window(sample_trajectory): assert window == 3600 -def test_compute_window_and_count_num_windows(sample_trajectory): - """Testing number of windows is correct - """ +def test_compute_window_count(sample_trajectory): + """Testing number of windows is correct""" _, num_windows = compute_window_and_count( sample_trajectory[0, 3], sample_trajectory[-1, 6], 1 @@ -598,10 +589,8 @@ def test_compute_window_and_count_num_windows(sample_trajectory): assert num_windows == 24 -def test_compute_window_and_count_window2(sample_trajectory): - """Testing window size is correct - 6 hour window - """ +def test_compute_window_size_6_hour(sample_trajectory): + """Testing window size is correct 6 hour window""" window, _ = compute_window_and_count( sample_trajectory[0, 3], sample_trajectory[-1, 6], 6 @@ -610,10 +599,8 @@ def test_compute_window_and_count_window2(sample_trajectory): assert window == 3600 * 6 -def test_compute_window_and_count_num_windows2(sample_trajectory): - """Testing number of windows is correct - 6 hour window - """ +def test_compute_window_count_6_hour(sample_trajectory): + """Testing number of windows is correct 6 hour window""" _, num_windows = compute_window_and_count( sample_trajectory[0, 3], sample_trajectory[-1, 6], 6 diff --git a/forest/jasmine/traj2stats.py b/forest/jasmine/traj2stats.py index e55eee06..ed2d8a92 100644 --- a/forest/jasmine/traj2stats.py +++ b/forest/jasmine/traj2stats.py @@ -468,10 +468,7 @@ def get_day_night_indices( end_time2 = datetime2stamp(current_time_list3, tz_str) if index % 2 == 0: # daytime - index_rows = ( - (traj[:, 3] <= end_time2) - * (traj[:, 6] >= start_time2) - ) + index_rows = (traj[:, 3] <= end_time2) * (traj[:, 6] >= start_time2) return index_rows, 0, 0, start_time2, end_time2