Languages

CommunityCategory: XMODELRetrieving time-value information of a signal’s waveform stored in JEZ-format file
SA Support Team Staff asked 6 years ago

Is there a way to read a JEZ-format waveform file in Python and retrieve the time-value series of the selected signal’s waveform?

1 Answers
Best Answer
SA Support Team Staff answered 6 years ago

Yes, you can read the JEZ waveform file into Python using the XMULAN library included in the XMODEL package. For instance, the following Python code example reads a JEZ-format waveform file and retrieves the time-value array information of a selected signal:

#!/usr/bin/env xmodelpy

from xmulan import rowml
import numpy as np

r = rowml().readmeas('xmodel.jez')            # read a JEZ-format waveform file named 'xmodel.jez'
w = r['my_signal'].get_waveform()              # retrieve the waveform object for signal named 'my_signal'

Here, the variable 'w' contains the waveform object for the signal named 'my_signal'. While the JEZ format stores the waveforms in the form of functional expressions, the get_waveform() function in the above example converts that information into an array of time-value pairs, which can be more convenient to process using other programs.

The following codes show how to retrieve the time and value of the points consisting the waveform:

time_pts = w.sweep[0]
data_pts = np.asarray(w)