MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / strands_from_signal_torch2

Function strands_from_signal_torch2

utils/general_util.py:369–381  ·  view source on GitHub ↗
(signal,norm='ortho')

Source from the content-addressed store, hash-verified

367 return reconstructed_fft_result
368
369def strands_from_signal_torch2(signal,norm='ortho'):
370 N = signal.shape[1]//2
371 F_cos = signal[:,: N]
372 F_sin = signal[:,N:2 * N]
373
374 # phase = F_cos * F_A + 1j*F_sin * F_A
375 phase = F_cos + 1j * F_sin
376 F_A = torch.abs(phase)
377
378 phase = torch.angle(phase)
379 reconstructed_fft_result = F_A * torch.exp(1j * phase)
380 reconstructed_fft_result = torch.fft.irfft(reconstructed_fft_result,dim=-2,norm=norm)
381 return reconstructed_fft_result
382
383
384def compute_crop_size(mask):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected