How to use IOW method in fMBT

Best Python code snippet using fMBT_python

Dialogs.py

Source:Dialogs.py Github

copy

Full Screen

1import wx2import wx.adv3from Panels import panels4from HWLayer.dut import Pin, Cell, PinColour5from enum import Enum6#######################################################################7# Legend dialog8class Legend(panels.Legend):9 #constructor10 def __init__(self,parent):11 12 #initialize parent class13 panels.Legend.__init__(self, parent)14 self.m_panel1.Bind(wx.EVT_PAINT, self.OnPaint) 15 self.width = 2416 self.pin_list = []17 # Populate pin list18 # Not connected19 p_nc = Pin()20 p_nc.name = 'MISSING'21 p_nc.port.name = 'MISSING'22 self.pin_list.append((p_nc, "Not connected"))23 # VCC24 p_vcc = Pin()25 p_vcc.port.name = "VCC"26 self.pin_list.append((p_vcc, "Power pin - Vcc"))27 # GND28 p_gnd = Pin()29 p_gnd.port.name = "GND"30 self.pin_list.append((p_gnd, "Power pin - GND"))31 32 # JTAG33 p_jtag = Pin()34 p_jtag.port.name = "TCK"35 self.pin_list.append((p_jtag, "JTAG port pin"))36 37 # io Z38 p_io_link = Pin()39 p_io_link.port.name = "IN"40 self.pin_list.append((p_io_link, "In pin / linkage - read only"))41 # io 042 p_io_0 = Pin()43 p_io_0.port.in_cell = Cell(None)44 p_io_0.port.out_cell = Cell(None)45 p_io_0.port.name = "IO1"46 p_io_0.read = '0'47 p_io_0.port.is_set = False48 self.pin_list.append((p_io_0, "I/O pin - read logical 0"))49 # io 150 p_io_1 = Pin()51 p_io_1.port.in_cell = Cell(None)52 p_io_1.port.out_cell = Cell(None)53 p_io_1.port.name = "IO"54 p_io_1.read = '1'55 p_io_1.port.is_set = False56 self.pin_list.append((p_io_1, "I/O pin - read logical 1"))57 # io 058 p_iow_0 = Pin()59 p_iow_0.port.in_cell = Cell(None)60 p_iow_0.port.out_cell = Cell(None)61 p_iow_0.port.name = "IO"62 p_iow_0.read = '0'63 p_iow_0.write = '0'64 self.pin_list.append((p_iow_0, "I/O pin - read logical 0, set 0"))65 # io 166 p_iow_1 = Pin()67 p_iow_1.port.in_cell = Cell(None)68 p_iow_1.port.out_cell = Cell(None)69 p_iow_1.port.name = "IO"70 p_iow_1.read = '1'71 p_iow_1.write = '1'72 self.pin_list.append((p_iow_1, "I/O pin - read logical 1, set 1"))73 def close(self, e):74 self.Destroy()75 def addPin(self, dc, pin_desc, y_coord):76 pin_color = PinColour.OTH77 left_pad = 578 pin = pin_desc[0]79 80 if pin.port.name[0:3].upper() in ['VCC', 'VDD']: pin_color = PinColour.VCC81 elif pin.port.name[0:3].upper() in ['GND', 'VSS']: pin_color = PinColour.GND82 elif pin.port.name[0:2].upper() == 'IO': pin_color = PinColour.IO83 elif pin.port.name.upper() == 'MISSING': pin_color = PinColour.NC84 elif pin.port.name[0:3].upper() in ['TDI', 'TDO', 'TCK', 'TMS', 'TRST']: pin_color = PinColour.JTAG85 dc.SetPen(wx.Pen(wx.Colour(200,200,255), 2)) 86 dc.SetBrush(wx.Brush(pin_color.value, wx.BRUSHSTYLE_SOLID))87 # Plot pin square88 dc.DrawRectangle(left_pad, y_coord, self.width, self.width) 89 # Draw value to write if pin setting is enabled90 if pin.port.is_set:91 if pin.write == '0': 92 dc.SetBrush(wx.Brush(PinColour.IO_0.value, wx.BRUSHSTYLE_SOLID))93 elif pin.write == '1': 94 dc.SetBrush(wx.Brush(PinColour.IO_1.value, wx.BRUSHSTYLE_SOLID))95 dc.DrawPolygon([96 (left_pad, y_coord),97 (left_pad + self.width, y_coord + self.width),98 (left_pad + self.width, y_coord)99 ])100 # Draw state if value present, else return101 if pin.read is not None: 102 state_col = PinColour.IO_Z103 if pin.read == '0': state_col = PinColour.IO_0104 elif pin.read == '1': state_col = PinColour.IO_1105 106 # Draw circle 107 dc.SetBrush(wx.Brush(state_col.value, wx.BRUSHSTYLE_SOLID))108 # Include pin type in the picture109 if pin.port.type in ['out']:110 dc.SetPen(wx.Pen(wx.Colour(26, 33, 171), 1, wx.SOLID))111 dc.DrawCircle((left_pad+0.5 * self.width), (y_coord+0.5 * self.width), (0.3 * self.width)) 112 dc.SetPen(wx.Pen(wx.Colour(200,200,255))) 113 dc.SetBrush(wx.Brush(wx.Colour(0,255,0), wx.TRANSPARENT)) 114 font = wx.Font(self.width, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) 115 dc.DrawText(pin_desc[1], left_pad + 10 + self.width, y_coord + 0.25*self.width)116 def OnPaint(self, e): 117 dc = wx.PaintDC(e.GetEventObject())118 brush = wx.Brush("white") 119 dc.SetBackground(brush) 120 dc.Clear() 121 # Loop over pin list122 for i, p in enumerate(self.pin_list):123 self.addPin(dc, p, i * self.width + 0.25 * self.width)124#######################################################################125# About dialog126class About:127 description = """JTAG GUI is a wrapper for UrJTAG designed to128display and set pin states on ICs using the JTAG TAP protocol.129It alows to import and parse BSDL files using TaTsu package,130saving them in local SQLite database."""131 licence = """This program is free software: you can redistribute it and/or modify132it under the terms of the GNU General Public License as published by133the Free Software Foundation, either version 3 of the License, or134(at your option) any later version.135This program is distributed in the hope that it will be useful,136but WITHOUT ANY WARRANTY; without even the implied warranty of137MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the138GNU General Public License for more details.139You should have received a copy of the GNU General Public License140along with this program. If not, see <https://www.gnu.org/licenses/>."""141 info = wx.adv.AboutDialogInfo()142 info.SetName('JTAG GUI')143 info.SetVersion('0.1')144 info.SetDescription(description)145 info.SetCopyright('(C) 2020-2021 Mateusz Najsztub')146 info.SetWebSite('https://github.com/Najsztub/jtagGUI')...

Full Screen

Full Screen

sbt_iow_plot.py

Source:sbt_iow_plot.py Github

copy

Full Screen

1import numpy as np2import pandas as pd3import os, sys4from invisible_cities.core.system_of_units import *5import matplotlib.pyplot as plt6from pandas import DataFrame, Series7from matplotlib import cm as cmp8from sabat.sbt_types import photon, molecule, GM, us, ucm, ucm2, ucm3, gp9from sabat.sbt_types import umm, umum, mum2, mW10from sabat.sbt_iow import eigen, ie11rad_to_deg = 180/np.pi12def plot_depth_of_penetration(iow, figsize=(10,6), eps=1e-2):13 fig = plt.figure(figsize=figsize)14 ax = plt.subplot(1,2,1)15 TH10 = np.linspace(iow.tc10 + eps, np.pi/2, 100)16 TH12 = np.linspace(iow.tc12 + eps, np.pi/2, 100)17 plt.plot(TH10 * rad_to_deg, iow.d10(TH10)/nm, lw=2, label=r'$d_{1,0}$')18 plt.axvline(x=iow.tc10 * rad_to_deg, ymin=0, ymax=160, color='r', linestyle='dashed')19 plt.xlabel(r'$\theta$ (deg)')20 plt.ylabel(r'd (nm)')21 plt.legend()22 ax = plt.subplot(1,2,2)23 plt.plot(TH12 * rad_to_deg, iow.d12(TH12)/nm, lw=2, label=r'$d_{1,2}$')24 plt.axvline(x=iow.tc12 * rad_to_deg, ymin=0, ymax=160, color='r', linestyle='dashed')25 plt.xlabel(r'$\theta$ (deg)')26 plt.ylabel(r'd (nm)')27 plt.legend()28 plt.show()29def plot_Ie_Ii(iow, figsize=(10,6),eps=1e-2):30 fig = plt.figure(figsize=figsize)31 ax = plt.subplot(1,2,1)32 TH10 = np.linspace(iow.tc10 + eps, np.pi/2, 100)33 TH12 = np.linspace(iow.tc12 + eps, np.pi/2, 100)34 plt.plot(TH10 * rad_to_deg, iow.Ie_Ii_TE_10(TH10), lw=2, label=r'$(I_e/I_i)_{1,0}^{TE}$')35 plt.plot(TH10 * rad_to_deg, iow.Ie_Ii_TM_10(TH10), lw=2, label=r'$(I_e/I_i)_{1,0}^{TM}$')36 plt.xlabel(r'$\theta$ (deg)')37 plt.ylabel(r'per unit')38 plt.legend()39 ax = plt.subplot(1,2,2)40 plt.plot(TH12 * rad_to_deg, iow.Ie_Ii_TE_12(TH12), lw=2, label=r'$(I_e/I_i)_{1,2}^{TE}$')41 plt.plot(TH12 * rad_to_deg, iow.Ie_Ii_TM_12(TH12), lw=2, label=r'$(I_e/I_i)_{1,2}^{TM}$')42 plt.xlabel(r'$\theta$ (deg)')43 plt.ylabel(r'$(I_e/I_i)$')44 plt.legend()45 plt.show()46def plot_evanescent_path_length(iow, figsize=(10,6), eps=1e-2):47 fig = plt.figure(figsize=figsize)48 ax = plt.subplot(1,2,1)49 TH10 = np.linspace(iow.tc10 + eps, np.pi/2, 100)50 TH12 = np.linspace(iow.tc12 + eps, np.pi/2, 100)51 plt.plot(TH10 * rad_to_deg, iow.l10TE(TH10)/nm, lw=2, label=r'$L_{1,0}^{TE}$')52 plt.plot(TH10 * rad_to_deg, iow.l10TM(TH10)/nm, lw=2, label=r'$L_{1,0}^{TM}$')53 plt.xlabel(r'$\theta$ (deg)')54 plt.ylabel(r'per unit')55 plt.legend()56 ax = plt.subplot(1,2,2)57 plt.plot(TH12 * rad_to_deg, iow.l12TE(TH12)/nm, lw=2, label=r'$L_{1,2}^{TE}$')58 plt.plot(TH12 * rad_to_deg, iow.l12TM(TH12)/nm, lw=2, label=r'$L_{1,2}^{TM}$')59 plt.xlabel(r'$\theta$ (deg)')60 plt.ylabel(r'L (nm)')61 plt.legend()62 plt.show()63def plot_GH_shifts(iow, figsize=(10,6), eps=1e-2):64 fig = plt.figure(figsize=figsize)65 ax = plt.subplot(1,2,1)66 TH10 = np.linspace(iow.tc10 + eps, np.pi/2, 100)67 TH12 = np.linspace(iow.tc12 + eps, np.pi/2, 100)68 plt.plot(TH10 * rad_to_deg, iow.dt10TE(TH10)/nm, lw=2, label=r'$\Delta_{1,0}^{TE}$')69 plt.plot(TH10 * rad_to_deg, iow.dt10TM(TH10)/nm, lw=2, label=r'$\Delta_{1,0}^{TM}$')70 plt.xlabel(r'$\theta$ (deg)')71 plt.ylabel(r'$\Delta$')72 plt.legend()73 ax = plt.subplot(1,2,2)74 plt.plot(TH12 * rad_to_deg, iow.dt12TE(TH12)/nm, lw=2, label=r'$\Delta_{1,2}^{TE}$')75 plt.plot(TH12 * rad_to_deg, iow.dt12TM(TH12)/nm, lw=2, label=r'$\Delta_{1,2}^{TM}$')76 plt.xlabel(r'$\theta$ (deg)')77 plt.ylabel(r'$\Delta$ (nm)')78 plt.legend()79 plt.show()80def plot_eigenvalues(IIOW, mode='TE', mmax=4, figsize=(14,8), eps=1e-2):81 fig = plt.figure(figsize=figsize)82 M = np.arange(0,mmax)83 for i, iow in enumerate(IIOW):84 #print(iow)85 ax = plt.subplot(2,2,i+1)86 TH10 = np.linspace(iow.tc10 + eps, np.pi/2, 100)87 TH12 = np.linspace(iow.tc12 + eps, np.pi/2, 100)88 for m in M:89 eg = eigen(iow, TH12, m, mode)90 plt.plot(TH12 * rad_to_deg, eg.eigen(), lw=2, label=f'd = {iow.d/nm:5.1f} nm m = {m}')91 plt.legend()92 plt.axhline(y=0, color='k', linestyle='dashed')93 plt.tight_layout()94 plt.show()95def plot_roots_TE(R, m, figsize=(14,8)):96 fig = plt.figure(figsize=figsize)97 TH = np.array([pr.theta for pr in R.values()])98 D = np.array([pr.d for pr in R.values()])99 plt.plot(TH * rad_to_deg, D/nm, 'bo')100 plt.xlabel(r'$\theta$ (deg)')101 plt.ylabel(r'd (nm)')102 plt.show()103def plot_evanescent_field(R, iow, m, figsize=(8,8)):104 fig = plt.figure(figsize=figsize)105 PR = R[m]106 for i, r in enumerate(PR.d):107 theta = PR.theta[i]108 ax = plt.subplot(2,2,i+1)109 Z = np.linspace(0, 200 *nm, 100)110 I = ie(Z,iow.lamda, iow.n0, iow.n1, theta,mode='TE')111 plt.plot(Z/nm, I, lw=2, label=f'r = {r/nm:5.1f}, theta={theta * rad_to_deg:5.1f}')112 plt.legend()113 plt.tight_layout()...

Full Screen

Full Screen

linux.py

Source:linux.py Github

copy

Full Screen

...32 res |= size << _IOC_SIZESHIFT33 return res34def _IOC_TYPECHECK(t):35 return sizeof(t)36def _IOW(type_, nr, size):37 return _IOC(_IOC_WRITE, type_, nr, _IOC_TYPECHECK(size))38def _IOR(type_, nr, size):39 return _IOC(_IOC_READ, type_, nr, _IOC_TYPECHECK(size))40def ifreq(**kwargs):41 IFNAMSIZ = 1642 name = ''43 flags = 044 if 'name' in kwargs:45 name = kwargs['name']46 if 'flags' in kwargs:47 flags = kwargs['flags']48 return struct.pack('%usH' % IFNAMSIZ, name, flags)49TUN_READQ_SIZE = 50050TUN_TUN_DEV = 0x000151TUN_TAP_DEV = 0x000252TUN_TYPE_MASK = 0x000f53TUN_FASYNC = 0x001054TUN_NOCHECKSUM = 0x002055TUN_NO_PI = 0x004056TUN_ONE_QUEUE = 0x008057TUN_PERSIST = 0x010058TUN_VNET_HDR = 0x020059TUN_TAP_MQ = 0x040060TUNSETNOCSUM = _IOW('T', 200, 'int')61TUNSETDEBUG = _IOW('T', 201, 'int')62TUNSETIFF = _IOW('T', 202, 'int')63TUNSETPERSIST = _IOW('T', 203, 'int')64TUNSETOWNER = _IOW('T', 204, 'int')65TUNSETLINK = _IOW('T', 205, 'int')66TUNSETGROUP = _IOW('T', 206, 'int')67TUNGETFEATURES = _IOR('T', 207, 'unsigned int')68TUNSETOFFLOAD = _IOW('T', 208, 'unsigned int')69TUNSETTXFILTER = _IOW('T', 209, 'unsigned int')70TUNGETIFF = _IOR('T', 210, 'unsigned int')71TUNGETSNDBUF = _IOR('T', 211, 'int')72TUNSETSNDBUF = _IOW('T', 212, 'int')73TUNATTACHFILTER = _IOW('T', 213, 'struct sock_fprog')74TUNDETACHFILTER = _IOW('T', 214, 'struct sock_fprog')75TUNGETVNETHDRSZ = _IOR('T', 215, 'int')76TUNSETVNETHDRSZ = _IOW('T', 216, 'int')77TUNSETQUEUE = _IOW('T', 217, 'int')78TUNSETIFINDEX = _IOW('T', 218, 'unsigned int')79TUNGETFILTER = _IOR('T', 219, 'struct sock_fprog')80IFF_TUN = 0x000181IFF_TAP = 0x000282IFF_NO_PI = 0x100083IFF_ONE_QUEUE = 0x200084IFF_VNET_HDR = 0x400085IFF_TUN_EXCL = 0x800086IFF_MULTI_QUEUE = 0x010087IFF_ATTACH_QUEUE = 0x020088IFF_DETACH_QUEUE = 0x040089IFF_PERSIST = 0x080090IFF_NOFILTER = 0x100091TUN_TX_TIMESTAMP = 192TUN_F_CSUM = 0x01...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful