Commit 943cf2e3 authored by lucas_miranda's avatar lucas_miranda
Browse files

Enables coverage tracking and badges

parent 8506a7fa
......@@ -6,10 +6,10 @@ image: continuumio/anaconda3
test:
stage: test
script:
- echo "Installing dependencies"
- pip install -r ./deepof/requirements.txt
- pip install -e deepof/
- echo "Dependencies installed"
- echo "Testing all functions in deepof.utils"
- python -m pytest
- echo "Testing deepof.utils complete!"
\ No newline at end of file
- coverage run -m pytest
- coverage xml -o deepof_cobertura.xml
artifacts:
report:
cobertura: deepof_cobertura.xml
\ No newline at end of file
......@@ -329,9 +329,9 @@ def close_double_contact(
def recognize_arena(
Videos, vid_index, path=".", recoglimit=1, arena_type="circular",
video, vid_index, path=".", recoglimit=1, arena_type="circular",
):
cap = cv2.VideoCapture(path + Videos[vid_index])
cap = cv2.VideoCapture(path + video[vid_index])
# Loop over the first frames in the video to get resolution and center of the arena
fnum, h, w = 0, None, None
......
......@@ -227,10 +227,11 @@ def test_rotate(p):
elements=st.floats(
min_value=1, max_value=10, allow_nan=False, allow_infinity=False
),
)
),
mode_idx=st.integers(min_value=0, max_value=1)
)
def test_align_trajectories(data):
mode = np.random.choice(["center", "all"], 1)
def test_align_trajectories(data, mode_idx):
mode = ["center", "all"][mode_idx]
aligned = align_trajectories(data, mode)
assert aligned.shape == data.shape
if mode == "center":
......@@ -303,7 +304,7 @@ def test_smooth_mult_trajectory(alpha, series):
smoothed2 = smooth_mult_trajectory(series, alpha2)
def autocorr(x, t=1):
return np.corrcoef(np.array([x[:-t], x[t:]]))[0, 1]
return np.round(np.corrcoef(np.array([x[:-t], x[t:]]))[0, 1], 5)
assert autocorr(smoothed1) >= autocorr(series)
assert autocorr(smoothed2) >= autocorr(series)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment