Beispiel #1
0
    def get_fft(self, window=None, subtract_last=True):
        """Returns Fourier transform of the whole evolution superoperator
        
        
        Parameters
        ----------
        
        window: DFunction or numpy array
            Windowing function by which the data are multiplied
            
        subtract_last: bool
            If True, the value at the last available time is subtracted 
            from all times
        
        """

        if window is None:
            winfce = qr.DFunction(self.time,
                                  numpy.ones(self.time.length, dtype=qr.REAL))
        else:
            winfce = window

        dat = self.data
        if subtract_last:
            dat = dat - dat[-1, :, :, :, :]

        # FIXME: Implement windowing
        fdat = numpy.fft.ifft(dat, axis=0)  #*winfce.data)
        fdat = numpy.fft.fftshift(fdat, axes=0)

        time = self.time
        freq = time.get_FrequencyAxis()

        return fdat, freq
Beispiel #2
0
    def get_element_fft(self, elem, window=None):
        """Returns a DFunction with the FFT of the element evolution
        
        """

        if window is None:
            winfce = qr.DFunction(self.time,
                                  numpy.ones(self.time.length, dtype=qr.REAL))
        else:
            winfce = window

        dat = self.data[:, elem[0], elem[1], elem[2], elem[3]]

        fdat = numpy.fft.ifft(dat * winfce.data)
        fdat = numpy.fft.fftshift(fdat)

        time = self.time
        freq = time.get_FrequencyAxis()

        ffce = qr.DFunction(freq, fdat)

        return ffce
Beispiel #3
0
def get_peak_cross_sections(V, twod_p):


    cut_long = twod_p.get_cut_along_line(V[0], V[1])
    cut_short1 = twod_p.get_cut_along_line(V[3], V[2])
    cut_short2 = twod_p.get_cut_along_line(V[2], V[3])

    data1 = np.array(cut_short1.data)
    data2 = np.flip(np.array(cut_short2.data))
    data3 = np.hstack((data1, data2))
    shift = cut_short1.axis.data[1] + cut_short1.axis.data[-1]
    cut_short2.axis.data = cut_short2.axis.data + shift
    new_axis = np.hstack((cut_short1.axis.data, cut_short2.axis.data))
    qr_axis = qr.ValueAxis(0.0, len(new_axis), new_axis[1])
    short_final = qr.DFunction(qr_axis, data3)

    data_max = (np.amax(twod_p.data))/2

    long_p_1 = next(x for x, val in enumerate(cut_long.data) if val > (data_max)) 
    for_lp2 = np.flip(cut_long.data)
    long_p_2 = next(x for x, val in enumerate(for_lp2) if val > (data_max)) 
    long_width = cut_long.axis.data[-long_p_2-1] - cut_long.axis.data[long_p_1]


    short_p_1 = next(x for x, val in enumerate(short_final.data) if val > (data_max)) 
    for_sp2 = np.flip(short_final.data)
    short_p_2 = next(x for x, val in enumerate(for_sp2) if val > (data_max)) 
    short_width = short_final.axis.data[-short_p_2-1] - short_final.axis.data[short_p_1]

    fig, ax = plt.subplots(2)
    ax[0].plot(cut_long.axis.data, cut_long.data)
    ax[0].set_title('long')

    ax[1].plot(short_final.axis.data, short_final.data)
    ax[1].set_title('short')
    plt.show()

    return short_width, long_width
Beispiel #4
0
HH = m.get_Hamiltonian()
with qr.frequency_units("1/cm"):
    print(HH)
    a1.plot(axis=[11500, 12500, 0, numpy.max(a1.data) * 1.1])

save_load = False
if save_load:

    filename = "abs_1mol_20cm_100fs_100K_m20"
    with qr.frequency_units("1/cm"):
        a1.save(filename, ext="dat")

    with qr.frequency_units("1/cm"):

        f = qr.DFunction()

        f.load(filename, ext="dat", axis="frequency")

        f.plot()
"""

    Absorption of a simple dimer aggregate of two-level molecules


"""

ta = qr.TimeAxis(0.0, 2000, 5.0)

cfce_params1 = dict(ftype="OverdampedBrownian",
                    reorg=10.0,
Beispiel #5
0
        f.plot(show=False)
        plt.plot(x, ref_nexp(x, fitpar), "--g")
        plt.show()


#
# Time axis on which we will fit
#
t = qr.TimeAxis(0.0, 1000, 1.0)
x = t.data

#
# Mono-exponential function
#
fv = single_exp(x)
f = qr.DFunction(t, fv)

# parameters a, b and c of a*exp(-b*t) + c

inpar = [1.5, 1.0 / 100.0, 0.1]

# This is how we use the `fit_exponential` function
fitpar = f.fit_exponential(guess=inpar)

test_exponential(x, f, inpar, fitpar)

#
# Bi-exponential function
#
fv = double_exp(x)
f = qr.DFunction(t, fv)
Beispiel #6
0
                 label="Electronic coherence")
        plt.plot(timea.data,
                 numpy.abs(opt_cohS),
                 "-m",
                 label="Optical coherence")
        plt.legend()
        plt.title("Absolute value of coherences: site basis")
        plt.show()

    #
    # Exponential fit of population decay
    #
    if _fit_:

        if J != 0.0:
            pop_e_f = qr.DFunction(timea, pop_e)
            popt_p_e = pop_e_f.fit_exponential(guess=[0.5, 1.0 / 100, 0.3])
            pop_s_f = qr.DFunction(timea, pop_s)
            popt_p_s = pop_s_f.fit_exponential(guess=[0.5, 1.0 / 100, 0.3])
            if _show_plots_:
                # plot the fit
                with qr.eigenbasis_of(ham):

                    plt.plot(timea.data,
                             pop_e,
                             "-k",
                             label="Population of exciton 2")
                    plt.plot(
                        timea.data,
                        popt_p_e[0] * numpy.exp(-popt_p_e[1] * timea.data) +
                        popt_p_e[2],