gmid icon indicating copy to clipboard operation
gmid copied to clipboard

Plotting for PMOS devices not working

Open restfet opened this issue 5 months ago • 0 comments

Creating plots for PMOS devices wouldn't work for me, either creating empty plots without any graphs or outright crashing my scripts.

After debugging for a while I noticed the get_indices method would return empty arrays for pmos devices. I applied the following fix in the get_indices method:

if isinstance(target, tuple): # when `vsb, vgs, vds` is a range
    start, end = target[:2]
    
    if self.mos == "nmos":
        indices = np.where((data >= start) & (data <= end))[0]
    if self.mos == "pmos":
        indices = np.where((data <= start) & (data >= end))[0]
    
    if len(target) == 3:  # if it contains a step
          step = int(target[2] / (data[1] - data[0]))
          indices = indices[::step]

I can't say if this fix could introduce bugs or errors elsewhere, but it appears to have done the trick.

restfet avatar Feb 01 '24 22:02 restfet