Skip to content

Commit

Permalink
style and naming changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeEfstathiadis committed Oct 20, 2023
1 parent f97df96 commit ce79648
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
43 changes: 15 additions & 28 deletions forest/jasmine/tests/test_traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,15 @@ 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)

assert res.shape == (81200, 3)


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)

Expand All @@ -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()

Expand All @@ -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()

Expand All @@ -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()
Expand All @@ -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, :]
Expand All @@ -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, :]
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 1 addition & 4 deletions forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ce79648

Please sign in to comment.