# :WAVeform:YFORmat:WORD:YDATa?

:WAVeform Y-Format Commands

- :WAVeform:YFORmat:ASCii:YDATa?
- :WAVeform:YFORmat:DOUBle:YDATa?
- :WAVeform:YFORmat:FLOat:YDATa?
- :WAVeform:YFORmat:IBLock:DOUBle:YDATa?
- :WAVeform:YFORmat:IBLock:FLOat:YDATa?
- :WAVeform:YFORmat:POINts?
- :WAVeform:YFORmat:WORD:ENCoding:CHIGh?
- :WAVeform:YFORmat:WORD:ENCoding:CLOW?
- :WAVeform:YFORmat:WORD:ENCoding:HOLE?
- :WAVeform:YFORmat:WORD:ENCoding:YINCrement?
- :WAVeform:YFORmat:WORD:ENCoding:YORigin?
- :WAVeform:YFORmat:WORD:YDATa?
- :WAVeform:YFORmat:XINCrement?
- :WAVeform:YFORmat:XORigin?

## Query Syntax

    :WAVeform:YFORmat:WORD:YDATa? [<starting_point_index>,[<number_of_points>]]

<starting_point_index>
  Optional zero-based integer that is the starting point index.
<number_of_points>
  Optional integer that is the number of point values to return. When using this parameter, the `<starting_point_index>` parameter is required. If this parameter is not used, it means the number of points to the end of the record.

## Description

Returns the amplitude (Y-axis) data point values as 16-bit integers which is useful for long patterns where the time required to return floating-point data would be too long and the precision is not required. If measurement resolution is more important than fast transfer time, use the `:WAVeform:YFORmat:FLOat:YDATa?` query instead.

Use the `:WAVeform:SOURce` command to select data from a channel, differential channel, waveform memory, or a function.

See Definite-Length Block Response Data for more information.

### The time at any data point:

Xtime = (Xdata)(Xincrement) + (Xorigin)

Where the X-axis increment value is given by the `:WAVeform:YFORmat:XINCrement?` query.

### To convert raw analog-to-digital converter data:

Yamplitude = (Ydata)(conversion factor) + Yorigin

Where the conversion factor is given by the `:WAVeform:YFORmat:WORD:ENCoding:YINCrement?` query for converting counts to volts.

### Returned Data Type

The `:WAVeform:YFORmat:WORD:YDATa?` query returns short int (signed) values as definite-length block data. You must specify this data type in your program language's command that you use to query the data. The specifier for this data type in your programming language will likely be "h" and it is identified in this example with red text. Confirm this with your programming language's documentation. The following is an example of the command used in Python using PyVISA.

    endianness = Infiniium.query(':SYSTem:BORDer?')
    Infiniium.write(':SYSTem:BORDer LENDian')
    data = Infiniium.query_binary_values(':WAVeform:YFORmat:WORD:YDATa?',
    	datatype='h',
    	container=list,
    	is_big_endian=False,
    	header_fmt='ieee')
    Infiniium.write(':SYSTem:BORDer ' + endianness)

### Endianness of Returned Block Data

To correctly interpret block data, you must know the endianness (byte order) of the returned data (integers or real), and you will most likely have to specify this same endianness in your program language's command that is used to query the data. Endianness can be set to "little endian" order in which the least significant byte is sent first and the most significant byte sent last. Or, the endianness can be set to "big endian" order in which the most significant byte is sent first and the least significant byte sent last.

To specify or query the endianness setting for binary block data, use the `:SYSTem:BORDer` command. The endianness setting applies to all binary queries except for `:DISK:FILE:READ?` query.

If you plan to change Infiniium's current endian setting, it is a good practice to query Infiniium's current endian setting and restore the setting when your program completes. This will avoid other programs having errors due to assuming a particular endianness setting.

After a factory default (`:SYSTem:FACTory`), little endian is set. A default setup (`:SYSTem:DEFault`) does not affect endianness.

Be aware that VXI plug-and-play drivers can change the endianness setting. As a result always explicitly set the endianness in your program before transferring any binary data.

Y-Format Commands
Query | Description
--- | ---
:WAVeform:YFORmat:WORD:YDATa? | 16-bit integer raw analog-to-digital converter counts
:WAVeform:YFORmat:XINCrement? | The time spacing between the data points.
:WAVeform:YFORmat:POINts? | Returns the number of points in the data . The value Xindex in the following equation, is the data point count, starting at zero and ending at the number of points minus one.
:WAVeform:YFORmat:XORigin? | The time value of the first data point.
:WAVeform:YFORmat:WORD:ENCoding:YINCrement? | For WORD formatted data, returns the counts-to-volts conversion factor.
:WAVeform:YFORmat:WORD:ENCoding:YORigin? | For WORD formatted data, returns the voltage offset.
:WAVeform:CLIPped? | Returns whether the waveform data has been vertically clipped.
:WAVeform:HOLes? | Returns whether there are holes in the waveform data.
:WAVeform:YFORmat:WORD:ENCoding:CHIGh? | For WORD (integer) formatted data, returns the value that indicates a clipped high data point: 32,736.
:WAVeform:YFORmat:WORD:ENCoding:CLOW? | For WORD (integer) formatted data, returns the value that indicates a clipped low data point: 32,704.
:WAVeform:YFORmat:WORD:ENCoding:HOLE? | For WORD (integer) formatted data, returns the value that indicates a void data point: 32,672.

## Example Command Sequence

    # Get numeric values for later calculations.
    y_increment = float(Infiniium.query(":WAVeform:YFORmat:WORD:ENCoding:YINCrement?"))
    y_origin = float(Infiniium.query(":WAVeform:YFORmat:WORD:ENCoding:YORigin?"))

    # Get the waveform data.
    data_bytes = Infiniium.query_binary_values(
        ":WAVeform:YFORmat:WORD:YDATa?", datatype="s", container=bytes
    )

It is important to use the `:YINCrement?`, `:YORigin?`, and `:YDATa?` queries in sequence to get properly related results. Intervening commands can possibly cause a mismatch between the returned Y data, Y origin, or Y increment values.