MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / limit_period

Function limit_period

embodiedscan/structures/bbox_3d/utils.py:14–29  ·  view source on GitHub ↗

Limit the value into a period for periodic function. Args: val (np.ndarray or Tensor): The value to be converted. offset (float): Offset to set the value range. Defaults to 0.5. period (float): Period of the value. Defaults to np.pi. Returns: np.ndarray or T

(val: Union[np.ndarray, Tensor],
                 offset: float = 0.5,
                 period: float = np.pi)

Source from the content-addressed store, hash-verified

12
13@array_converter(apply_to=('val', ))
14def limit_period(val: Union[np.ndarray, Tensor],
15 offset: float = 0.5,
16 period: float = np.pi) -> Union[np.ndarray, Tensor]:
17 """Limit the value into a period for periodic function.
18
19 Args:
20 val (np.ndarray or Tensor): The value to be converted.
21 offset (float): Offset to set the value range. Defaults to 0.5.
22 period (float): Period of the value. Defaults to np.pi.
23
24 Returns:
25 np.ndarray or Tensor: Value in the range of
26 [-offset * period, (1-offset) * period].
27 """
28 limited_val = val - torch.floor(val / period + offset) * period
29 return limited_val
30
31
32@array_converter(apply_to=('points', 'angles'))

Callers 5

box_camera_to_lidarFunction · 0.90
rbbox2d_to_near_bboxFunction · 0.90
nearest_bevMethod · 0.85
limit_yawMethod · 0.85
convertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected