From da91251715b25a1e9d619dd3843eb9542876be81 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 06:58:53 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- movement/io/load_poses.py | 2 +- tests/conftest.py | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/movement/io/load_poses.py b/movement/io/load_poses.py index 4b764427..e004ae3f 100644 --- a/movement/io/load_poses.py +++ b/movement/io/load_poses.py @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index 12df3496..7f9801f8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -198,12 +198,26 @@ 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)) @@ -211,12 +225,26 @@ def missing_keypoint_headers_anipose_csv_file(tmp_path): 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))