Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vigji committed Dec 10, 2024
1 parent 6a22f33 commit ce4a874
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions movement/io/load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,10 +700,12 @@ def _ds_from_valid_data(data: ValidPosesDataset) -> xr.Dataset:

def from_anipose_df(anipose_triangulation_df, individual_name="individual_0"):
"""Convert triangulation dataframe to xarray dataset.
Reshape dataframe with columns keypoint1_x, keypoint1_y, keypoint1_z, keypoint1_confidence_score,
keypoint2_x, keypoint2_y, keypoint2_z, keypoint2_confidence_score, ...
to array of positions with dimensions time, individuals, keypoints, space,
and array of confidence scores with dimensions time, individuals, keypoints
Reshape dataframe with columns keypoint1_x, keypoint1_y, keypoint1_z,
keypoint1_confidence_score,keypoint2_x, keypoint2_y, keypoint2_z,
keypoint2_confidence_score...to array of positions with dimensions
time, individuals, keypoints, space, and array of confidence scores
with dimensions time, individuals, keypoints.
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion movement/validators/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def _file_contains_expected_headers(self, attribute, value):
f"Expected: {expected_headers}.",
)

# For all other headers, check they have expected suffixes and base names
# For other headers, check they have expected suffixes and base names
other_headers = [h for h in headers if h not in expected_headers]
for header in other_headers:
# Check suffix
Expand Down
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ def dlc_style_df():
def missing_keypoint_headers_anipose_csv_file(tmp_path):
"""Return the file path for a fake single-individual .csv file."""
file_path = tmp_path / "missing_keypoint_headers.csv"
headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01", "M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"]
headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01",
"M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"]
headers.extend(["kp0_x", "kp0_y", "kp0_score", "kp0_error", "kp0_ncams"])
with open(file_path, "w") as f:
f.write(",".join(headers))
Expand All @@ -214,7 +215,8 @@ def missing_keypoint_headers_anipose_csv_file(tmp_path):
def spurious_header_anipose_csv_file(tmp_path):
"""Return the file path for a fake single-individual .csv file."""
file_path = tmp_path / "spurious_header.csv"
headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01", "M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"]
headers = ["fnum", "center_0", "center_1", "center_2", "M_00", "M_01",
"M_02", "M_10", "M_11", "M_12", "M_20", "M_21", "M_22"]
headers.extend(["funny_header"])
with open(file_path, "w") as f:
f.write(",".join(headers))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unit/test_validators/test_files_validators.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pytest

from movement.validators.files import (
ValidAniposeCSV,
ValidDeepLabCutCSV,
ValidFile,
ValidHDF5,
ValidVIATracksCSV,
ValidAniposeCSV,
)


Expand Down

0 comments on commit ce4a874

Please sign in to comment.