当前位置: 首页>>代码示例>>Python>>正文


Python Layout.dumpr方法代码示例

本文整理汇总了Python中pylayers.gis.layout.Layout.dumpr方法的典型用法代码示例。如果您正苦于以下问题:Python Layout.dumpr方法的具体用法?Python Layout.dumpr怎么用?Python Layout.dumpr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylayers.gis.layout.Layout的用法示例。


在下文中一共展示了Layout.dumpr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Simul

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]
class Simul(SimulationRT): # Sympy 2
#class Simul(sympy.RealtimeEnvironment):
    """

    Attributes
    ----------
    config  : config parser instance
    sim_opt : dictionary of configuration option for simulation
    ag_opt : dictionary of configuration option for agent
    lay_opt : dictionary of  configuration option for layout
    meca_opt : dictionary of  configuration option for mecanic
    net_opt : dictionary of  configuration option for network
    loc_opt : dictionary of  configuration option for localization
    save_opt : dictionary of  configuration option for save
    sql_opt : dictionary of  configuration option for sql


    Parameters
    ----------

    self.lAg  : list of Agent(Object)
        list of agents involved in simulation
    self.L : Layout
        Layout used in simulation

    Notes
    -----

    All the previous dictionnary are obtained from the chosen simulnet.ini file
    in the project directory

    """
    def __init__(self):
        SimulationRT.__init__(self) #Sympy 2
        #sympy.RealtimeEnvironment.__init__(self)  #simpy 3
        self.initialize()
        self.config = ConfigParser.ConfigParser()
        filename = pyu.getlong('simulnet.ini',pstruc['DIRSIMUL'])
        self.config.read(filename)
        self.sim_opt = dict(self.config.items('Simulation'))
        self.lay_opt = dict(self.config.items('Layout'))
        self.meca_opt = dict(self.config.items('Mechanics'))
        self.net_opt = dict(self.config.items('Network'))
        self.loc_opt = dict(self.config.items('Localization'))
        self.save_opt = dict(self.config.items('Save'))
        self.sql_opt = dict(self.config.items('Mysql'))
        self.seed = eval(self.sim_opt['seed'])
        self.traj=Trajectories()

        self.verbose = str2bool(self.sim_opt['verbose'])
        if str2bool(self.net_opt['ipython_nb_show']):
            self.verbose = False
        self.roomlist=[]

        self.finish = False
        self.create()

    def __repr__(self):

        s = 'Simulation information' + '\n----------------------'
        s = s + '\nLayout: ' + self.lay_opt['filename']
        s = s + '\nSimulation duration: ' + self.sim_opt['duration']
        s = s + '\nRandom seed: ' + self.sim_opt['seed']
        s = s + '\nSave simulation: ' + self.save_opt['savep']

        s = s + '\n\nUpdate times' + '\n-------------'
        s = s + '\nMechanical update: ' + self.meca_opt['mecanic_update_time']
        s = s + '\nNetwork update: ' + self.net_opt['network_update_time']
        s = s + '\nLocalization update: ' + self.net_opt['communication_mode']

        s = s + '\n\nAgents => self.lAg[i]' + '\n------'
        s = s + '\nNumber of agents :' + str(len(self.lAg))
        s = s + '\nAgents IDs: ' + str([self.lAg[i].ID for i in range(len(self.lAg))])
        s = s + '\nAgents names: ' + str([self.lAg[i].name for i in range(len(self.lAg))])
        s = s + '\nDestination of chosen agents: ' + self.meca_opt['choose_destination']

        s = s + '\n\nNetwork' + '\n-------'
        s = s + '\nNodes per wstd: ' + str(self.net.wstd)

        s = s + '\n\nLocalization'  + '------------'
        s = s + '\nLocalization enable: ' + self.loc_opt['localization']
        s = s + '\nPostion estimation methods: ' + self.loc_opt['method']


        return s


    def create_layout(self):
        """ create Layout in Simpy the_world thanks to Tk backend

        """

        _filename = self.lay_opt['filename']

        self.L = Layout(_filename)

        self.the_world = world()

        try:
            self.L.dumpr()
#.........这里部分代码省略.........
开发者ID:Zulko,项目名称:pylayers,代码行数:103,代码来源:simulnet.py

示例2: Coverage

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]
class Coverage(object):
    """ Handle Layout Coverage

        Methods
        -------
        create grid()
            create a uniform grid for evaluating losses
        cover()
            run the coverage calculation
        showPower()
            display the map of received power
        showLoss()
            display the map of losses


        Attributes
        ----------
        All attributes are read from fileini ino the ini directory of the
        current project

        _fileini
            default coverage.ini

        L :  a Layout
        model : a pylayers.network.model object.
        nx    : number of point on x
        ny    : number of point on y
        tx    : transmitter position
        txpe  : transmitter power emmission level
        show  : boolean for automatic display power map

    """


    def __init__(self,_fileini='coverage.ini'):


        self.config = ConfigParser.ConfigParser()
        self.config.read(pyu.getlong(_fileini,pstruc['DIRSIMUL']))
        self.plm = dict(self.config.items('pl_model'))
        self.layoutopt = dict(self.config.items('layout'))
        self.gridopt = dict(self.config.items('grid'))
        self.txopt = dict(self.config.items('tx'))
        self.rxopt = dict(self.config.items('rx'))
        self.showopt = dict(self.config.items('show'))

        self.L = Layout(self.layoutopt['filename'])
        self.model = PLSmodel(f=eval(self.plm['fghz']),
                         rssnp=eval(self.plm['rssnp']),
                         d0=eval(self.plm['d0']),
                         sigrss=eval(self.plm['sigrss']))

        self.nx = eval(self.gridopt['nx'])
        self.ny = eval(self.gridopt['ny'])
        self.mode = eval(self.gridopt['full'])
        self.boundary = eval(self.gridopt['boundary'])
        # transitter section
        self.fGHz = eval(self.txopt['fghz'])
        self.tx = np.array((eval(self.txopt['x']),eval(self.txopt['y'])))
        self.ptdbm = eval(self.txopt['ptdbm'])
        self.framelengthbytes = eval(self.txopt['framelengthbytes'])

        # receiver section
        self.rxsens = eval(self.rxopt['sensitivity'])
        kBoltzmann = 1.3806503e-23
        self.bandwidthmhz = eval(self.rxopt['bandwidthmhz'])
        self.temperaturek = eval(self.rxopt['temperaturek'])
        self.noisefactordb = eval(self.rxopt['noisefactordb'])

        
        Pn = (10**(self.noisefactordb/10.)+1)*kBoltzmann*self.temperaturek*self.bandwidthmhz*1e3
        self.pndbm = 10*np.log10(Pn)+60

        self.show = str2bool(self.showopt['show'])

        try:
            self.L.Gt.nodes()
        except:
            pass
        try:
            self.L.dumpr('t')
        except:
            self.L.buildGt()
            self.L.dumpw('t')

        self.creategrid(full=self.mode,boundary=self.boundary)

    def __repr__(self):
        st=''
        st= st+ 'tx :'+str(self.txopt) + '\n'
        st= st+ 'rx :'+str(self.rxopt) + '\n'

    def creategrid(self,full=True,boundary=[]):
        """ create a grid

        Parameters
        ----------
        full : boolean
            default (True) use all the layout area
        boundary : (xmin,ymin,xmax,ymax)
#.........这里部分代码省略.........
开发者ID:vostro2013,项目名称:pylayers,代码行数:103,代码来源:coverage.py

示例3: Layout

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]
from pylayers.gis.layout import Layout
import matplotlib.pyplot as plt 
import doctest 

#doctest.testmod(layout)


#L = Layout('TA-Office.ini')
L = Layout('DLR.ini')
try:
    L.dumpr()
except:
    L.build()
    L.dumpw()
#L.editor()
fig = plt.gcf()
#ax1  = fig.add_subplot(221)
ax1  = fig.add_subplot(321)
L.display['thin']=True
fig,ax1  = L.showGs(fig=fig,ax=ax1)
#L.display['edlabel']=True
#L.display['edlblsize']=50
# display selected segments
L.display['thin']=True
L.showG(fig=fig,ax=ax1,graph='t')
fig = plt.gcf()
ax1 = plt.gca()
fig,ax1 =  L.showGs(fig=fig,ax=ax1,edlist=[125],width=4)
ax11 = fig.add_subplot(322)
L.showG(fig=fig,ax=ax11,graph='')
#plt.savefig('graphGs.png')
开发者ID:mlaaraie,项目名称:pylayers,代码行数:33,代码来源:test_layout.py

示例4: Coverage

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]

#.........这里部分代码省略.........
        # AP section
        #self.fGHz = eval(self.txopt['fghz'])
        #self.tx = np.array((eval(self.txopt['x']),eval(self.txopt['y'])))
        #self.ptdbm = eval(self.txopt['ptdbm'])
        #self.framelengthbytes = eval(self.txopt['framelengthbytes'])

        # receiver section
        self.rxsens = eval(self.rxopt['sensitivity'])

        kBoltzmann = 1.3806503e-23
        self.temperaturek = eval(self.rxopt['temperaturek'])
        self.noisefactordb = eval(self.rxopt['noisefactordb'])

        # list of access points
        lap  = self.dap.keys()
        # list of channels
        lchan = map(lambda x: self.dap[x]['chan'],lap)

        apchan = zip(self.dap.keys(),lchan)
        self.bmhz = np.array(map(lambda x: self.dap[x[0]].s.chan[x[1][0]]['BMHz']*len(x[1]),apchan))
        # Evaluate Noise Power (in dBm)

        Pn = (10**(self.noisefactordb/10.)+1)*kBoltzmann*self.temperaturek*self.bmhz*1e3
        self.pndbm = 10*np.log10(Pn)+60

        # show section
        self.bshow = str2bool(self.showopt['show'])

        try:
            self.L.Gt.nodes()
        except:
            pass
        try:
            self.L.dumpr()
        except:
            self.L.build()
            self.L.dumpw()


    def __repr__(self):
        st=''
        st = st+ 'Layout file : '+self.L.filename + '\n\n'
        st = st + '-----list of Access Points ------'+'\n'
        for k in self.dap:
            st = st + self.dap[k].__repr__()+'\n'
        st = st + '-----Rx------'+'\n'
        st= st+ 'rxsens (dBm) : '+ str(self.rxsens) + '\n'
        st= st+ 'bandwith (Mhz) : '+ str(self.bmhz) + '\n'
        st= st+ 'temperature (K) : '+ str(self.temperaturek) + '\n'
        st= st+ 'noisefactor (dB) : '+ str(self.noisefactordb) + '\n\n'
        st = st + '--- Grid ----'+'\n'
        st= st+ 'nx : ' + str(self.nx) + '\n'
        st= st+ 'ny : ' + str(self.ny) + '\n'
        st= st+ 'nlink : ' + str(self.ng*self.na) + '\n'
        st= st+ 'full grid : ' + str(self.mode) + '\n'
        st= st+ 'boundary (xmin,ymin,xmax,ymax) : ' + str(self.boundary) + '\n\n'
        return(st)

    def creategrid(self,full=True,boundary=[]):
        """ create a grid

        Parameters
        ----------

        full : boolean
            default (True) use all the layout area
开发者ID:niamiot,项目名称:pylayers,代码行数:70,代码来源:coverage.py

示例5: Coverage

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]
class Coverage(PyLayers):
    """ Handle Layout Coverage

        Methods
        -------

        creategrid()
            create a uniform grid for evaluating losses
        cover()
            run the coverage calculation
        showPower()
            display the map of received power
        showLoss()
            display the map of losses


        Attributes
        ----------

        All attributes are read from fileini ino the ini directory of the
        current project

        _fileini
            default coverage.ini

        L     : a Layout
        nx    : number of point on x
        ny    : number of point on y
        tx    : transmitter position
        txpe  : transmitter power emmission level
        show  : boolean for automatic display power map
        na : number of access point

    """


    def __init__(self,_fileini='coverage.ini'):
        """ object constructor

        Parameters
        ----------

        _fileini : string
            name of the configuration file

        Notes
        -----

        Coverage is described in an ini file.
        Default file is coverage.ini and is placed in the ini directory of the current project.

        """


        self.config = ConfigParser.ConfigParser()
        self.config.read(pyu.getlong(_fileini,pstruc['DIRSIMUL']))

        self.layoutopt = dict(self.config.items('layout'))
        self.gridopt   = dict(self.config.items('grid'))
        self.apopt     = dict(self.config.items('ap'))
        self.rxopt     = dict(self.config.items('rx'))
        self.showopt   = dict(self.config.items('show'))

        # get the Layout
        filename = self.layoutopt['filename']
        if filename.endswith('ini'):
            self.typ = 'indoor'
            self.L = Layout(filename)

            # get the receiving grid
            self.nx = eval(self.gridopt['nx'])
            self.ny = eval(self.gridopt['ny'])
            self.mode = self.gridopt['mode']
            self.boundary = eval(self.gridopt['boundary'])
            self.filespa = self.gridopt['file']
            #
            # create grid
            #
            self.creategrid(mode=self.mode,boundary=self.boundary,_fileini=self.filespa)
            self.dap = {}
            for k in self.apopt:
                kwargs  = eval(self.apopt[k])
                ap = std.AP(**kwargs)
                self.dap[eval(k)] = ap
            try:
                self.L.Gt.nodes()
            except:
                pass
            try:
                self.L.dumpr()
            except:
                self.L.build()
                self.L.dumpw()


        else:
            self.typ='outdoor'
            self.E = ez.Ezone(filename)
            self.E.loadh5()
            self.E.rebase()
#.........这里部分代码省略.........
开发者ID:ahrovat,项目名称:pylayers,代码行数:103,代码来源:coverage.py

示例6: Simul

# 需要导入模块: from pylayers.gis.layout import Layout [as 别名]
# 或者: from pylayers.gis.layout.Layout import dumpr [as 别名]
class Simul(SimulationRT): # Sympy 2
#class Simul(sympy.RealtimeEnvironment):
    """

    Attributes
    ----------
    config  : config parser instance
    sim_opt : dictionary of configuration option for simulation
    ag_opt : dictionary of configuration option for agent
    lay_opt : dictionary of  configuration option for layout
    meca_opt : dictionary of  configuration option for mecanic
    net_opt : dictionary of  configuration option for network
    loc_opt : dictionary of  configuration option for localization
    save_opt : dictionary of  configuration option for save
    sql_opt : dictionary of  configuration option for sql

    Notes
    ------
     All the prvious dictionnary are obtained from the chosen simulnet.ini file
    in the project directory

    """
    def __init__(self):
        SimulationRT.__init__(self) #Sympy 2
        #sympy.RealtimeEnvironment.__init__(self)  #simpy 3
        self.initialize()
        self.config = ConfigParser.ConfigParser()
        filename = pyu.getlong('simulnet.ini','ini')
        self.config.read(filename)
        self.sim_opt = dict(self.config.items('Simulation'))
        self.lay_opt = dict(self.config.items('Layout'))
        self.meca_opt = dict(self.config.items('Mechanics'))
        self.net_opt = dict(self.config.items('Network'))
        self.loc_opt = dict(self.config.items('Localization'))
        self.save_opt = dict(self.config.items('Save'))
        self.sql_opt = dict(self.config.items('Mysql'))

        self.verbose = str2bool(self.sim_opt['verbose'])
        if str2bool(self.net_opt['ipython_nb_show']):
            self.verbose = False
        self.roomlist=[]

        self.create()

    def create_layout(self):
        """
        Create Layout in Simpy the_world thanks to Tk backend

        """

        self.the_world = world(width = float(self.lay_opt['the_world_width']), 
                               height = float(self.lay_opt['the_world_height']),
                               scale=float(self.lay_opt['the_world_scale']))

        # tk = self.the_world.tk
        # canvas, x_, y_ = tk.canvas, tk.x_, tk.y_
        # canvas.create_rectangle(x_(-1), y_(-1), x_(100), y_(100), fill='white')

        _filename = self.lay_opt['filename']
        #sl=Slab.SlabDB(self.lay_opt['slab'],self.lay_opt['slabmat'])
        #G1   = Graph.Graph(sl=sl,filename=_filename)
        self.L = Layout(_filename)
        #if _filename.split('.')[1] == 'str':
        #    self.L.loadstr(_filename)
        #elif _filename.split('.')[1] == 'str2':
        #    self.L.loadstr2(_filename)
        #elif _filename.split('.')[1] == 'ini':
        #    self.L.loadini(_filename)


        try:
            self.L.dumpr()
            print 'Layout graphs are loaded from ',basename,'/struc/ini'
        except:
        #self.L.sl = sl
        #self.L.loadGr(G1)
            print 'This is the first time the layout file is used\
            Layout graphs are curently being built, it may take few minutes.'
            self.L.build()     
            self.L.dumpw()
        x_offset = 0  # float(self.lay_opt['x_offset'])
        y_offset = 0  # float(self.lay_opt['y_offset'])
        for ks in self.L.Gs.pos.keys():
            self.L.Gs.pos[ks] = (self.L.Gs.pos[ks][0] +
                                 x_offset, self.L.Gs.pos[ks][1] + y_offset)
        for ks in self.L.Gr.pos.keys():
            self.L.Gr.pos[ks] = (self.L.Gr.pos[ks][0] +
                                 x_offset, self.L.Gr.pos[ks][1] + y_offset)
        for ks in self.L.Gw.pos.keys():
            self.L.Gw.pos[ks] = (self.L.Gw.pos[ks][0] +
                                 x_offset, self.L.Gw.pos[ks][1] + y_offset)

        #
        # Create Layout
        #
        walls = self.L.thwall(0, 0)
        for wall in walls:
            points = []
            # for point in wall:
            #          points.append(x_(point[0]))
#.........这里部分代码省略.........
开发者ID:iulia-ia13,项目名称:pylayers,代码行数:103,代码来源:simulnet.py


注:本文中的pylayers.gis.layout.Layout.dumpr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。