(h5_file)
| 1039 | |
| 1040 | |
| 1041 | def parse_ground_truth_data_file(h5_file): |
| 1042 | df = pd.read_hdf(h5_file) |
| 1043 | try: |
| 1044 | df.drop("single", axis=1, level="individuals", inplace=True) |
| 1045 | except KeyError: |
| 1046 | pass |
| 1047 | # Cast columns of dtype 'object' to float to avoid TypeError |
| 1048 | # further down in _parse_ground_truth_data. |
| 1049 | cols = df.select_dtypes(include="object").columns |
| 1050 | if cols.to_list(): |
| 1051 | df[cols] = df[cols].astype("float") |
| 1052 | n_individuals = len(df.columns.get_level_values("individuals").unique()) |
| 1053 | n_bodyparts = len(df.columns.get_level_values("bodyparts").unique()) |
| 1054 | data = df.to_numpy().reshape((df.shape[0], n_individuals, n_bodyparts, -1)) |
| 1055 | return _parse_ground_truth_data(data) |
| 1056 | |
| 1057 | |
| 1058 | def _parse_ground_truth_data(data): |
nothing calls this directly
no test coverage detected