Languages

CommunityCategory: XMODELWhere can I find the documentations for XMULAN?
SA Support Team Staff asked 4 years ago

After reading the chapter on "Automating simulations with XMULAN and Python" included in the MODELZEN tutorial, I wrote a Python script listed below that runs a SPICE simulation on a MOSFET transistor and plots its Ids vs. Vgs graph. The problem is, I want to plot the y-axis of the graph in log scale, but I cannot find any information about the plot() function highlighted in red below.

Where can I find more details about this plot() function and other functions included in the XMULAN package?

#!/usr/bin/env xmodelpy

from xmulan import mulan, rowml
import pylab
 
M = mulan()
M.new_sw(vdd=[0.1,1.2])

for row in M.sw_iter():
   runbase = row.hspice("mos_vgid.empy")
   row.readmeas(runbase + ".sw0")
   row['v:vg':'i:mn'].plot()

pylab.show()
1 Answers
Best Answer
SA Support Team Staff answered 4 years ago

XMULAN is a Python library, and just like any other Python libraries, it has a built-in, on-line documentation. You can access its documentation either by using the xpydoc utility from the Linux command line or by using the help() function from the Python shell.

For instance, the plot() function you are inquiring is one of the methods of a waveform class defined in the xmulan module. To access its documentation, you can run the following command on the Linux command line:

$ xpydoc xmulan.waveform.plot

Or, you can run the following commands on the Python shell:

$ xmodelpy
>>> import xmulan
>>> help(xmulan.waveform.plot)

These commands show the documentation on the plot() method:

Help on method plot in xmulan.waveform:

xmulan.waveform.plot = plot(self, filename=None, plotfunc=None, use_line=True, use_marker=True, use_legends=True, **plotargs) unbound xmulan.waveform method
    plot the waveform data and save it to a file 
        if filename is specified.
    
    e.g. wf.plot(filename="plot.png")
         wf.plot(plotfunc=pylab.loglog)

As for your question, you can plot with a log-scale y-axis by providing pylab.semilogy as the plotfunc argument as illustrated below. For more information on the plot functions available from the pylab module of the matplotlib package, you may find this link useful.

#!/usr/bin/env xmodelpy

from xmulan import mulan, rowml
import pylab
 
M = mulan()
M.new_sw(vdd=[0.1,1.2])

for row in M.sw_iter():
   runbase = row.hspice("mos_vgid.empy")
   row.readmeas(runbase + ".sw0")
   row['v:vg':'i:mn'].plot(plotfunc=pylab.semilogy)

pylab.show()
SA Support Team Staff asked 4 years ago

MODELZEN 튜토리얼에 포함된 "Automating simulations with XMULAN and Python" 장을 읽고 MOSFET 트랜지스터에 SPICE 시뮬레이션을 수행한 후, 그 결과로 Ids 대 Vgs 그래프를 그리는 Python 스크립트를 아래와 같이 작성해보았습니다. 문제는, 그래프의 y축을 log 스케일로 만들고 싶은데, 빨간색으로 표시한 'plot()' 함수에 어떤 인자를 사용할 수 있는지에 대한 정보를 찾지 못하였습니다.

'plot()' 함수와 XMULAN 라이브러리의 다른 함수들에 대한 좀더 자세한 정보를 어디서 찾을 수 있나요?

#!/usr/bin/env xmodelpy

from xmulan import mulan, rowml
import pylab
 
M = mulan()
M.new_sw(vdd=[0.1,1.2])

for row in M.sw_iter():
   runbase = row.hspice("mos_vgid.empy")
   row.readmeas(runbase + ".sw0")
   row['v:vg':'i:mn'].plot()

pylab.show()
1 Answers
Best Answer
SA Support Team Staff answered 4 years ago

XMULAN is a Python library, and just like any other Python libraries, it has a built-in, on-line documentation. You can access its documentation either by using the xpydoc utility from the Linux command line or by using the help() function from the Python shell.

For instance, the plot() function you are inquiring is one of the methods of a waveform class defined in the xmulan module. To access its documentation, you can run the following command on the Linux command line:

$ xpydoc xmulan.waveform.plot

Or, you can run the following commands on the Python shell:

$ xmodelpy
>>> import xmulan
>>> help(xmulan.waveform.plot)

These commands show the documentation on the plot() method:

Help on method plot in xmulan.waveform:

xmulan.waveform.plot = plot(self, filename=None, plotfunc=None, use_line=True, use_marker=True, use_legends=True, **plotargs) unbound xmulan.waveform method
    plot the waveform data and save it to a file 
        if filename is specified.
    
    e.g. wf.plot(filename="plot.png")
         wf.plot(plotfunc=pylab.loglog)

As for your question, you can plot with a log-scale y-axis by providing pylab.semilogy as the plotfunc argument as illustrated below. For more information on the plot functions available from the pylab module of the matplotlib package, you may find this link useful.

#!/usr/bin/env xmodelpy

from xmulan import mulan, rowml
import pylab
 
M = mulan()
M.new_sw(vdd=[0.1,1.2])

for row in M.sw_iter():
   runbase = row.hspice("mos_vgid.empy")
   row.readmeas(runbase + ".sw0")
   row['v:vg':'i:mn'].plot(plotfunc=pylab.semilogy)

pylab.show()