MCPcopy Create free account
hub / github.com/bic-L/MaxFormer / random_shift_time

Method random_shift_time

event/augment.py:99–107  ·  view source on GitHub ↗
(self, events, max_shift_ratio)

Source from the content-addressed store, hash-verified

97
98
99 def random_shift_time(self, events, max_shift_ratio):
100 events = copy.deepcopy(events)
101 max_shift_ratio = int(max_shift_ratio)
102 t_max = torch.amax(events[:, 2]).item()
103 t_min = torch.amin(events[:, 2]).item()
104 shift_length = max_shift_ratio * (t_max - t_min)
105 t_shift = (torch.rand(size=(len(events),)).to(events.device) - 0.5) * shift_length
106 events[:, 2] += t_shift
107 return events
108
109 def random_shift_xy(self, events, max_shift_length):
110 events = copy.deepcopy(events)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected