Skip to content

Documentation for public custom types is sourced in metadata of properties/methods that use them #1784

@sbethur

Description

@sbethur

Description of issue

There are custom types that are accepted/returned by public methods:

  • WaveformInfo by fetch, fetch_into, and read methods in niscope
  • MeasurementStats by fetch_measurement_stats method in niscope
  • HistoryRAMCycleInformation by fetch_history_ram_cycle_information method in nidigital
  • LCRLoadCompensationSpot and LCRMeasurement (Soon-to-be-added methods in nidcpower will use these)

In the current code generator design, when generating the documentation for the properties/methods that use them, the docstring defined for the custom types are not used, but rather the docstring embedded in the metadata of the properties/methods are used.
e.g.: Documentation for fetch: https://nimi-python.readthedocs.io/en/master/niscope/class.html#fetch (See the return value)
The source for documentation:

'description': '\nReturns a list of class instances with the following timing and scaling information about each waveform:\n\n- **relative_initial_x** (float) the time (in seconds) from the trigger to the first sample in the fetched waveform\n- **absolute_initial_x** (float) timestamp (in seconds) of the first fetched sample. This timestamp is comparable between records and acquisitions; devices that do not support this parameter use 0 for this output.\n- **x_increment** (float) the time between points in the acquired waveform in seconds\n- **channel** (str) channel name this waveform was acquired from\n- **record** (int) record number of this waveform\n- **gain** (float) the gain factor of the given channel; useful for scaling binary data with the following formula:\n\n .. math::\n\n voltage = binary data * gain factor + offset\n\n- **offset** (float) the offset factor of the given channel; useful for scaling binary data with the following formula:\n\n .. math::\n\n voltage = binary data * gain factor + offset\n\n- **samples** (array of float) floating point array of samples. Length will be of the actual samples acquired\n'

Drawbacks of current design:

  • Creation and maintenance of the custom type documentation is cumbersome
  • If the same type is used by multiple API, then we need to duplicate the documentation strings

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions