Beispiel #1
0
    def ControlColumn(self):
        # Banner
        image = sipw.image_widget("assets/pynq_logo.png")

        # Return required controls as one column
        return ipw.VBox([
            image,
            self.TransmitterSetup(),
            self.ReceiverSetup(),
            self.WindowSetup()
        ],
                        layout=ipw.Layout(width='auto'))
Beispiel #2
0
    def AnalysisColumn(self):
        def peak_detect(change):
            self.SpecPlot._peakdetect = change['new']
            self.SpecPlot._plot_spectrum.data[1].visible = change['new']
            self.peak_flag = change['new']

        def update_spectrum_timer(value):
            self.TimerSpectrum = DmaTimer(self.update_voila,
                                          self.DataInspector.get_buffer_frame,
                                          value['new'])
            self.spectrogram_timer_slider.min = value['new']

        def update_spectrogram_timer(value):
            self.TimerSpectrogram = Timer(self.SpecPlot.add_frame_spectrogram,
                                          value['new'])

        def update_buffer(value):
            self.SpecPlot._buf = value['new']

        def update_range(value):
            self.SpecPlot._plot_spectrum.layout.yaxis.range = value['new']
            self.SpecPlot._plot_spectrogram.data[0].zmin = value['new'][0]
            self.SpecPlot._plot_spectrogram.data[0].zmax = value['new'][1]

        def updateAvg(value):
            self.SpecPlot._avg_window = np.full((value['new'], 2048),
                                                self.SpecPlot._data)

        image = sipw.image_widget("assets/strathclyde_logo.png")

        peak_toggle = sipw.check_box_widget('Peak Detection', False)

        style = {'description_width': 'initial'}
        self.peak_x = ipw.FloatText(value=0.0,
                                    description='x:',
                                    disabled=True,
                                    layout=ipw.Layout(width='auto'),
                                    style=style)
        self.peak_y = ipw.FloatText(value=0.0,
                                    description='y:',
                                    disabled=True,
                                    layout=ipw.Layout(width='auto'),
                                    style=style)

        self.spectrum_timer_slider = sipw.float_slide_widget(
            'Spectrum Timer:', 1 / 8, 1 / 8, 1 / 4, 1 / 4)
        self.spectrogram_timer_slider = sipw.float_slide_widget(
            'Spectrogram Timer:', 1 / 8, 1 / 8, 1 / 4, 1 / 4)
        spectrogram_buffer_slider = sipw.int_slide_widget(
            'Spectrogram Buffer:', 2, 1, 20, 1)
        plot_magnitude_range = sipw.int_range_widget('Range:', [-140, 0], -160,
                                                     0, 1)
        frame_avg = sipw.int_slide_widget('Frame Average: ', 1, 1, 32, 1)

        peak_toggle.observe(peak_detect, names='value')
        self.spectrum_timer_slider.observe(update_spectrum_timer,
                                           names='value')
        self.spectrogram_timer_slider.observe(update_spectrogram_timer,
                                              names='value')
        spectrogram_buffer_slider.observe(update_buffer, names='value')
        plot_magnitude_range.observe(update_range, names='value')
        frame_avg.observe(updateAvg, names='value')

        peak = sipw.accordion_widget('Peak Detection',
                                     [peak_toggle, self.peak_x, self.peak_y])
        plot_update = sipw.accordion_widget('Plot Settings', [
            self.spectrum_timer_slider, self.spectrogram_timer_slider,
            spectrogram_buffer_slider, plot_magnitude_range, frame_avg
        ])

        return ipw.VBox([image, plot_update, peak],
                        layout=ipw.Layout(width='auto'))