Exemplo n.º 1
0
    def script(self, conn, param_1, param_2, param_3, param_4):
        """
        function that contains our experimental script
        We use four parameters to modify the script in GUI
        Param_1 - number of points
        Param_2 - time between consecutive points
        Param_3 - noise level in dummy data
        Param_4 - blank
        """
        import atomize.general_modules.general_functions as general
        # firstly import general module to be able to plot data
        # Plot_xy script, dummy data
        start_time = time.time()

        xs = np.array([])
        ys = np.array([])
        i = 0
        # always test our self.command attribute for stopping the script when neccessary
        while i < param_1 and self.command != 'exit':
            # poll() checks whether there is data in the Pipe to read
            # we use it to stop the script if the exit command was sent from the main window
            # we read data by conn.recv() only when there is the data to read
            if conn.poll() == True:
                self.command = conn.recv()
            # script loop
            xs = np.append(xs, i)
            ys = np.append(ys, np.random.randint(0, param_3 + 1))
            general.plot_1d('Plot XY Test', xs, ys, label='test data')
            general.wait(str(param_2) + ' ms')
            i = i + 1
        general.message(str(time.time() - start_time))
Exemplo n.º 2
0
                channel='MW',
                start='100 ns',
                length='10 ns',
                length_increment='2 ns')
pb.pulser_pulse(name='P1', channel='MW', start='600 ns', length='50 ns')
pb.pulser_pulse(name='P2', channel='MW', start='950 ns', length='100 ns')
pb.pulser_pulse(name='P3', channel='TRIGGER', start='1300 ns', length='100 ns')

pb.pulser_repetitoin_rate('500 Hz')

for i in range(POINTS):

    pb.pulser_update()

    t3034.oscilloscope_start_acquisition()
    area_x = t3034.oscilloscope_area('CH4')
    area_y = t3034.oscilloscope_area('CH3')

    data_x[i] = area_x
    data_y[i] = area_y

    general.plot_1d('Nutation', x_axis, data_x, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'X')

    general.plot_1d('Nutation', x_axis, data_y, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'Y')

    pb.pulser_increment()

pb.pulser_stop()
Exemplo n.º 3
0
    i = 0
    while i < POINTS:

        pb.pulser_update()

        t3034.oscilloscope_start_acquisition()
        area_x = t3034.oscilloscope_area('CH4')
        area_y = t3034.oscilloscope_area('CH3')

        cycle_data_x[i] = area_x
        cycle_data_y[i] = area_y

        pb.pulser_shift('P3', 'P4')

        general.plot_1d('DEER_Cycle', x_axis, cycle_data_x, xname = 'Delay',\
            xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'X')
        general.plot_1d('DEER_Cycle', x_axis, cycle_data_y, xname = 'Delay',\
            xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'Y')

        i += 1

    data_x = (data_x * (k - 1) + cycle_data_x) / k
    data_y = (data_y * (k - 1) + cycle_data_y) / k

    general.plot_1d('DEER_All', x_axis, data_x, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'X')
    general.plot_1d('DEER_All', x_axis, data_y, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'Y')

    pb.pulser_reset()
Exemplo n.º 4
0
pb.pulser_pulse(name ='P2', channel = 'TRIGGER', start = '800 ns', length = '100 ns')

pb.pulser_repetitoin_rate('500 Hz')
pb.pulser_update()

i = 0
field = START_FIELD
while field <= END_FIELD:

    bh15.magnet_field(field)
    general.message( str(field) )

    t3034.oscilloscope_start_acquisition()
    area_x = t3034.oscilloscope_area('CH4')
    area_y = t3034.oscilloscope_area('CH3')

    data_x[i] = area_x
    data_y[i] = area_y

    general.plot_1d('Echo Detected Spectrum', x_axis, data_x, xname = 'Field',\
        xscale = 'T.', yname = 'Area', yscale = 'V*s', label = 'X')
    general.plot_1d('Echo Detected Spectrum', x_axis, data_y, xname = 'Field',\
        xscale = 'T.', yname = 'Area', yscale = 'V*s', label = 'Y')

    field += FIELD_STEP
    i += 1

bh15.magnet_field(START_FIELD)

pb.pulser_stop()
Exemplo n.º 5
0
# Plot_xy Test
for i in range(50):
    start_time = time.time()
    #ys = np.append(ys, np.random.rand(1,1))
    #ys2 = np.append(ys2, 1)
    #ys3 = np.append(ys3, np.random.rand(1,1))
    #ys4 = np.append(ys4, 0)
    #now = time.time()
    #timestamp = datetime.timestamp(now)
    #xs = np.append(xs, now)
    xs = np.append(xs, i)
    #general.message(xs)
    ys = np.append(ys, np.random.randint(0, 10 + 1));
    #ys[i] = np.random.randint(0, 10 + 1);
    general.plot_1d('Plot XY Test', xs, ys, label='test data4', timeaxis = 'False')
    #general.plot_1d('Plot XY Test', xs, ys2, label='test data2')
    #general.plot_1d('Plot XY Test', xs, ys3, label='test data3')
    #general.plot_1d('Plot XY Test', xs, ys4, label='test data4')
    general.wait('10 ms')
    general.message(str(time.time() - start_time))
    

#general.plot_remove('Plot XY Test')

# Append_y Test
#xs = np.linspace(0, 5, 1000)
#xs = time.time()
#general.wait('1000 ms')
#xs2 = time.time()
#for i in range(1000):
Exemplo n.º 6
0
    j = 0
    while j < 4:

        pb.pulser_next_phase()

        t3034.oscilloscope_start_acquisition()
        area_x = t3034.oscilloscope_area('CH4')
        area_y = t3034.oscilloscope_area('CH3')

        cycle_data_x.append(area_x)
        cycle_data_y.append(area_y)

        j += 1
    
    # acquisition cycle [+, -, -, +]
    data_x[i] = (cycle_data_x[0] - cycle_data_x[1] - cycle_data_x[2] + cycle_data_x[3])/4
    data_y[i] = (cycle_data_y[0] - cycle_data_y[1] - cycle_data_y[2] + cycle_data_y[3])/4

    general.plot_1d('ESEEM', x_axis, data_x, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', timeaxis = 'False', label = '16-16-16-phase')
    general.plot_1d('ESEEM', x_axis, data_y, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', timeaxis = 'False', label = '16-16-16-phase-y')

    pb.pulser_shift()

    cycle_data_x = []
    cycle_data_y = []

pb.pulser_stop()

Exemplo n.º 7
0
import time
import numpy as np
import atomize.general_modules.general_functions as general
import atomize.math_modules.least_square_fitting_modules as math_modules
import atomize.general_modules.csv_opener_saver_tk_kinter as openfile

open1d = openfile.Saver_Opener()

y = np.array([100,30,10,3,1,0.3,0.1,0.03,0,0.01,0.01]);
#print(data[1:]-data[0])
data = np.asarray([[0,1,2,3,4,5,6,7,8,9,10],y/1000,y])

#open1d.open_2D_appended_dialog(directory='/home/anatoly/Atomize/atomize/tests', header=0,chunk_size=11)
one_exp = math_modules.math()

model_data, residuals, r_squared = one_exp.one_exp_fit(data,[10,1,0])
print(residuals[1])

general.plot_1d('1D Plot', data[0], model_data[1], label='line', yname='Y axis', yscale='V', scatter='False')
general.plot_1d('1D Plot', data[0], residuals[1], label='scatter', yname='Y axis', yscale='V', scatter='True')

general.wait('500 ms')

x = 0 

if x < 5:
	general.message('hi')
	general.wait('100 ms')

Exemplo n.º 8
0
    # for heating the indicated amount of time
    now = round(time.time())

    xs = np.append(xs, i)
    temp1 = tdat11m6.tc_temperature('1') - 273.1
    temp2 = tdat11m6.tc_temperature('2') - 273.1
    temp3 = tdat11m6.tc_temperature('3') - 273.1
    temp4 = tdat11m6.tc_temperature('4') - 273.1

    ys1 = np.append(ys1, temp1)
    ys2 = np.append(ys2, temp2)
    ys3 = np.append(ys3, temp3)
    ys4 = np.append(ys4, temp4)

    general.plot_1d('Plot 1', xs, ys1, label='ch1')
    general.plot_1d('Plot 2', xs, ys2, label='ch2')
    general.plot_1d('Plot 3', xs, ys3, label='ch3')
    general.plot_1d('Plot 4', xs, ys4, label='ch4')

    if flag1 == 0 and (temp1 > 350 or temp2 > 350 or temp3 > 350
                       or temp4 > 350):
        temp_reached = round(time.time())
        flag1 = 1
        general.message('Target temperature has been reached')

    if flag2 == 0 and flag1 == 0:
        pass
    elif flag2 == 0 and flag1 == 1:
        if abs(now - temp_reached) > heat_time:
            flag2 = 1
Exemplo n.º 9
0
    while j < 2:

        pb.pulser_next_phase()

        t3034.oscilloscope_start_acquisition()
        area_x = t3034.oscilloscope_area('CH4')
        area_y = t3034.oscilloscope_area('CH3')

        cycle_data_x.append(area_x)
        cycle_data_y.append(area_y)

        j += 1

    # acquisition cycle [+, -]
    data_x[i] = (cycle_data_x[0] - cycle_data_x[1]) / 2
    data_y[i] = (cycle_data_y[0] - cycle_data_y[1]) / 2

    general.plot_1d('DEER_Phase_2', x_axis, data_x, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'X')
    general.plot_1d('DEER_Phase_2', x_axis, data_y, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', label = 'Y')

    pb.pulser_shift()

    cycle_data_x = []
    cycle_data_y = []

    i += 1

pb.pulser_stop()
Exemplo n.º 10
0
    if test_flag != 'test':
        path_to_file_1D = os.path.join('/home/lmr-pc/Experimental_Data/Auto/', str(timenow) + '_Step_1' + '.csv')
        file_save_1D = open(path_to_file_1D, 'a')
    elif test_flag == 'test':
        pass

    temperature = ls335.tc_temperature('B')
    freq = ag53131a.freq_counter_frequency('CH3')/1000000

    while field <= end_field:
        #general.wait(sr830.lock_in_time_constant())
        x_axis = np.append(x_axis, field)
        signal = np.append(signal, sr830.lock_in_get_data())
        if (i % 2) == 0:
            if len(signal) % 5 == 0:
                general.plot_1d('CW_Spectrum', x_axis, signal, xname='Magnetic Field',\
                	xscale='G', yname='Signal Intensity', yscale='V', label='Even')
            else:
                pass
        elif (i % 2) == 1:
            if len(signal) % 5 == 0:
                general.plot_1d('CW_Spectrum', x_axis, signal, xname='Magnetic Field',\
                    xscale='G', yname='Signal Intensity', yscale='V', label='Odd')
            else:
                pass

        field = field + step_field
        bh15.magnet_field(field)

    head = 'Date: ' + str(timenow) + '\n' + 'Start field: ' + str(start_field) + '\n' + \
         'End field: ' + str(end_field) + '\n' + 'Field step: ' + str(step_field) + '\n' \
         'Modulation amplitude: ' + str(lock_in_amplitude) + ' V\n' + 'Time constant: ' + str(lock_in_time_constant) + '\n' + \
Exemplo n.º 11
0

    if k % 2 == 1:
        general.message('HERE')
        pb.pulser_next_phase()
    elif k % 2 == 0:
        general.message('THERE')
        pb.pulser_next_phase()
        pb.pulser_next_phase()

    i = 0
    while i < 200:

        pb.pulser_update()
        pb.pulser_shift('P3','P4')
        pb.pulser_visualize()
        general.wait('200 ms')
        i += 1

    general.plot_1d('DEER_All', x_axis, data, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', timeaxis = 'False', label = 'X')
    general.plot_1d('DEER_All', x_axis, data_y, xname = 'Delay',\
        xscale = 'ns', yname = 'Area', yscale = 'V*s', timeaxis = 'False', label = 'Y')
    
    pb.pulser_reset()


    k += 1


pb.pulser_stop()