Beispiel #1
0
def _spectrum(a, b):
    def func(x, y, a, b):

        Delta = b
        #omega = 2.0*3.14159/20.0

        data = numpy.zeros((len(x), len(y)))

        for i_x in range(len(x)):
            data[i_x, :] = a*numpy.exp(-(x[i_x]/Delta)**2)* \
                             numpy.exp(-(y/Delta)**2)
            data[i_x, :] -= (a/2.0)*numpy.exp(-(x[i_x]/Delta)**2)* \
                             numpy.exp(-((y-Delta)/Delta)**2)

        return data

    xrange = qr.FrequencyAxis(-50.0, 100, 1.0)
    yrange = qr.FrequencyAxis(-50.0, 100, 1.0)

    data = func(xrange.data, yrange.data, a, b)

    return (xrange, yrange, data)
Beispiel #2
0
def step_given_16(context, N, step):
    """

        And I have a FrequencyAxis of lenght {N} starting from zero with certain {step}

    """
    length = int(N)
    step = float(step)
    vaxis = qr.FrequencyAxis(0.0, length, step)

    context.vaxis = vaxis
    context.length = length
    context.step = step
Beispiel #3
0
def get_spectrum_from_data(xax, yax, data, timestamp):

    x_ax_n = len(xax)
    x_ax_start = xax[0]
    x_ax_fin = xax[-1]
    x_ax_len = x_ax_fin - x_ax_start
    x_ax_step = x_ax_len / x_ax_n
    x_ax = qr.FrequencyAxis(x_ax_start, x_ax_n, x_ax_step)

    y_ax_n = len(yax)
    y_ax_start = yax[0]
    y_ax_fin = yax[-1]
    y_ax_len = y_ax_fin - y_ax_start
    y_ax_step = y_ax_len / y_ax_n
    y_ax = qr.FrequencyAxis(y_ax_start, y_ax_n, y_ax_step)

    onetwod = qr.TwoDResponse()
    onetwod.set_axis_1(x_ax)
    onetwod.set_axis_3(y_ax)
    onetwod._add_data(data, resolution="off")
    onetwod.set_t2(timestamp)

    return onetwod
Ns = [100, 101]

print("\nStarting with TimeAxis:")
for N in Ns:
    print("\nN =", N)
    tmaxs1 = qr.TimeAxis(0.0, N, 10.0)
    print("TimeAxis type       :", tmaxs1.atype)
    print("start, length, step :", tmaxs1.start, tmaxs1.length, tmaxs1.step)
    fraxs1 = tmaxs1.get_FrequencyAxis()
    print("FrequencyAxis type  :", fraxs1.atype)
    print("start, length, step :", fraxs1.start, fraxs1.length, fraxs1.step)

print("Starting with FrequencyAxis:")
for N in Ns:
    print("\nN =", N)
    fraxs2 = qr.FrequencyAxis(0.0, N, 0.01)
    print("FrequencyAxis type  :", fraxs2.atype)
    print("start, length, step :", fraxs2.start, fraxs2.length, fraxs2.step)
    tmaxs2 = fraxs2.get_TimeAxis()
    print("TimeAxis type       :", tmaxs2.atype)
    print("start, length, step :", tmaxs2.start, tmaxs2.length, tmaxs2.step)

print("\n")
print("Non-default behaviour")
print("---------------------")

print("\nStarting with TimeAxis of `complete` type:")
for N in Ns:
    print("\nN =", N)
    tmaxs1 = qr.TimeAxis(0.0, N, 10.0, atype="complete")
    print("TimeAxis type       :", tmaxs1.atype)
Beispiel #5
0
"""
Usage of finite transform limited pulses


"""
import quantarhei as qr
import matplotlib.pyplot as plt

lab = qr.LabSetup()
freq = qr.FrequencyAxis(-2500, 1000, 5.0)
pulse2 = dict(ptype="Gaussian", FWHM=800.0, amplitude=1.0)
params = (pulse2, pulse2, pulse2)
lab.set_pulse_shapes(freq, params)

freq2 = qr.FrequencyAxis(-1000, 100, 20.0)

dfc1 = lab.get_pulse_spectrum(1, freq.data)
dfc2 = lab.get_pulse_spectrum(1, freq2.data)
pl1 = plt.plot(freq.data, dfc1)
pl2 = plt.plot(freq2.data, dfc2)
plt.show()