Demo entry 6736469

test

   

Submitted by anonymous on Apr 26, 2018 at 21:47
Language: Python 3. Code size: 608 Bytes.

def create_trace(E, frogtype):
    """
    E must be a numpy.ndarray type.
    """
    if frogtype == 'SHG':
    	gate = E
    elif frogtype == 'TG':
        gate = np.abs(E)**2

    E_sig_td = np.outer(E, gate)
    #permute the columns to the right order, tau=...,-1,0,1,...
    for i in range(len(E)):
    	E_sig_td[i,:] = np.roll(E_sig_td[i,:], -i, axis = 0)

    E_sig_td = np.fliplr(ft.fftshift(E_sig_td, axes = 1))
    #FFT each column and put 0 frequency in the correct place:
    E_sig_wd = ft.fftshift(ft.fft(ft.fftshift(E_sig_td, axes = 0), axis = 0), axes = 0)
    return E_sig_wd

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).