Exemplo n.º 1
0
    def prepare_waveform(self,
                         seq_setpoints=None,
                         seq_name=None,
                         seq_label=None,
                         seq_unit=None):
        """
        Prepare the scope for returning waveform data
        """
        # To calculate set points, we must have the full preamble
        # For the instrument to return the full preamble, the channel
        # in question must be displayed

        # shorthand
        instr = self._instrument

        # acquire waveform description
        instr.write("{}:WF? DESC".format(self._channel_id))
        wavedesc = instr._parent._read_ieee_block()

        # extract Time setpoints info
        self.Nsamples, = struct.unpack_from('l', wavedesc, 116)
        self.Nseqs, = struct.unpack_from('l', wavedesc, 144)
        self.horz_dt, self.horz_offset = struct.unpack_from(
            'fd', wavedesc, 176)
        self.Npts = int(self.Nsamples / self.Nseqs)
        self.time_setpoints = tuple(self.horz_offset +
                                    self.horz_dt * np.arange(self.Npts))

        # set setpoints info
        if ((seq_setpoints is not None)
                and (len(seq_setpoints) != self.Nseqs)):
            raise ValueError('Length of seq_setpoints {} does \
                              not match number of sequences {}'.format(
                len(seq_setpoints), self.Nseqs))
        self.seq_setpoints = (tuple(seq_setpoints) if seq_setpoints else tuple(
            range(self.Nseqs)))

        if seq_name is not None:
            self.setpoint_names = (seq_name, 'Time')

        if seq_unit is not None:
            self.setpoint_units = (seq_unit, 's')

        if seq_label is not None:
            self.setpoint_labels = (seq_label,
                                    f'{self._channel_id} time series')

        self.setpoints = setpoint_generator(self.seq_setpoints,
                                            self.time_setpoints)
        self.shape = (self.Nseqs, self.Npts)

        # make this on a per channel basis?
        self._instrument._parent.trace_ready = True
Exemplo n.º 2
0
        def __init__(self, name, instrument):
            self.start = 0
            self.stop = 2e6
            self.npts = (100, 50, 20)
            sp1 = np.linspace(self.start, self.stop, self.npts[0])
            sp2 = np.linspace(self.start, self.stop, self.npts[1])
            sp3 = np.linspace(self.start, self.stop, self.npts[2])
            setpoints = setpoint_generator(sp1, sp2, sp3)

            super().__init__(name=name,
                             instrument=instrument,
                             setpoints=setpoints,
                             shape=(100, 50, 20),
                             label='Flower Power Spectrum in 3D',
                             unit='V/sqrt(Hz)',
                             setpoint_names=('Frequency0', 'Frequency1',
                                             'Frequency2'),
                             setpoint_units=('Hz', 'Other Hz', "Third Hz"))
Exemplo n.º 3
0
        def __init__(self, name, instrument, **kwargs):
            self.start = 0
            self.stop = 2e6
            self.npts = (100, 50, 20)
            sp1 = np.linspace(self.start, self.stop, self.npts[0])
            sp2 = np.linspace(self.start, self.stop, self.npts[1])
            sp3 = np.linspace(self.start, self.stop, self.npts[2])
            setpoints = setpoint_generator(sp1, sp2, sp3)

            super().__init__(
                name=name,
                instrument=instrument,
                setpoints=setpoints,
                shape=(100, 50, 20),
                label="Flower Power Spectrum in 3D",
                unit="V/sqrt(Hz)",
                setpoint_names=("Frequency0", "Frequency1", "Frequency2"),
                setpoint_units=("Hz", "Other Hz", "Third Hz"),
                **kwargs,
            )