async def run(self): """This is run for each step in a sweep.""" await asyncio.sleep(self.delay) await self.resistance.push(self.res_reference / ((self.lock.amp / self.lock.mag) - 1.0)) def shutdown_instruments(self): self.mag.zero() self.lock.amp = 0 if __name__ == '__main__': sample_name = "Hypress_3_2_COSTM3" date = datetime.datetime.today().strftime('%Y-%m-%d') file_path = "data\CRAM01\{samp:}\{samp:}-FieldSwitch_{date:}.h5".format( samp=sample_name, date=date) exp = FieldSwitchingLockinExperiment() wr = WriteToHDF5(file_path) plt = Plotter() edges = [(exp.resistance, wr.sink), (exp.resistance, plt.sink)] exp.set_graph(edges) fields = np.linspace(-0.4, 0.4, 200) fields = np.append(fields, np.flipud(fields)) main_sweep = exp.add_sweep(exp.field, fields) exp.run_sweeps()
if __name__ == '__main__': exp = BERExperiment() exp.sample = "CSHE5 - C2R3" exp.comment = "Switching Bit Error Rate - AP to P - 5ns" exp.polarity = 1 # 1: AP to P; -1: P to AP exp.field.value = 0.0081 exp.attempts.value = 1 << 11 exp.pulse_duration.value = 5e-9 # Fixed exp.reset_amplitude = 0.7 exp.reset_duration = 5e-9 exp.pspl_atten = 5 exp.init_instruments() wr = WriteToHDF5( "data\CSHE-Switching\CSHE-Die5-C2R3\\test\CSHE5-C2R3-AP2P_2016-07-27_BER_5ns.h5" ) edges = [(exp.voltage, wr.data)] exp.set_graph(edges) V0 = 0.5 voltages_list = V0 * np.linspace(1.0, 1.8, 5) voltages_list = voltages_list[voltages_list < 1.1] # For safety t1 = [] # Keep track of time t2 = [] max_points = 1 << 13 finish = False for volt in voltages_list: if finish: break
demod = Channelizer(frequency=exp.measure_frequency, decimation_factor=4, bandwidth=20e6) ki = KernelIntegrator(kernel=0, bias=0, simple_kernel=True, box_car_start=1e-7, box_car_stop=3.8e-7, frequency=0.0) avg = Averager(axis="attempt") samp = "c1r4" file_path = f"data\\nTron-Switching\\{samp}\\{samp}-PulseSwitchingShort-{datetime.datetime.today().strftime('%Y-%m-%d')}.h5" # file_path = f"data\\nTron-Switching\\{samp}\\{samp}-PulseSwitching-{datetime.datetime.today().strftime('%Y-%m-%d-%H-%M')}.h5" wr_int = WriteToHDF5(file_path, groupname="Integrated", store_tuples=False) wr_final = WriteToHDF5(file_path, groupname="Final", store_tuples=False) wr_raw = WriteToHDF5(file_path, groupname="Raw", store_tuples=False) edges = [ (exp.voltage, demod.sink), # (exp.voltage, wr_raw.sink), (exp.voltage, plot_raw1.sink), # (exp.voltage, plot_raw2.sink), (demod.source, ki.sink), # (ki.source, plot_ki.sink), (ki.source, avg.sink), (ki.source, wr_int.sink), (avg.final_average, plot_avg.sink), (demod.source, plot.sink), ]
if __name__=='__main__': exp = SwitchSearchLockinExperiment() exp.sample = "CSHE2-C4R2" exp.field.value = 0.0133 exp.measure_current = 3e-6 exp.init_streams() volts = np.arange(-0.7, -0.1, 0.1) volts = np.append(volts, -1*np.flipud(volts)) volts = np.append(-volts, np.flipud(volts)) durs = 1e-9*np.array([3,5]) exp.add_sweep(exp.pulse_voltage, volts) exp.add_sweep(exp.pulse_duration, durs) # Set up measurement network wr = WriteToHDF5("data\CSHE-Switching\CSHE-Die2-C4R2\CSHE2-C4R2-Search_Switch_2016-06-30.h5") # pbar = ProgressBar(num=2) # edges = [(exp.voltage, wr.data), (exp.voltage, pbar.data)] edges = [(exp.voltage, wr.data)] exp.set_graph(edges) exp.init_instruments() exp.run_sweeps() exp.shutdown_instruments() # Get data f = h5shell(wr.filename,'r') dset= f[f.grep('data')[-1]] buffers = dset.value f.close() # Plot the result buff_mean = np.mean(buffers, axis=(2,3))
exp.polarity = 1 # -1: AP to P; 1: P to AP exp.iteration = 2 exp.reset_amplitude = 0.2 exp.reset_duration = 5e-9 coarse_ts = np.linspace(1, 2, 3) * 1e-9 coarse_vs = np.linspace(0.4, 0.6, 3) points = [coarse_ts, coarse_vs] points = np.array(list(itertools.product(*points))) exp.pulse_durations = points[:, 0] exp.pulse_voltages = points[:, 1] exp.field.value = -0.0074 exp.measure_current = 0e-6 exp.init_instruments() wr = WriteToHDF5( "data\CSHE-Switching\CSHE-Die5-C1R3\CSHE5-C1R3_nTron_P2AP_2016-07-15.h5" ) edges = [(exp.voltage, wr.data)] exp.set_graph(edges) main_sweep = exp.add_unstructured_sweep( [exp.pulse_duration, exp.pulse_voltage], points) figs = [] t1 = time.time() for i in range(exp.iteration): exp.reset() exp.run_sweeps() points, mean = sw.load_switching_data(wr.filename) figs.append( sw.phase_diagram_mesh(points, mean, title="Iteration={}".format(i)))