MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / create_empty_df

Function create_empty_df

deeplabcut/utils/auxiliaryfunctions_3d.py:50–71  ·  view source on GitHub ↗
(dataframe, scorer, flag)

Source from the content-addressed store, hash-verified

48
49
50def create_empty_df(dataframe, scorer, flag):
51 # Creates an empty dataFrame of same shape as df_side_view
52 # flag = 2d or 3d
53
54 df = dataframe
55 bodyparts = df.columns.get_level_values("bodyparts").unique()
56 a = np.full((df.shape[0], 3), np.nan)
57 dataFrame = None
58 for bodypart in bodyparts:
59 if flag == "2d":
60 pdindex = pd.MultiIndex.from_product(
61 [[scorer], [bodypart], ["x", "y", "likelihood"]],
62 names=["scorer", "bodyparts", "coords"],
63 )
64 elif flag == "3d":
65 pdindex = pd.MultiIndex.from_product(
66 [[scorer], [bodypart], ["x", "y", "z"]],
67 names=["scorer", "bodyparts", "coords"],
68 )
69 frame = pd.DataFrame(a, columns=pdindex, index=range(0, df.shape[0]))
70 dataFrame = pd.concat([frame, dataFrame], axis=1)
71 return (dataFrame, scorer, bodyparts)
72
73
74def compute_triangulation_calibration_images(

Callers

nothing calls this directly

Calls 1

uniqueMethod · 0.80

Tested by

no test coverage detected