Exemple #1
0
    def run(self):

        for _ in range(500):
            time.sleep(0.01)
            data = np.zeros((100, 100))
            data[25:75, 25:75] = 1.0
            data = data + 25 * np.random.random((100, 100))
            self.voltage.push(data.flatten())


if __name__ == '__main__':

    exp = TestExperiment()
    avg = Averager("repeats", name="Averager")
    pl1 = Plotter(name="Partial",
                  plot_dims=2,
                  plot_mode="real",
                  palette="Spectral11")
    pl2 = Plotter(name="Final",
                  plot_dims=2,
                  plot_mode="real",
                  palette="Spectral11")

    edges = [(exp.voltage, avg.sink), (avg.partial_average, pl1.sink),
             (avg.source, pl2.sink)]

    avg.update_interval = 0.2
    pl1.update_interval = 0.2
    pl2.update_interval = 0.2

    exp.set_graph(edges)
    exp.init_instruments()
    async def run(self):
        """This is run for each step in a sweep."""
        await self.resistance.push(self.keith.resistance)
        logger.debug("Stream has filled {} of {} points".format(
            self.resistance.points_taken, self.resistance.num_points()))
        await asyncio.sleep(0.02)  # Give the filters some time to catch up?

    def shutdown_instruments(self):
        self.keith.current = 0.0e-5
        self.mag.zero()


if __name__ == '__main__':
    sample_name = "CSHE-W4-DieC7R4-DevC4R7"
    date = datetime.datetime.today().strftime('%Y-%m-%d')
    file_path = "data\CSHE-Switching\{samp:}\{samp:}-FieldSwitch_{date:}.h5".format(
        samp=sample_name, date=date)

    exp = FieldSwitchingExperiment()
    wr = WriteToHDF5(file_path)
    plt = Plotter()

    edges = [(exp.resistance, wr.sink), (exp.resistance, plt.sink)]
    exp.set_graph(edges)

    fields = np.linspace(-0.002, 0.002, 10)
    fields = np.append(fields, np.flipud(fields))
    main_sweep = exp.add_sweep(exp.field, fields)
    exp.run_sweeps()
Exemple #3
0
    exp = TestExperiment()
    channelizer = Channelizer(frequency=10e6,
                              bandwidth=5e6,
                              decimation_factor=8,
                              name="Demod")
    ki = KernelIntegrator(kernel="",
                          bias=0,
                          simple_kernel=True,
                          box_car_start=0,
                          box_car_stop=64e-9,
                          frequency=0,
                          name="KI")
    avg1 = Averager("round_robins", name="Average channelizer RRs")
    avg2 = Averager("round_robins", name="Average KI RRs")
    pl1 = Plotter(name="2D Scope", plot_dims=2, palette="Spectral11")
    pl2 = Plotter(name="Demod",
                  plot_dims=2,
                  plot_mode="quad",
                  palette="Spectral11")
    pl3 = Plotter(name="KI", plot_dims=1, plot_mode='real')
    # pl4 = Plotter(name="KI", plot_dims=2, palette="Spectral11")

    edges = [(exp.voltage, channelizer.sink), (channelizer.source, avg1.sink),
             (channelizer.source, ki.sink), (ki.source, avg2.sink),
             (avg1.final_average, pl2.sink), (avg2.final_average, pl3.sink)]

    exp.set_graph(edges)

    exp.init_instruments()
    exp.add_sweep(exp.freq, 1e6 * np.linspace(-0.1, 0.1, 3))
Exemple #4
0
    def __repr__(self):
        return "<SweptTestExperiment>"

    def run(self):
        logger.debug("Data taker running (inner loop)")
        time_step = 0.02
        time.sleep(0.02)
        self.time_val += time_step
        self.voltage.push(self.amp.value*np.cos(2*np.pi*self.time_val) + 0.01*np.random.random())
        self.current.push(self.amp.value*np.sin(2*np.pi*self.time_val) + 0.01*np.random.random())
        logger.debug("Stream has filled {} of {} points".format(self.voltage.points_taken, self.voltage.num_points() ))


if __name__ == '__main__':

    exp = TestExperiment()
    plt = Plotter(name="Normal Plotter")
    plt_xy = XYPlotter(name="XY Test", x_series=True, series="inner")
    # plt_xy = XYPlotter(name="XY Test")

    edges = [(exp.current, plt_xy.sink_x),
             (exp.voltage, plt_xy.sink_y),
             (exp.voltage, plt.sink)]

    exp.set_graph(edges)
    exp.add_sweep(exp.amp, [1,1.2,1.3])
    # exp.amp.value = 1.0
    exp.add_sweep(exp.field, np.linspace(0,100.0,10))
    exp.run_sweeps()