MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / find_common_intervals

Function find_common_intervals

mbench/motion_quality.py:37–45  ·  view source on GitHub ↗

Find common intervals between two sets of intervals.

(intervals1, intervals2)

Source from the content-addressed store, hash-verified

35 raise ValueError(f"Unexpected data format in {evaluation_file}")
36
37def find_common_intervals(intervals1, intervals2):
38 """Find common intervals between two sets of intervals."""
39 intervals1 = torch.tensor(intervals1, dtype=torch.float32)
40 intervals2 = torch.tensor(intervals2, dtype=torch.float32)
41 start_max = torch.max(intervals1[:, 0].unsqueeze(1), intervals2[:, 0])
42 end_min = torch.min(intervals1[:, 1].unsqueeze(1), intervals2[:, 1])
43 overlap_mask = start_max < end_min
44 common_intervals = torch.stack((start_max, end_min), dim=2)[overlap_mask]
45 return common_intervals
46
47def calculate_angle(vector1, vector2):
48 """Calculate angle between two vectors."""

Callers 1

compute_foot_floatingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected