Languages

CommunityCategory: XMODELExporting XWAVE Analysis Results

XMODEL

Exporting XWAVE Analysis Results

SA Support Team Staff 2024-08-31

XWAVE can perform various analyses on simulated signals. For example, for xreal-type signals, it can compute their eye diagrams, Fourier transforms, and power-spectral densities (PSD). For xbit-type clock signals, it can compute their jitter histograms and phase noise spectrums.

However, XWAVE only displays the resulting plots of the analyses. Is there a way to export their data so I can post-process them using another tool?

1 Answers
SA Support Team Staff 2024-08-31

To address your needs, we have revised the Python API for XWAVE in the XMODEL 2024.09 Release so that you can perform the XWAVE analyses in a Python script and export their results to another tool.

Here is an example Python script that computes the power spectrum density (PSD) of a signal named 'TB.A' stored in a JEZ-format waveform file named 'xmodel.jez'.

#!/usr/bin/env xmodelpy

# 0. import XMULAN and XWAVE libraries
import xmulan
import xwave

# 1. read a signal trace from a waveform file
row = xmulan.rowml().readmeas("xmodel.jez")
trace = row["TB.A"]

# 2. perform XWAVE analysis
anaclass = xwave.psd_xreal(t_start=50e-6, f_min=0.0, f_max=1e9, window="Rectangular")
result = anaclass.do_analysis(trace)
psd, freq = result

# 3. plot the analysis results
fig = anaclass.plot_results(*result)
fig.show()

After importing the XMULAN and XWAVE libraries, the script first reads a signal trace from a waveform file using the 'readmeas()' method.

Next, it instantiates one of the XWAVE analysis classes named 'psd_xreal' with a set of parameters, for example, defining the start time ('t_start'), minimum frequency ('f_min'), maximum frequency ('f_max'), and windowing function ('window'). It then calls the 'do_analysis()' method of the analysis class instance to perform the analysis, which returns a set of evaluated power-spectrum density (PSD) and frequency values of the signal as the result. This result can be exported in various data formats. For example, this Q&A posting shows how to export the data in CSV format.

It is also possible to generate a plot figure using the results, by calling the 'plot_results()' method of the analysis class instance and calling the 'show()' method of the returned figure object.

Here is a list of the XWAVE analysis classes currently available in the XMODEL 2024.09 Release.

  • eyediag_xreal : Eye diagram analysis for xreal-type signals
  • fourier_xreal : Fourier transform analysis for xreal-type signals
  • psd_xreal : Power-spectral density analysis for xreal-type signals
  • jhist_xbit : Jitter histogram analysis for xbit-type signals
  • pnoise_xbit : Phase noise analysis for xbit-type signals

And you can print a list of supported parameter arguments and methods along with their descriptions by calling the 'print_help()' method of each XWAVE analysis class.

$ xmodelpy -c "import xwave; xwave.psd_xreal.print_help()"
========================================
ANALYSIS psd_xreal
========================================
Power spectral density (PSD) analysis for xreal signals

Supported parameters:
    t_start      : Start Time (default: 0.0)
    t_stop       : Stop Time (default: -1.0)
    f_min        : Minimum Frequency (default: 0.0)
    f_max        : Maximum Frequency (default: '1G')
    window       : Window Function (choices: ('Rectangular','Hann','Hamming','Blackman-Harris'), default: 'Hamming')
    num_freq     : Number of Frequency Points (default: 400)
    overlap      : Overlap Ratio (default: 0.5)

Supported methods:
    result = do_analysis(trace)  : perform the analysis and return result=(psd, freq)
        psd     : array of power spectral density values
        freq    : array of frequency values
    fig = plot_results(*result) : plot the analysis results

XMODEL

XWAVE 분석 결과를 다른 툴로 옮기는 법

SA Support Team Staff 2024-08-31

XWAVE는 시뮬레이션로 얻어진 신호 파형에 대해 다양한 분석을 수행할 수 있습니다. 예를 들어, xreal 타입의 신호에 대해서는 eye 다이어그램, 퓨리에 변환, 전력스펙트럼 밀도를 계산할 수 있고, xbit-타입의 클록 신호에 대해서는 지터 히스토그램 및 위상잡음 스펙트럼을 계산할 수 있습니다.

하지만, XWAVE은 그 분석결과를 그래프로만 보여줄 뿐입니다. 추가 분석을 수행하기 위해 그 결과 데이터를 다른 툴을 옮기는 방법이 있을까요?

1 Answers
SA Support Team Staff 2024-08-31

To address your needs, we have revised the Python API for XWAVE in the XMODEL 2024.09 Release so that you can perform the XWAVE analyses in a Python script and export their results to another tool.

Here is an example Python script that computes the power spectrum density (PSD) of a signal named 'TB.A' stored in a JEZ-format waveform file named 'xmodel.jez'.

#!/usr/bin/env xmodelpy

# 0. import XMULAN and XWAVE libraries
import xmulan
import xwave

# 1. read a signal trace from a waveform file
row = xmulan.rowml().readmeas("xmodel.jez")
trace = row["TB.A"]

# 2. perform XWAVE analysis
anaclass = xwave.psd_xreal(t_start=50e-6, f_min=0.0, f_max=1e9, window="Rectangular")
result = anaclass.do_analysis(trace)
psd, freq = result

# 3. plot the analysis results
fig = anaclass.plot_results(*result)
fig.show()

After importing the XMULAN and XWAVE libraries, the script first reads a signal trace from a waveform file using the 'readmeas()' method.

Next, it instantiates one of the XWAVE analysis classes named 'psd_xreal' with a set of parameters, for example, defining the start time ('t_start'), minimum frequency ('f_min'), maximum frequency ('f_max'), and windowing function ('window'). It then calls the 'do_analysis()' method of the analysis class instance to perform the analysis, which returns a set of evaluated power-spectrum density (PSD) and frequency values of the signal as the result. This result can be exported in various data formats. For example, this Q&A posting shows how to export the data in CSV format.

It is also possible to generate a plot figure using the results, by calling the 'plot_results()' method of the analysis class instance and calling the 'show()' method of the returned figure object.

Here is a list of the XWAVE analysis classes currently available in the XMODEL 2024.09 Release.

  • eyediag_xreal : Eye diagram analysis for xreal-type signals
  • fourier_xreal : Fourier transform analysis for xreal-type signals
  • psd_xreal : Power-spectral density analysis for xreal-type signals
  • jhist_xbit : Jitter histogram analysis for xbit-type signals
  • pnoise_xbit : Phase noise analysis for xbit-type signals

And you can print a list of supported parameter arguments and methods along with their descriptions by calling the 'print_help()' method of each XWAVE analysis class.

$ xmodelpy -c "import xwave; xwave.psd_xreal.print_help()"
========================================
ANALYSIS psd_xreal
========================================
Power spectral density (PSD) analysis for xreal signals

Supported parameters:
    t_start      : Start Time (default: 0.0)
    t_stop       : Stop Time (default: -1.0)
    f_min        : Minimum Frequency (default: 0.0)
    f_max        : Maximum Frequency (default: '1G')
    window       : Window Function (choices: ('Rectangular','Hann','Hamming','Blackman-Harris'), default: 'Hamming')
    num_freq     : Number of Frequency Points (default: 400)
    overlap      : Overlap Ratio (default: 0.5)

Supported methods:
    result = do_analysis(trace)  : perform the analysis and return result=(psd, freq)
        psd     : array of power spectral density values
        freq    : array of frequency values
    fig = plot_results(*result) : plot the analysis results