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


Python Location.setPlaceId方法代码示例

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


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

示例1: makeNoisyCopy

# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import setPlaceId [as 别名]
    def makeNoisyCopy(self, b_GPSNoise=True):   #makes and returns a noisy copy
        ec = ECState(self)

        p_flip = 0.2
        p_flip_odom = 0.2   #testing, make the grids,hds very unreliable (TODO iterative training??)

        if b_GPSNoise:
            if random.random()<p_flip_odom:    #simulate grid errors- fmove to a random place (as when lost)
                #N_places = 13 # Luke arguments sent in at top!
                i = random.randrange(0,self.N_places) # Luke converted to self 
                loc = Location()
                loc.setPlaceId(i)
                ec.grids = loc.getGrids().copy()

            if random.random()<p_flip_odom:    #simulate HD errors
                i = random.randrange(0,4) 
                ec.hd[:] = 0
                ec.hd[i] = 1
            ##if random.random()< 0.05:  ####simulate lost/reset events WRITEUP: EM like estimation of own error rate needed here (cf. Mitch's chanel equalisation decision feedback/decision directed)
            ##    ec.placeCells = 0.0 * ec.placeCells
            ##    ec.hd = 0.0 * ec.hd  ##no this isnt what we want to do -- we dont want to leatn flatness as an OUTPUT!
    

        if random.random()<p_flip:    #flip whiskers
            ec.whiskers[0] = 1-ec.whiskers[0]
        if random.random()<p_flip:    #flip whiskers
            ec.whiskers[0] = 1-ec.whiskers[0]
        if random.random()<p_flip:    #flip whiskers
            ec.whiskers[1] = 1-ec.whiskers[1]
        if random.random()<p_flip:    #flip whiskers
            ec.whiskers[2] = 1-ec.whiskers[2]
        if random.random()<p_flip:    #flip lightAhead
            ec.lightAhead = 1-ec.lightAhead
        if random.random()<p_flip:    #flip colors
            ec.rgb[0] = 1-ec.rgb[0]
        if random.random()<p_flip:    #flip colors
            ec.rgb[1] = 1-ec.rgb[1]
        for featureInd, feature in enumerate(ec.surfs): #ALAN implemented flipping
            if random.random()<p_flip:
                ec.surfs[featureInd] = 1-feature
        return ec
开发者ID:lukeboorman,项目名称:streetview_icub,代码行数:43,代码来源:paths.py

示例2: __init__

# 需要导入模块: from location import Location [as 别名]
# 或者: from location.Location import setPlaceId [as 别名]
    def __init__(self, p_odom, p_senses, dghelper=None, n_places=13):
        i=0
        n_grids=6
        n_hd=4
        # AGAIN n_places
        # Luke removed! n_places=13

        #pdb.set_trace()

        p_grids  = p_odom[i:i+n_grids];   i+=n_grids
        p_hd     = p_odom[i:i+n_hd];      i+=n_hd
        p_places = p_odom[i:i+n_places];  i+=n_places

        i=0
        n_whiskers=3
        n_rgb=3
        n_lightAhead=1
        n_whiskerCombis=3
        
        p_whiskers = p_senses[i:i+n_whiskers]; i+=n_whiskers
        p_rgb = p_senses[i:i+n_rgb]; i+=n_rgb
        p_lightAhead = p_senses[i:i+n_lightAhead]; i+=n_lightAhead
        p_whiskerCombis = p_senses[i:i+n_whiskerCombis]; i+=n_whiskerCombis

        #HOOK: put your decoding of output (whatever representation that is...., here)
        #decode remaining sensors which are the features previously encoded
        if dghelper is not None:
            #Get the number of surf features
            n_surfFeatures = dghelper.numOfSurfFeatures
            #Get the number of encoded features
            n_encoded = dghelper.numOfEncodedFeatures
            #print("Num of surf features: %d\nNum of encodedFeatures: %d\nNum of all feautres: %d" % (n_surfFeatures, n_encoded, (n_surfFeatures+n_encoded)))
            p_surfFeatures = p_senses[i:i+n_surfFeatures]; i+=n_surfFeatures
            p_encoded = p_senses[i:i+n_encoded]; i+=n_encoded

            #We now have two sources of surf, one from the probabilities that came from EC into CA3, and one from the DG encoded going into CA3
            #Dumb decode the former:
            surfFromEC = (p_surfFeatures>0.5)

            #Very smart decode... use the weights learnt to decode back to EC space
            surfFromDG = dghelper.decode(p_encoded)

            #Experiment with using both see what advantage DG gives over EC
            self.surfs = surfFromDG

        #print("Total length of senses:%d, used:%d" % (len(p_senses), i))

        #smart decoding, use smart feature collapse, then create ECd pops here too
        self.places = smartCollapse(p_places)
        self.hd = smartCollapse(p_hd)
        #print("p_whiskerCombis: %s" % p_whiskerCombis)
        self.whiskerCombis = smartCollapse(p_whiskerCombis)
        
        loc=Location()
        loc.setPlaceId(argmax(self.places))
        self.grids=loc.getGrids()

        #dumb decodes
        self.lightAhead = (p_lightAhead>0.5)
        self.rgb = (p_rgb>0.5)

        #print("whisker combis: %s" % self.whiskerCombis)
        #whiskers
        if self.whiskerCombis[0]:
            self.whiskers=np.array([1,1,1])  #all
        elif self.whiskerCombis[1]:
            #print(self.places)
            #print("no whiskers touching")
            self.whiskers=np.array([0,0,0])  #none
        elif self.whiskerCombis[2]:
            #print("left right whiskers touching")
            self.whiskers=np.array([1,0,1])  #L+R
开发者ID:lukeboorman,项目名称:streetview_icub,代码行数:74,代码来源:paths.py


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