MCPcopy Create free account
hub / github.com/TeleHuman/PBHC / contract_array

Method contract_array

description/robots/dtype.py:164–173  ·  view source on GitHub ↗

Contract the array of `cls` to the size of `subcls`.

(cls, subcls: Type['PoseArray'], array: np.ndarray)

Source from the content-addressed store, hash-verified

162
163 @classmethod
164 def contract_array(cls, subcls: Type['PoseArray'], array: np.ndarray) -> np.ndarray:
165 """
166 Contract the array of `cls` to the size of `subcls`.
167 """
168 assert cls.is_valid_array(array)
169 assert set(cls.arrorder) >= set(subcls.arrorder)
170 full_arr = PoseArray.expand_array(cls, array)
171 result = np.zeros(subcls.kNumUsedMotors)
172 result = full_arr[subcls.arrorder]
173 return result
174
175 @classmethod
176 @lru_cache(maxsize=1)

Callers 2

get_symmMethod · 0.80
contractMethod · 0.80

Calls 2

is_valid_arrayMethod · 0.80
expand_arrayMethod · 0.80

Tested by

no test coverage detected