• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python transform.Transform类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中transform.Transform的典型用法代码示例。如果您正苦于以下问题:Python Transform类的具体用法?Python Transform怎么用?Python Transform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

 def __init__(self, parent_transform = None, 
               rename = False, 
               recursive = False):
   Transform.__init__(self)
   self.rename = rename 
   self.recursive = recursive
   self.parent_transform = parent_transform 
开发者ID:Tillsten,项目名称:parakeet,代码行数:7,代码来源:clone_function.py


示例2: __init__

 def __init__(self, pi_creature, *args, **kwargs):
     blinked = deepcopy(pi_creature).blink()
     Transform.__init__(
         self, pi_creature, blinked,
         alpha_func = squish_alpha_func(there_and_back),
         *args, **kwargs
     )
开发者ID:nachinius,项目名称:animations,代码行数:7,代码来源:simple_animations.py


示例3: transform_expr

 def transform_expr(self, expr):
   if self.is_simple(expr):
     return Transform.transform_expr(self, expr)
   
   stored = self.available_expressions.get(expr)
   if stored is not None: 
     return stored
   return Transform.transform_expr(self, expr)
开发者ID:Tillsten,项目名称:parakeet,代码行数:8,代码来源:simplify.py


示例4: post_apply

 def post_apply(self, fn):
   type_env = {}
   for (name,t) in fn.type_env.iteritems():
     if self.is_live(name):
       type_env[name] = t
   fn.type_env = type_env
   Transform.post_apply(self, fn)
   return fn
开发者ID:Tillsten,项目名称:parakeet,代码行数:8,代码来源:dead_code_elim.py


示例5: transform

def transform(args, x_queue, datadir, fname_index, joint_index, o_queue):
    trans = Transform(args)
    while True:
        x = x_queue.get()
        if x is None:
            break
        x, t = trans.transform(x.split(','), datadir, fname_index, joint_index)
        o_queue.put((x.transpose((2, 0, 1)), t))
开发者ID:cybermatt,项目名称:deeppose,代码行数:8,代码来源:train.py


示例6: __init__

class Entity:
    def __init__(self):
        self._type = ''
        self._id = ''
        self._category = ''
        self._level = ''
        self.guid = guid()
        self.transform = Transform()

    def loadDb3(self, db3File, guid):
        self.guid = guid
        self._category = db3File.queryEntityData(guid, '_Category')
        self._level = db3File.queryEntityData(guid, '_Level')
        self.transform.matrix.set([float(i) for i in db3File.queryEntityData(guid, 'Transform').split(',')])
        self.transform.setMatrix()

    def saveDb3(self, db3File):
        if self._id:
            db3File.updateEntityData(self.guid, '_ID', self._id + ' (' + self._level + ')')
        if self._category:
            db3File.updateEntityData(self.guid, '_Category', self._category)
        if self._level:
            db3File.updateEntityData(self.guid, '_Level', self._level)
        if self.transform:
            db3File.updateEntityData(self.guid, 'Transform', ', '.join([str(i) for i in self.transform.matrix.get()]))

    def setAttributes(self, attrs):
        if 'name' in attrs:
            self._id = attrs['name']
        if 'pos' in attrs:
            self.transform.position = [float(i) for i in attrs['pos'].split()]
        if 'rot' in attrs:
            self.transform.rotation = [float(i) for i in attrs['rot'].split()]
        if 'scale' in attrs:
            self.transform.scale = [float(i) for i in attrs['scale'].split()]
        self.transform.getMatrix()

    def getAttributes(self):
        attrs = {}
        if self._id:
            attrs['name'] = self._id
        if len(self.transform.position):
            attrs['pos'] = ' '.join([str(i) for i in self.transform.position])
        if len(self.transform.rotation):
            attrs['rot'] = ' '.join([str(i) for i in self.transform.rotation])
        if len(self.transform.scale):
            attrs['scale'] = ' '.join([str(i) for i in self.transform.scale])
        return attrs

#-------------------------------------------------------------------------------
# Eof
#-------------------------------------------------------------------------------
开发者ID:Teivaz,项目名称:nebula2,代码行数:52,代码来源:entity.py


示例7: __init__

  def __init__(self):
    Transform.__init__(self)
    self.adverbs_visited = []
    self.adverb_args = []
    self.expansions = {}
    self.exp_stack = []
    self.type_env_stack = []
    self.dl_tile_estimates = []
    self.ml_tile_estimates = []

    # For now, we'll assume that no closure variables have the same name.
    self.closure_vars = {}

    self.num_tiles = 0
开发者ID:Tillsten,项目名称:parakeet,代码行数:14,代码来源:tile_adverbs.py


示例8: deserialize

    def deserialize(cls, obj):
        transformations = []
        for transform in obj['transformations']:
            transformations.append(Transform.deserialize(transform))

        return cls(obj['width'], obj['height'],
                   obj['seed'], obj['points'], obj['iterations'],
                   transformations)
开发者ID:web-user,项目名称:python,代码行数:8,代码来源:fractalbuilder.py


示例9: transform_expr

 def transform_expr(self, expr):
   if not isinstance(expr, syntax.Expr):
     expr = ast_conversion.value_to_syntax(expr)
   
   result = Transform.transform_expr(self, expr)  
   assert result.type is not None,  \
     "Unsupported expression encountered during type inference: %s" % (expr,)
   return result 
开发者ID:cournape,项目名称:parakeet,代码行数:8,代码来源:type_inference.py


示例10: __init__

  def __init__(self,
               nesting_idx = -1,
               fixed_idx = -1,
               tile_sizes_param = None,
               fixed_tile_sizes = None,
               preallocate_output = False):
    Transform.__init__(self)
    self.nesting_idx = nesting_idx
    self.fixed_idx = fixed_idx
    self.tiling = False
    self.tile_sizes_param = tile_sizes_param
    self.fixed_tile_sizes = fixed_tile_sizes
    self.output_var = None
    self.preallocate_output = preallocate_output

    # For now, we'll assume that no closure variables have the same name.
    self.closure_vars = {}
开发者ID:lucciano,项目名称:parakeet,代码行数:17,代码来源:lower_tiled_adverbs.py


示例11: transform_block

 def transform_block(self, stmts, keep_bindings = False):
   self.available_expressions.push()
   self.bindings.push()
   new_stmts = Transform.transform_block(self, stmts)
   
   self.available_expressions.pop()
   if not keep_bindings:
     self.bindings.pop()
   return new_stmts
开发者ID:Tillsten,项目名称:parakeet,代码行数:9,代码来源:simplify.py


示例12: tuple_proj

 def tuple_proj(self, tup, idx, explicit_struct = False):
   if tup.__class__ is Var and tup.name in self.bindings:
     stored = self.bindings[tup.name]
     if stored.__class__ is Tuple:
       return stored.elts[idx]
     else:
       return stored.args[idx]
   else:
     return Transform.tuple_proj(self, tup, idx,
                                 explicit_struct = explicit_struct)
开发者ID:lucciano,项目名称:parakeet,代码行数:10,代码来源:lower_indexing.py


示例13: __init__

    def __init__(self, start_anim, end_anim, **kwargs):
        digest_config(self, kwargs, locals())
        if "run_time" in kwargs:
            self.run_time = kwargs.pop("run_time")
        else:
            self.run_time = max(start_anim.run_time, end_anim.run_time)
        for anim in start_anim, end_anim:
            anim.set_run_time(self.run_time)
            
        if start_anim.starting_mobject.get_num_points() != end_anim.starting_mobject.get_num_points():
            Mobject.align_data(start_anim.starting_mobject, end_anim.starting_mobject)
            for anim in start_anim, end_anim:
                if hasattr(anim, "ending_mobject"):
                    Mobject.align_data(anim.starting_mobject, anim.ending_mobject)

        Transform.__init__(self, start_anim.mobject, end_anim.mobject, **kwargs)
        #Rewire starting and ending mobjects
        start_anim.mobject = self.starting_mobject
        end_anim.mobject = self.ending_mobject
开发者ID:mherkazandjian,项目名称:manim,代码行数:19,代码来源:meta_animations.py


示例14: attr

  def attr(self, obj, field):
    if obj.__class__ is Var and obj.name in self.bindings:
      stored = self.bindings[obj.name]
      stored_class = stored.__class__
      if stored_class is Struct:
        pos = stored.type.field_pos(field)
        return stored.args[pos]
      elif stored_class  is Slice or stored_class is ArrayView:
        return getattr(stored, field)

    return Transform.attr(self, obj, field)
开发者ID:lucciano,项目名称:parakeet,代码行数:11,代码来源:lower_indexing.py


示例15: transform_Assign

 def transform_Assign(self, stmt):
     """
 If you encounter an adverb being written to an output location, 
 then why not just use that as the output directly? 
 """
     if stmt.lhs.__class__ is Index:
         rhs_class = stmt.rhs.__class__
         if rhs_class is Map:
             self.transform_Map(stmt.rhs, output=stmt.lhs)
             return None
         elif rhs_class is OuterMap:
             self.transform_OuterMap(stmt.rhs, output=stmt.lhs)
     return Transform.transform_Assign(self, stmt)
开发者ID:rjpower,项目名称:parakeet,代码行数:13,代码来源:indexify_adverbs.py


示例16: pwmControlThread

def pwmControlThread():
    # setup arduino serial comm
    pwm.setPWMFreq(50)
    t = Transform(True, False) #invert one motor and not the other when constructing
    watchdog = time.time()

    # thread main loop
    while True:
	time.sleep(.005)
        # check for data that needs to be bridged to arduino
        dataFlag = True
        if not serialRealTimeQueue.empty():
            data = serialRealTimeQueue.get()
        else:
            dataFlag = False

        # if data was recieved parse and update pwm hat
        if dataFlag:
            data = data[5:-1]
            print data
            data_nums = [int(x) for x in data.split(':') if x.strip()]
            print " ", data_nums[0], " ", data_nums[1]
            leftMtr,rightMtr = t.transform(data_nums[0],data_nums[1])
            print " ", leftMtr , " ", rightMtr
            setServoPulse(LEFT_MOT, leftMtr)
            setServoPulse(RIGHT_MOT, rightMtr)

            Transform.MOTOR_MIN = data_nums[5]*10
            Transform.MOTOR_IDLE = data_nums[6]*10
            Transform.MOTOR_MAX = data_nums[7]*10


            leftIntake = Transform.MOTOR_IDLE
            rightIntake = Transform.MOTOR_IDLE
            if data_nums[2] > 127 + 10: # if left trigger pressed (i think) spin motors in opposite direction
                leftIntake = Transform.map_range(data_nums[2],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MAX)
                rightIntake = Transform.map_range(data_nums[2],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MIN)
            elif data_nums[3] > 127 + 10: # if right trigger pressed
                leftIntake = Transform.map_range(data_nums[3],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MIN)
                rightIntake = Transform.map_range(data_nums[3],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MAX)
            else :
                leftIntake = Transform.MOTOR_IDLE
                rightIntake = Transform.MOTOR_IDLE
 
            print " " , leftIntake, " ", rightIntake

            setServoPulse(LEFT_MANIP,leftIntake)
            setServoPulse(RIGHT_MANIP,rightIntake)

            watchdog = time.time()

        if watchdog + WATCHDOG_DELAY < time.time():
            setServoPulse(LEFT_MOT, Transform.MOTOR_IDLE)
            setServoPulse(RIGHT_MOT, Transform.MOTOR_IDLE)
            setServoPulse(LEFT_MANIP, Transform.MOTOR_IDLE)
            setServoPulse(RIGHT_MANIP, Transform.MOTOR_IDLE)

            watchdog = time.time()
            print "you need to feed the dogs"
开发者ID:Saint-Francis-Robotics-Team2367,项目名称:yunServerSoftware,代码行数:59,代码来源:server.py


示例17: ClientCommander

class ClientCommander(Character):
    def __init__(self, screen, server_commander):
        super(Character, self).__init__()
        self.screen = screen
        self.t = Transform(screen, (0, 100, 0, 100))
        self.server_commander = server_commander

    def key_control(self, key, event):
        Character.key_control(self, key, event)
        # Custom comamnder control

    def mouse_control(self, mouse_pos):
        pass

    def click_control(self, mouse_pos, button):
        removed = False
        wp = self.t.inv_transform_coord(mouse_pos)
        for waypoint in self.server_commander.waypoints:
            if dist(waypoint[0], waypoint[1], wp[0], wp[1]) < 0.25:
                self.server_commander.rmwp(waypoint[0], waypoint[1])
                removed = True
                break
        if not removed:
            self.server_commander.addwp(wp[0], wp[1])

    def update(self, game_map):
        pass

    def draw(self, game_map):
        self.t.update_viewport((0, game_map.rows, 0, game_map.cols))
        draw_bg(self.screen, self.t)
        draw_walls(self.screen, self.t, game_map)
        draw_hero(self.screen, self.t, game_map)
        draw_units(self.screen, self.t, game_map)
        draw_bullets(self.screen, self.t, game_map)
        draw_waypoints(self.screen, self.t, game_map)
        draw_letterbox(self.screen, self.t)
开发者ID:jerrywu64,项目名称:HeroRTS,代码行数:37,代码来源:client_commander.py


示例18: __init__

 def __init__(self, screen, server_hero):
     """
     screen: PyGame Surface object.
     t: Transform object to convert game coords to screen coords.
     server_hero: Temp reference to server hero object...
     """
     super(Character, self).__init__()
     self.screen = screen
     self.t = Transform(screen, (0, ClientHero.VIEW_SQ_RADIUS*2,
                                 0, ClientHero.VIEW_SQ_RADIUS*2))
     self.server_hero = server_hero
     self.vel = (0, 0)
     self.firing = False
     self.fired = False
     self.font = pygame.font.SysFont("monospace", 24)
开发者ID:jerrywu64,项目名称:HeroRTS,代码行数:15,代码来源:client_hero.py


示例19: __init__

    def __init__(self, fname='/dev/ttyACM0', brate=1000000, dim=(12,10), gamma=2.2):
        """
Initialise a LedScreen object.

>>> screen = LedScreen()
        """
        if type(dim) not in (tuple, list) or len(dim) != 2:
            raise ValueError("Invalid dimension. Format is tuple(x,y)")
        abstractled.AbstractLed.__init__(self, dimension=dim, gamma=gamma)
        self.tty = uspp.SerialPort(fname, timeout=0)
        #self.tty = uspp.SerialPort(fname, speed=brate, timeout=0)
        os.environ['LEDWALL_TTY'] = fname
        os.system("stty -F $LEDWALL_TTY " + str(brate))

        self.transform = Transform(*dim)
        self.b = [(0,0,0)] * self.w * self.h
开发者ID:elout,项目名称:lewd,代码行数:16,代码来源:led.py


示例20: __init__

    def __init__(self,args):

        # create logger
        self.logger = logging.getLogger(__name__)
        self.logger.setLevel(logging.DEBUG)
        
        # create console handler and set level to debug
        ch = logging.StreamHandler()
        ch.setLevel(logging.DEBUG)
        
        # create formatter
        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        
        # add formatter to ch
        ch.setFormatter(formatter)
        
        # add ch to logger
        self.logger.addHandler(ch)        
        self.logger.debug( "Starting Collector process in %s"%os.getcwd())
        #self.logger.debug( "Gevent Version %s"%gevent.__version__)
        
        #TODO: move output file name to config
        fname = "./NetFlow.%d.bin"%int(time.time())
        
        #WARN: might want to remove this after testing
        self.out = open(fname,"wb")
        
        #create tool instances
        self.interface = Interface()
        self.parse = Parse()
        self.context = Context()
        self.describe = Describe()
        self.standardize = Standardize()
        self.transform = Transform()
        self.partition = Partition()
        
        self.q = Queue()
        
        self.inWindow = settings.SETTINGS.get("collector","inWindow")
        
        self.score = Score()
        #TODO: move csv name to config
        #self.csv = CSV("output.csv")
        
        self.output = Output()
        
        return super(Collector,self).__init__(args)
开发者ID:Foxeh,项目名称:NetFlow-Collector,代码行数:47,代码来源:main.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python transformations.euler_from_matrix函数代码示例发布时间:2022-05-27
下一篇:
Python eager.transduce函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap