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

Method to_h5

deeplabcut/core/inferenceutils.py:847–871  ·  view source on GitHub ↗
(self, output_name)

Source from the content-addressed store, hash-verified

845 return params
846
847 def to_h5(self, output_name):
848 data = np.full(
849 (
850 len(self.metadata["imnames"]),
851 self.max_n_individuals,
852 self.n_multibodyparts,
853 4,
854 ),
855 fill_value=np.nan,
856 )
857 for ind, assemblies in self.assemblies.items():
858 for n, assembly in enumerate(assemblies):
859 data[ind, n] = assembly.data
860 index = pd.MultiIndex.from_product(
861 [
862 ["scorer"],
863 map(str, range(self.max_n_individuals)),
864 map(str, range(self.n_multibodyparts)),
865 ["x", "y", "likelihood"],
866 ],
867 names=["scorer", "individuals", "bodyparts", "coords"],
868 )
869 temp = data[..., :3].reshape((data.shape[0], -1))
870 df = pd.DataFrame(temp, columns=index)
871 df.to_hdf(output_name, key="ass")
872
873 def to_pickle(self, output_name):
874 data = dict()

Callers 2

test_assemblerFunction · 0.95

Calls 1

itemsMethod · 0.80

Tested by 2

test_assemblerFunction · 0.76