Skip to content

Add new functions to Yokogawa driver #184

@heevasti

Description

@heevasti

Is your feature request related to a problem? Please describe.
The QMI driver for Yokogawa does not seem to be able to obtain trace data, only copying files after a measurement. And event that requires the Yokogawa be mounted as a flash drive through USB. It would be good to add an option that also makes it possible to obtain trace data during a measurement through the ethernet connection.

Describe the solution you'd like
The following new RPC method was tested to return requested trace data in ASCII format:

    @rpc_method
    def send_waveform(self, channels: list[int]):
        """
        Returns the onscreen traces from specified channels in the form on a 2D numpy array. Data is streamed via ethernet
        in the 'ascii' format.

        Parameters:
            channels:           A list of the channels to return data from
            data_type:          What format to send the data in

        Returns:
            traces:             An array where each row is a channel trace. Channel order correspond to 'channels' parameter 
        """
        # Expected length of each trace
        num_points = self.get_number_data_points()

        # Initialize data array
        traces = np.zeros((len(channels), num_points))

        # Stop to acquire data
        self._scpi_protocol.write(":STOP")

        # Set data type (could also be binary, but then must adjust how 'resp' is processed below)
        self._scpi_protocol.write(":WAVeform:FORMat ASCII")

        # For each channel
        for i, val in enumerate(channels):
            # Set which channel to get data from
            self._scpi_protocol.write(f":WAVeform:TRACE {val}")
            # Transfer data from the stopped acquisition
            resp = self._scpi_protocol.ask(":WAVeform:SEND?")
            traces[i] = np.array([float(x) for x in resp.split(',')])

        # Start continuous acquisition again
        self._scpi_protocol.write(":START")
        return traces

So we want to implement a call that returns trace data for each channel defined in the input.

Describe alternatives you've considered
It sh|could be refined to:
a) Have a more descriptive name like get_waveform_data or get_waveform or get_trace_data or such.
b) We could create separate calls for setting the data type and setting the waveform trace channel, which then would be called within the above call.
c) Setting the data type is probably not necessary to be in the call, as the format will be permanent after being set once, unless someone | something changes it. It should suffice in a script to call this once before calling to obtain data.

Acceptance criteria
The updated driver works also on hardware.

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions