Trying to make a script now, which is going to measure odmr over a range of frequencies. This should help to find the frequency, where the wire is most efficient.
In [7]:
import time
In [ ]:
def perform_odmr_measurement(self, freq_start, freq_step, freq_stop, power,
runtime, fit_function='Lorentzian',
save_after_meas=True, name_tag=''):
In [8]:
freq_range = 0.1 * 10**(9)
freq_step = 2 * 10**(6)
steps = 40
freq_sweep_start = 4.1*10**(9)
freq_sweep_stop = 9.0 * 10**(9)
power = -20
runtime = 120.0
freq_step2 = (freq_sweep_stop-freq_sweep_start)/steps
freq_list = [freq_sweep_start + i*freq_step2 for i in range(steps+1)]
mag_list = [(i-2.87*10**9)/(28*10**9) for i in freq_list]
y_data = []
x_data = []
In [6]:
freq_step/10**6
Out[6]:
In [9]:
for ii, freq in enumerate(freq_list):
save_data = {}
myscmagnet.move_abs({'rho': mag_list[ii]})
while magnet_logic._check_is_moving():
time.sleep(1)
confocal.refocus_clicked()
time.sleep(30)
# odmrlogic.perform_odmr_measurement(freq, freq_step, freq + freq_range, power, runtime, save_after_meas=False)
odmrlogic.mw_start = freq
odmrlogic.mw_step = freq_step
odmrlogic.mw_stop = freq + freq_range
odmrlogic.mw_power = power
odmrlogic.run_time = runtime
odmrlogic.start_odmr_scan()
while odmrlogic.getState() != 'idle':
time.sleep(1)
freq_vals = odmrlogic.ODMR_plot_x
sig_vals = odmrlogic.ODMR_plot_y
save_data['freq_vals'] = freq_vals
save_data['sig_vals'] = sig_vals
filepath = savelogic.get_path_for_module(module_name='ODMR')
filelabel = 'ODMR_FREQ_SWEEP_' + str(freq)
savelogic.save_data(save_data, filepath, filelabel=filelabel, as_text=True)
In [7]:
freq_start = 7.45 * 10**(9)
freq_step = 2 * 10**(6)
freq_stop = 7.55 * 10**(9)
power = -20
runtime = 60.0
name_tag = 'frequency_sweep'
In [8]:
save_data = {}
confocal.refocus_clicked()
time.sleep(30)
# odmrlogic.perform_odmr_measurement(freq, freq_step, freq + freq_range, power, runtime, save_after_meas=False)
odmrlogic.mw_start = freq_start
odmrlogic.mw_step = freq_step
odmrlogic.mw_stop = freq_stop
odmrlogic.mw_power = power
odmrlogic.run_time = runtime
odmrlogic.start_odmr_scan()
while odmrlogic.getState() != 'idle':
time.sleep(1)
freq_vals = odmrlogic.ODMR_plot_x
sig_vals = odmrlogic.ODMR_plot_y
save_data['freq_vals'] = freq_vals
save_data['sig_vals'] = sig_vals
filepath = savelogic.get_path_for_module(module_name='ODMR')
filelabel = 'ODMR_FREQ_SWEEP_1'
savelogic.save_data(save_data, filepath, filelabel=filelabel, as_text=True)
In [5]:
odmrlogic.ODMR_plot_x
Out[5]:
In [8]:
x = odmrlogic.ODMR_plot_x
y = odmrlogic.ODMR_plot_y
In [9]:
from matplotlib import pyplot
In [11]:
pyplot.plot(x,y)
pyplot.show()
In [12]:
result = fitlogic.make_lorentzian_fit(axis=x, data=y)
In [14]:
result.params.pretty_print()
In [38]:
myscmagnet.move_abs({'rho':0.078})
Out[38]:
In [ ]:
def refocus_clicked(self):
""" Start optimize position. """
self.disable_scan_actions()
# Get the current crosshair position to send to optimizer
crosshair_pos = self._scanning_logic.get_position()
self.sigStartOptimizer.emit(crosshair_pos, 'confocalgui')
In [39]:
confocal.refocus_clicked()
In [63]:
meas_param = {}
meas_param['ODMR frequency start (Hz)'] = [2]
meas_param['ODMR frequency step (Hz)'] = [3]
meas_param['ODMR frequency stop (Hz)'] = [4]
meas_param['ODMR power (dBm)'] = [5]
meas_param['ODMR run time (s)'] = [6]
In [64]:
filelabel = 'test'
In [65]:
filepath = savelogic.get_path_for_module(module_name='ODMR')
savelogic.save_data(meas_param, filepath, filelabel=filelabel, as_text=True)
In [48]:
odmrlogic.mw_stop
Out[48]:
In [52]:
odmrlogic.run_time, odmrlogic.mw_power, odmrlogic.mw_stop, odmrlogic.mw_step, odmrlogic.mw_start
Out[52]:
In [2]:
test_x = [i for i in range(9)]
test_y = [i**2 for i in test_x]
In [4]:
filepath = savelogic.get_path_for_module(module_name='ODMR')
filelabel = 'ODMR_FREQ_SWEEP_'
savelogic.save_data({'x': test_x}, filepath, filelabel=filelabel, as_text=True)
In [7]:
odmrlogic.ODMR_plot_y
Out[7]:
In [6]:
confocal.refocus_clicked()
while confocal.getState() != 'idle':
time.sleep(1)
print('wait until ready')
In [9]:
freq_step
Out[9]:
In [ ]: