Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 10, 2024
1 parent f105619 commit da91251
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion movement/io/load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ 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
Expand Down
36 changes: 32 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,53 @@ def dlc_style_df():
"""Return a valid DLC-style DataFrame."""
return pd.read_hdf(pytest.DATA_PATHS.get("DLC_single-wasp.predictions.h5"))


@pytest.fixture
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))
f.write("\n")
f.write(",".join(["1"] * len(headers)))
return file_path


@pytest.fixture
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

0 comments on commit da91251

Please sign in to comment.