date = datetime.datetime.today().strftime('%Y-%m-%d') file_path = "data\CSHE-Switching\{samp:}\{samp:}-SearchReset_{date:}.h5".format( samp=sample_name, date=date) exp = ResetSearchExperiment() exp.field.value = 0.007 exp.duration.value = 5e-9 exp.measure_current = 3e-6 amps = np.linspace(-0.95, 0.95, 75) amps = np.append(amps, np.flipud(amps)) exp.amplitudes = amps exp.init_streams() wr = WriteToHDF5(file_path) avg_sample = Averager('sample') fig1 = Plotter(name="Sample Averaged", plot_dims=1) edges = [(exp.voltage, avg_sample.sink), (avg_sample.final_average, wr.sink), (avg_sample.partial_average, fig1.sink)] exp.set_graph(edges) exp.init_progressbar(num=1) exp.run_sweeps() with h5py.File(wr.filename) as f: amps = f['amplitude'].value[:] reps = f['repeat'].value[:] Vs = f['data'].value['voltage'][:] Vs = Vs.reshape(reps.size, amps.size) Vs = Vs > (0.5 * (Vs.max() + Vs.min())) Vs = 2 * Vs - 1
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()
logger.info("Stream has filled {} of {} points".format( self.voltage.points_taken, self.voltage.num_points())) def shutdown_instruments(self): self.awg.output = False self.arb.stop() self.loop.remove_reader(self.alz.get_socket(self.ch)) for name, instr in self._instruments.items(): instr.disconnect() if __name__ == '__main__': exp = nTronSwitchingExperiment() plot = Plotter(name="Demod!", plot_mode="real", plot_dims=2) plot_ki = Plotter(name="Ki!", plot_mode="real", plot_dims=2) plot_avg = Plotter(name="Avg!", plot_mode="real") plot_raw1 = Plotter(name="Raw!", plot_mode="real", plot_dims=1) plot_raw2 = Plotter(name="Raw!", plot_mode="real", plot_dims=2) 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")