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

Method to_array

deeplabcut/core/conversion_table.py:38–49  ·  view source on GitHub ↗

Returns: An array mapping the indices of SuperAnimal bodyparts Raises: ValueError: If the conversion table is misconfigured.

(self)

Source from the content-addressed store, hash-verified

36 self.validate()
37
38 def to_array(self) -> np.ndarray:
39 """
40 Returns:
41 An array mapping the indices of SuperAnimal bodyparts
42
43 Raises:
44 ValueError: If the conversion table is misconfigured.
45 """
46 self.validate()
47 sa_indices = {sa_bpt: i for i, sa_bpt in enumerate(self.super_animal_bodyparts)}
48 sa_bpt_ordering = [self.table[bpt] for bpt in self.converted_bodyparts()]
49 return np.array([sa_indices[sa_bpt] for sa_bpt in sa_bpt_ordering])
50
51 def converted_bodyparts(self) -> list[str]:
52 """Returns: The project bodyparts included in this ordered"""

Callers 1

build_weight_initFunction · 0.80

Calls 2

validateMethod · 0.95
converted_bodypartsMethod · 0.95

Tested by

no test coverage detected