(code)
| 115 | |
| 116 | |
| 117 | def inverse_FDT(code): |
| 118 | |
| 119 | N = code.shape[0]//3 |
| 120 | |
| 121 | strand = [] |
| 122 | for i in range(3): |
| 123 | signal = code[:,i] |
| 124 | F_A = signal[:N] |
| 125 | F_cos = signal[N:2*N] |
| 126 | F_sin = signal[2*N:] |
| 127 | |
| 128 | |
| 129 | # phase = F_cos * F_A + 1j*F_sin * F_A |
| 130 | phase = F_cos + 1j*F_sin |
| 131 | phase = np.angle(phase) |
| 132 | phase = np.concatenate([phase,-1 * phase[1:-1][::-1]],0) |
| 133 | |
| 134 | |
| 135 | F_A = np.concatenate([F_A,F_A[1:-1][::-1]],0) |
| 136 | reconstructed_fft_result = F_A* np.exp(1j * phase) |
| 137 | reconstructed_fft_result = np.fft.ifft(reconstructed_fft_result) |
| 138 | strand.append(np.real(reconstructed_fft_result)[:,None]) |
| 139 | |
| 140 | |
| 141 | strand = np.concatenate(strand,1) |
| 142 | |
| 143 | return strand |
| 144 | |
| 145 | def strands_from_signal(signal): |
| 146 | strands = [] |
no outgoing calls
no test coverage detected