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

Method expand_array

description/robots/dtype.py:153–161  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

151
152 @classmethod
153 def expand_array(cls, subcls: Type['PoseArray'], array: np.ndarray) -> np.ndarray:
154 """
155 Expand the array of `subcls` to the size of `cls`.
156 """
157 assert subcls.is_valid_array(array)
158 assert set(subcls.arrorder) <= set(cls.arrorder)
159 result = np.zeros(cls.kNumUsedMotors)
160 result[subcls.arrorder] = array
161 return result
162
163 @classmethod
164 def contract_array(cls, subcls: Type['PoseArray'], array: np.ndarray) -> np.ndarray:

Callers 2

contract_arrayMethod · 0.80
expandMethod · 0.80

Calls 1

is_valid_arrayMethod · 0.80

Tested by

no test coverage detected