code stringlengths 17 6.64M |
|---|
def showGod():
print('\n _ooOoo_\n o8888888o\n 88" . "88\n (| -_- |)\n O\\ = /O\n ____/`---\'\\____\n .\' \\... |
class DNN(nn.Module):
def __init__(self):
super(DNN, self).__init__()
self.autoenc = nn.Sequential(nn.Linear(2, 10), nn.ReLU(), nn.Linear(10, 20), nn.ReLU(), nn.Linear(20, 50), nn.ReLU(), nn.Linear(50, 100), nn.ReLU(), nn.Linear(100, 200), nn.ReLU(), nn.Linear(200, 1000), nn.ReLU(), nn.Linear(100... |
class DNN2(nn.Module):
def __init__(self):
super(DNN2, self).__init__()
self.autoenc = nn.Sequential(nn.Linear(2, 10), nn.ReLU(), nn.Linear(10, 20), nn.ReLU(), nn.Linear(20, 50), nn.ReLU(), nn.Linear(50, 100), nn.ReLU(), nn.Linear(100, 50), nn.ReLU(), nn.Linear(50, 20), nn.ReLU(), nn.Linear(20, 1... |
class DNN3(nn.Module):
def __init__(self):
super(DNN3, self).__init__()
self.autoenc = nn.Sequential(nn.Linear(2, 10), nn.ReLU(), nn.Linear(10, 20), nn.ReLU(), nn.Linear(20, 50), nn.ReLU(), nn.Linear(50, 100), nn.ReLU(), nn.Linear(100, 200), nn.ReLU(), nn.Linear(200, 500), nn.ReLU(), nn.Linear(50... |
class DNN4(nn.Module):
def __init__(self):
super(DNN4, self).__init__()
self.autoenc = nn.Sequential(nn.Linear(2, 10), nn.ReLU(), nn.Linear(10, 20), nn.ReLU(), nn.Linear(20, 50), nn.ReLU(), nn.Linear(50, 100), nn.ReLU(), nn.Linear(100, 2), nn.ReLU(), nn.Softmax(dim=(- 1)))
def forward(self, ... |
class DNN5(nn.Module):
def __init__(self):
super(DNN5, self).__init__()
self.autoenc = nn.Sequential(nn.Linear(2, 10), nn.ReLU(), nn.Linear(10, 20), nn.ReLU(), nn.Linear(20, 50), nn.ReLU(), nn.Linear(50, 100), nn.ReLU(), nn.Linear(100, 200), nn.ReLU(), nn.Linear(200, 500), nn.ReLU(), nn.Linear(50... |
class autoEncoder():
def __init__(self, xTrain, xTest, shape=[10, 20, 50, 100], epochs=1000, batchSize=16384, addReg=False, printSummary=False):
self.shape = shape
self.epochs = epochs
self.batchSize = batchSize
self.addReg = addReg
self.autoencoder = Sequential()
... |
class calculateDist():
def __init__(self, wayPts, mat, dim, savecsv=False):
self.wayPts = wayPts
self.C = mat
self.dim = dim
self.Smap = mat.StrengthMap
self.map = mat.map
self.Tx = mat.Tx
self.unit = mat.pathUnit
self.numPts = len(wayPts)
s... |
class calculateDistExp():
def __init__(self, waypts='assets/data/Trials/Trial1/odom.csv', wifi='assets/data/Trials/Trial1/wifi.csv'):
self.wFile = waypts
self.dim = 2
self.TX = wifi
self.maxZ = 2.4
self.TXName = None
self.numPts = None
self.numAPs = None
... |
class distanceMap():
def __init__(self, rssi, euclid, label=None, name=None):
self.rssi = rssi
self.euclid = euclid
self.label = label
self.name = name
def print(self):
print('rssi: ', self.rssi, ' , euclid: ', self.euclid, ' , label: ', self.label)
|
class Particle():
def __init__(self, pose, weight):
self.pose = pose
self.w = weight
self.mapMu = []
self.mapID = []
self.mapSigma = []
self.hashMap = {}
def print(self):
print('pose: ', self.pose, ' weight: ', self.w)
def printMap(self):
... |
class Point():
def __init__(self, x, y, z=None, px=None, py=None, pz=None):
self.x = x
self.y = y
self.z = z
self.px = px
self.py = py
self.pz = pz
def print(self):
print('row: ', self.x, 'col: ', self.y, 'depth: ', self.z)
|
class localize():
def __init__(self, numP, su, sz, distMap, mat, wayPts, R, dim, useClas, hardClas, modelpath='./models/best.pth'):
self.np = numP
self.sz = sz
self.dists = distMap
self.dim = dim
self.wayPts = wayPts
self.pts = self.convert(wayPts)
self.nAP... |
class localizeExp():
def __init__(self, numP, su, sz, map, useClas, hardClas, modelpath='./models/best.pth'):
self.np = numP
self.sz = sz
self.dim = map.dim
self.wayPts = map.wayPts
self.pts = self.convert(self.wayPts)
self.dim = map.dim
self.TXName = map.T... |
class readMat():
def __init__(self, file):
self.mat = h5py.File(file, 'r')
self.StrengthMap = self.mat['StrengthMap'][:]
self.Tx = self.mat['Tx'][:]
self.Tx = self.Tx.T.tolist()
self.map = self.mat['map'][:]
self.pathUnit = float(self.mat['pathUnit'][:])
se... |
class calculatePath():
def __init__(self, start, goal, mat, step, dim=2, maxIter=10000.0, viz=False):
self.dim = dim
self.start = start[0:2]
self.goal = goal[0:2]
self.map = mat.map
self.ap = mat.numAPs
self.step = step
self.maxZ = mat.maxZ
self.max... |
class WiFiScanner():
def __init__(self, filename):
self.file = filename
self.TXName = []
self.name2MAC = {}
self.RSSI = {}
self.numAPs = 0
self.defineAPS()
self.update()
def signalStrength2RSSI(self, rssi):
return max((- 100), min(((int(rssi) /... |
def getchannel(emplacement='trunku', intersection=1):
' get channel\n\n Parameters\n ----------\n\n emplacement : \'trunku\' | \'thighr\' | \'forearm\' | \'calfr\'\n intersection : 1 = LOS 0 : NLOS\n\n Returns\n -------\n\n alphak : np.array\n tauk : np.array\n\n Notes\n -----\n\n ... |
def SmoothMeshLine(plines, max_res, ratio=1.3, check=True, allowed_max_ratio=1.25):
'\n\tParameters\n\t----------\n\n\tplines : np.array\n\n\tReturns\n\t-------\n\n\tlines : np.array\n\n\t'
dlines = np.diff(plines)
Npoints = np.ceil((dlines / max_res))
Npoints = Npoints.astype(int)
for (k, N) in e... |
def CheckMesh(lines, min_res, max_res, ratio, verbose=False):
' Check if mesh lines are valid\n\n Parameters\n ----------\n\n lines : np.array()\n min_res: minimal allowed mesh-diff\n max_res: maximal allowed mesh-diff\n ratio: maximal allowed mesh-diff ratio\n be_quiet: disable warnings\n\n R... |
class DumpBox(Element):
"\n Add a dump property to CSX with the given name.\n\n Frequency: specify a frequency vector (required for dump types >=10)\n\n SubSampling: field domain sub-sampling, e.g. '2,2,4'\n OptResolution: field domain dump resolution, e.g. '10' or '10,20,5'\n\n MultiGridLevel: Requ... |
class Excitation(Element):
def __init__(self, name='exc0', typ='Es', excite='1,0,0'):
Element.__init__(self, 'Excitation')
self.attrib['Name'] = name
self.attrib['Excite'] = excite
if (typ == 'Es'):
self.attrib['Type'] = '0'
if (typ == 'Eh'):
self.a... |
class Point(Element):
def __init__(self, name, p):
Element.__init__(self, name, X=str(p[0]), Y=str(p[1]), Z=str(p[2]))
|
class Vertex(Element):
def __init__(self, x=0, y=0, z=[]):
Element.__init__(self, 'Vertex')
if (z == []):
self.attrib['X1'] = str(x)
self.attrib['X2'] = str(y)
else:
self.text = ((((str(x) + ',') + str(y)) + ',') + str(z))
pass
|
class Face(Element):
def __init__(self, x=0, y=0, z=0):
Element.__init__(self, 'Face')
self.text = ((((str(x) + ',') + str(y)) + ',') + str(z))
|
class Cylinder(Element):
def __init__(self, P1, P2, Radius=50, Priority=10):
Element.__init__(self, 'Cylinder')
self['Priority'] = Priority
self['P1'] = Point(P1)
self['P2'] = Point(P2)
self['Radius'] = Radius
|
class Sphere(Element):
' a Sphere is a Primitives of a Properties element\n\n Use set of CSX object\n '
def __init__(self, P, R=50, Pr=10):
Element.__init__(self, 'Sphere', Priority=str(Pr), Radius=str(R))
self.append(Point('Center', P))
|
class Box(Element):
def __init__(self, P1, P2, Pr):
Element.__init__(self, 'Box', Priority=str(Pr))
self.append(Point('P1', P1))
self.append(Point('P2', P2))
|
class Polygon(Element):
def __init__(self, LP, Priority=1, elevation=254, normdir=2, coordsystem=0):
'\n Parameters\n ----------\n\n Priority\n Elevation\n\n '
Element.__init__(self, 'Polygon', Priority=str(Pr), Elevation=str(elevation), NormDir=str(normdir), Co... |
class ConductingSheet(Element):
pass
|
class Polyhedron(Element):
'\n AddPolyhedron.m\n '
def __init__(self, LP=[[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]], LV=[[0, 1, 2], [1, 2, 3], [0, 1, 3], [0, 2, 3]], Pr=0):
'\n Parameters\n ----------\n\n LP : List of Points\n LV : List of vertex indexes\n ... |
class Curve(Element):
def __init__(self, point, Pr):
Element.__init__(self, 'Curve', Priority=str(Pr))
for P in LP:
V = Vertex(x=P[0], y=P[1], z=P[2])
self.append(V)
|
class XLines(Element):
def __init__(self, X=np.arange((- 10), 11, 1)):
Element.__init__(self, 'XLines')
c = reduce((lambda a, b: ((str(a) + ',') + str(b))), X)
self.text = c
|
class YLines(Element):
def __init__(self, X=np.arange((- 10), 11, 1)):
Element.__init__(self, 'YLines')
c = reduce((lambda a, b: ((str(a) + ',') + str(b))), X)
self.text = c
|
class ZLines(Element):
def __init__(self, X=np.arange((- 10), 31, 1)):
Element.__init__(self, 'ZLines')
c = reduce((lambda a, b: ((str(a) + ',') + str(b))), X)
self.text = c
|
class RectilinearGrid(Element):
def __init__(self, X, Y, Z, CoordSystem=0, DeltaUnit='1'):
'\n Parameters\n ----------\n\n X : np.array\n Y : np.array\n Z : np.array\n CoordSystem : int\n default 0 : cartesian\n DeltaUnit : string\n ... |
class LinPoly(Element):
" Planar surface defined by a polygon\n\n Parameters\n ----------\n\n prio: priority\n normDir: normal direction of the polygon,\n e.g. 'x', 'y' or 'z', or numeric 0..2\n elevation: position of the polygon plane\n points: list of points (2xN... |
class Transformation(Element):
'docstring for Transformation'
def __init__(self):
Element.__init__(self, 'Transformation')
|
class Translate(Element):
def __init__(self, p):
Element.__init__(self, 'Translate', Argument=((((str(p[0]) + ',') + str(p[1])) + ',') + str(p[2])))
|
class Rotate_X(Element):
def __init__(self, ang):
Element.__init__(self, 'Rotate_X', Argument=str(ang))
|
class Rotate_Y(Element):
def __init__(self, ang):
Element.__init__(self, 'Rotate_Y', Argument=str(ang))
|
class Rotate_Z(Element):
def __init__(self, ang):
Element.__init__(self, 'Rotate_Z', Argument=str(ang))
|
def SmoothMeshLine(plines, max_res, ratio=1.3, check=True, max_ratio=1.25):
'\n\tParameters\n\t----------\n\n\tplines : np.array\n\n\tReturns\n\t-------\n\n\tlines : np.array\n\n\t'
dlines = np.diff(plines)
Npoints = np.ceil((dlines / max_res))
Npoints = Npoints.astype(int)
for (k, N) in enumerate... |
def CheckMesh(lines, min_res, max_res, ratio, verbose=False):
' Check if mesh lines are valid\n\n Parameters\n ----------\n\n lines : np.array()\n min_res: minimal allowed mesh-diff\n max_res: maximal allowed mesh-diff\n ratio: maximal allowed mesh-diff ratio\n be_quiet: disable warnings\n\n R... |
class Matter(Element):
" Metal or Material\n\n typ : 'Me','Ma','Cs'\n\n Me=Matter()\n Ma\n\n "
def __init__(self, Name, typ='Me', **kwargs):
dtyp = {'Me': 'Metal', 'Ma': 'Material', 'Cs': 'ConductingSheet'}
Element.__init__(self, dtyp[typ], Name=Name)
Prim = Element('Primi... |
class Material(object):
def __init__(self):
pass
def Debye(f, **kwargs):
' Debye model\n\n Parameters\n ----------\n\n f :\n eps_r\n kappar :\n eps_Delta :\n t_relax :\n\n '
defaults = {'f': 1000000, 'eps_r': 1, 'kappar': 1, 'ep... |
class OpenEMS(Element):
'\n Main Class decribing the openEMS simulation\n '
def __init__(self, FDTD, CSX):
Element.__init__(self, 'openEMS')
self.append(FDTD)
self.append(CSX)
def __repr__(self):
st = ElementTree.tostring(self)
return st
def save(self, ... |
class CSX(Element):
' Continuous Structure Class\n\n Methods\n -------\n\n add\n set\n save\n\n '
def __init__(self, CoordSystem=0):
if (CoordSystem == 0):
Element.__init__(self, 'ContinuousStructure', CoordSystem=str(CoordSystem))
P = Element('Properties')
... |
class FDTD(Element):
"\n\n Inititalize the FDTD data-structure.\n\n optional field arguments for usage with openEMS:\n\n NrTS: max. number of timesteps to simulate (e.g. default=1e9)\n EndCriteria: end criteria, e.g. 1e-5, simulations stops if energy has\n de... |
class Exc(Element):
'\n\n Parameters\n ----------\n\n typ : Gaussian (0)\n f0 : center frequency\n fc :\n Sinus (1)\n f0 : frequency\n Dirac (2)\n Step (3)\n Custom (10)\n f0 : nyquist rate\n funcStr : string descr... |
class BoundaryCond(Element):
"\n\n BC = [xmin xmax ymin ymax zmin zmax]\n\n 0 = PEC or 'PEC'\n 1 = PMC or 'PMC'\n 2 = MUR-ABC or 'MUR'\n 3 = PML-ABC or 'PML_x' with pml size x => 4..50\n\n Examples\n --------\n\n BC = [ 1 , 1 , 0 , 0 , 2 , 3 ]\n BC = ['PMC' 'PMC' 'PEC' '... |
class ProbeBox(Element):
def __init__(self, Name, Type=0, Weight=(- 1)):
Element.__init__(self, 'ProbeBox', Name=Name, Type=Type, Wieght=Weight)
|
class ProbeBox(Element):
def __init__(self, Name='port_ut1', Type='wv', Weight='1'):
"\n\ntype: 0 for voltage probing => 'vp'\n 1 for current probing => 'cp'\n 2 for E-field probing => 'Efp'\n 3 for H-field probing => 'Hfp'\n 10 for waveguide voltage mode matching ... |
class Attributes(Element):
def __init__(self, name, a):
Element.__init__(self, name, ModeFunctionX=str(a[0]), ModeFunctionY=str(a[1]), ModeFunctionZ=str(a[2]))
|
class HornAntenna(object):
def __init__(self, **kwargs):
defaults = {'unit': 0.001, 'width': 20, 'height': 30, 'length': 50, 'feed_length': 50, 'thickness': 2, 'angle': ((np.array([20, 20]) * np.pi) / 180.0)}
for k in defaults:
if (k not in kwargs):
kwargs[k] = default... |
class Building(pro.PyLayers, list):
def __init__(self):
self.lzfloor = []
self.lzceil = []
self.lfilename = []
self.Nfloor = 0
def __repr__(self):
s = (('Building has ' + str(self.Nfloor)) + ' floor(s)')
s = (s + '\n')
s = (s + '\n')
for f in r... |
class Furniture(PyLayers):
" Class Furniture\n\n Attributes\n ----------\n\n name\n desc\n origin\n height\n length\n width\n thichness\n Matname\n\n Notes\n -----\n\n This class handle the description of furnitures.\n Until now furnitures are limited to rectangular objec... |
def make_kml(extent, figs, colorbar=None, **kw):
'\n Parameters\n ----------\n\n extent : tuple\n (lm,lM,Lm,LM)\n lower left corner longitude\n upper right corner longitude\n lower left corner Latitude\n upper right corner Latitude\n\n altitude : float\n altitudem... |
def gearth_fig(extent, extent_c):
'google earth figure\n\n Parameters\n ----------\n\n '
Dx = (extent_c[1] - extent_c[0])
Dy = (extent_c[3] - extent_c[2])
aspect = (Dy / Dx)
if (aspect < 1.0):
figsize = ((10.0 / aspect), 10.0)
else:
figsize = (10.0, (10.0 * aspect))
... |
class NoSuchTileError(Exception):
'Raised when there is no tile for a region.'
def __init__(self, lat, lon):
Exception.__init__()
self.lat = lat
self.lon = lon
def __str__(self):
return ('No SRTM tile for %d, %d available!' % (self.lat, self.lon))
|
class WrongTileError(Exception):
'Raised when the value of a pixel outside the tile area is reque sted.'
def __init__(self, tile_lat, tile_lon, req_lat, req_lon):
Exception.__init__()
self.tile_lat = tile_lat
self.tile_lon = tile_lon
self.req_lat = req_lat
self.req_lon... |
class InvalidTileError(Exception):
'Raised when the SRTM tile file contains invalid data.'
def __init__(self, lat, lon):
Exception.__init__()
self.lat = lat
self.lon = lon
def __str__(self):
return ('SRTM tile for %d, %d is invalid!' % (self.lat, self.lon))
|
class SRTMDownloader():
'Automatically download SRTM tiles.'
def __init__(self, server='dds.cr.usgs.gov', directory=os.path.join('srtm', 'version2_1', 'SRTM3'), cachedir='cache', protocol='http'):
self.protocol = protocol
self.server = server
self.directory = directory
self.ca... |
class SRTMTile():
'Base class for all SRTM tiles.\n Each SRTM tile is size x size pixels big and contains\n data for the area from (lat, lon) to (lat+1, lon+1) inclusive.\n This means there is a 1 pixel overlap between tiles. This makes it\n easier for as to interpolate the value, beca... |
class parseHTMLDirectoryListing(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.title = 'Undefined'
self.isDirListing = False
self.dirList = []
self.inTitle = False
self.inHyperLink = False
self.currAttrs = ''
self.currHref = ''
... |
def polyplot(poly, fig=[]):
if (fig == []):
fig = plt.figure()
(fig, ax) = L.showG('s', fig=fig)
color = (['r', 'b', 'g'] * 10)
for (ip, p) in enumerate(poly):
(fig, ax) = p.plot(fig=fig, ax=ax, color=color[ip], alpha=0.5)
|
class TestLayout(unittest.TestCase):
def test_add_fnod(self):
L = Layout('defstr.lay')
L.add_fnod(p=(10, 10))
self.assertEqual(L.Np, 13)
def test_add_furniture(self):
L = Layout('defstr.lay')
L.add_furniture(name='R1_C', matname='PARTITION', origin=(5.0, 5.0), zmin=0.... |
class QIPythonWidget(RichJupyterWidget):
' Convenience class for a live IPython console widget. We can replace the standard banner using the customBanner argument'
def __init__(self, customBanner=None, *args, **kwargs):
if (not (customBanner is None)):
self.banner = customBanner
s... |
class JupyterWidget(QtGui.QWidget):
' Main GUI Widget including a button and IPython Console widget \n inside vertical layout \n '
def __init__(self, parent=None):
super(JupyterWidget, self).__init__(parent)
layout = QtGui.QVBoxLayout(self)
ipyConsole = QIPythonWidget()
... |
class _MPLFigureEditor(Editor):
scrollable = True
def init(self, parent):
self.control = self._create_canvas(parent)
self.set_tooltip()
def update_editor(self):
pass
def _create_canvas(self, parent):
' Create the MPL canvas. '
frame = QtGui.QWidget()
... |
class MPLFigureEditor(BasicEditorFactory):
klass = _MPLFigureEditor
|
class WstdHandler(Handler):
channels = List(Str)
def object_Wstd_Enum_changed(self, info):
'\n This method listens for a change in the *state* attribute of the\n object (Address) being viewed.\n\n When this listener method is called, *info.object* is a reference to\n the v... |
class PylayersGUI(HasTraits):
laynames = ([''] + np.sort(os.listdir((basename + '/struc/lay/'))).tolist())
Lay_Enum = Enum(laynames)
av_ant = ['Omni', 'Gauss', 'aperture']
antext = ['vsh3', 'sh3']
for fname in os.listdir((basename + '/ant')):
if (fname.split('.')[(- 1)] in antext):
... |
def update_L(Lname):
DL.L = Layout(Lname)
(xmin, xmax, ymin, ymax) = DL.L.ax
zmax = (DL.L.maxheight - 0.1)
tx = copy.copy(DL.a)
rx = copy.copy(DL.b)
(tx_x.min, tx_x.max) = (xmin, xmax)
(tx_y.min, tx_y.max) = (ymin, ymax)
tx_z.max = zmax
tx_x.value = tx[0]
tx_y.value = tx[1]
... |
def update_Aa(ant):
DL.Aa = Antenna(ant)
if DL.Aa.fromfile:
fm.value = DL.Aa.fGHz[0]
fM.value = DL.Aa.fGHz[(- 1)]
fs.value = min(1, (DL.Aa.fGHz[1] - DL.Aa.fGHz[0]))
|
def update_Ab(ant):
DL.Ab = Antenna(ant)
if DL.Ab.fromfile:
fm.value = DL.Aa.fGHz[0]
fM.value = DL.Aa.fGHz[(- 1)]
fs.value = min(1, (DL.Aa.fGHz[1] - DL.Aa.fGHz[0]))
|
def update_a(x, y, z):
DL.a = np.array([x, y, z])
|
def update_b(x, y, z):
DL.b = np.array([x, y, z])
|
def update_Ta(alpha, beta, gamma):
T = geu.MEulerAngle(alpha, beta=beta, gamma=gamma)
DL.Ta = T
|
def update_Tb(alpha, beta, gamma):
T = geu.MEulerAngle(alpha, beta=beta, gamma=gamma)
DL.Tb = T
|
def update_fGHz(fm, fM, fs):
DL.fGHz = np.arange(fm, fM, fs)
|
def DLeval(*args):
pbar = tqdm.tqdm_notebook(total=100)
DL.eval(verbose=False, force=force.value, cutoff=cutoff.value, diffraction=diff.value, ra_vectorized=vect.value, ra_number_mirror_cf=mirror.value, applywav=appwav.value, progressbar=pbar)
DL.R._show3()
pbar.close()
|
def cdf(x, colsym='', lab='', lw=1):
'\n Plot the cumulative density function\n\n '
x = sort(x)
n = len(x)
x2 = repeat(x, 2)
y2 = hstack([0.0, repeat((arange(1, n) / float(n)), 2), 1.0])
plt.plot(x2, y2, colsym, label=lab, linewidth=lw)
|
def histo(x, n, fc, norm, xlab, ylab):
plt.hist(x, n, facecolor=fc, normed=norm)
plt.xlabel(xlab)
plt.ylabel(ylab)
|
def dist(a=array([]), b=array([])):
'\n Compute euclidean distance between 2 points given by 2 arrays.\n\n '
n1 = len(a)
n2 = len(b)
d = 0.0
if (n1 == n2):
d2 = ((a - b) * (a - b))
d = sum(d2, axis=0)
return sqrt(d)[0]
else:
print('ERROR: Coordinates are n... |
def lsop(H=array([])):
'\n Compute the least square operator \n \n '
return dot(inv(dot(transpose(H), H)), transpose(H))
|
class CDF(object):
def __init__(self, ld, filename='cdf'):
"\n cdf = CDF(ld)\n\n ld is a list of dictionnary\n\n d0 = ld[0]\n\n d0['bound'] : bornes en abscisses de la cdf 0\n d0['values'] : valeurs\n d0['xlabel'] :\n d0['ylabel'] :\n ... |
def cloud(p, name='cloud', display=False, color='r', dice=2, R=0.5, access='new'):
"\n cloud(p,filename,display,color) : display cloud of points p\n\n p : cloud of points array(Npx3)\n display : Boolean to switch display on/off\n color : 'r','b','g','k'\n dice : spher... |
def ffnetwork(inputs=1, layers=1, outputs=1):
'\n Define a feedforward neural network\n\n Parameters\n ----------\n inputs : integer\n default = 1\n defines the length of input vector\n layers : integer\n default = 1\n defines the number of layers\n outputs : integer\... |
def knn_learn(nneighbors=1, data_train=np.array([]), target_train=np.array([]), data_test=np.array([])):
'\n estimate position using the K neareast neighbors (KNN) technique\n\n Parameters\n ----------\n\n nneighbors : int\n default = 1\n data_train : numpy.ndarray\n default = array([... |
def ffann_learn(layers=1, data_train=np.array([]), target_train=np.array([]), data_test=np.array([])):
'\n estimate position using the feed-forward ANN technique\n\n Parameters\n ----------\n\n layers : int\n default = 1\n data_train : numpy.ndarray\n default = array([])\n target_t... |
def svm_learn(kernel='linear', data_train=np.array([]), target_train=np.array([]), data_test=np.array([])):
"\n estimate position using the svm techniques\n\n Parameters\n ----------\n\n kernel : string\n default = 'linear'\n kernel can be 'linear', 'poly', 'rbf', 'sigmoid'\n data_tra... |
def lreg_learn(data_train=np.array([]), target_train=np.array([]), data_test=np.array([])):
'\n estimate position using logistic regression\n\n Parameters\n ----------\n\n data_train : numpy.ndarray\n default = array([])\n target_train : numpy.ndarray\n default = array([])\n data_t... |
class Localization(object):
' Handle localization engine of agents\n\n Attributes\n ----------\n\n args\n config\n cla\n algloc\n idx\n\n '
def __init__(self, **args):
"\n\n Parameters\n ----------\n\n 'PN' : Network\n Personal Network\n ... |
class PLocalization(Process):
def __init__(self, loc=Localization(), tx=TX(), loc_updt_time=0.5, sim=None):
Process.__init__(self, name='Location', sim=sim)
self.loc = loc
self.tx = tx
self.loc_updt_time = loc_updt_time
self.method = self.loc.method
self.sim = sim
... |
class Take_all():
'\n Take TOA and Pr for any RAT.\n\n '
def take(self, net, RAT=None, LDP=None):
'\n Parameters\n ----------\n net\n RAT\n LDP\n\n if RAT= None : All RAT are processed\n '
cd = {}
if (RAT is None):
Rat... |
def merge_rules(self, RAT=None, LDP=None):
rules = {}
for rule in self.rule:
rules.update(rule.take(self.PN, RAT, LDP))
return rules
|
class Agent(object):
' Class Agent\n\n Members\n -------\n\n args\n ID\n name\n typ\n net\n epwr\n gcom\n sim\n wstd\n sens\n dcond\n meca : transit.Person\n net : pylayers.network.Network\n sim :\n PN :\n rxt\n rxr\n\n\n\n '
def __init__(self, **... |
class Header(object):
'Header information from a C3D file.'
BINARY_FORMAT = 'BBHHHHHfHHf270sHH214s'
def __init__(self, handle=None):
self.label_block = 0
self.parameter_block = 2
self.data_block = 3
self.point_count = 50
self.analog_count = 0
self.first_fra... |
class Param(object):
'We represent a single named parameter from a C3D file.'
def __init__(self, name, desc='', data_size=1, dimensions=None, bytes=None, handle=None):
'Set up a new parameter with at least a name.\n\n name: The name of the parameter.\n desc: The description of the param... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.