Пример #1
0
def letterToArm(letter):
    """converts a letter to an articulatory model representation of handshape"""
    try:
        let = letterCodingCols[letter]
    except KeyError:
        print("That is not a recognized letter")
        raise
    psf = hs.selectedFingers(
        members = let["psf-members"].split(","), 
        MCP=let["psf-mcp"], 
        PIP=let["psf-pip"], 
        abd=hs.abduction(let["psf-abd"])
        )
    if(let["ssf-members"] == "None"):
        ssf = None
    else:
        ssf = hs.secondarySelectedFingers(
            members = let["ssf-members"].split(","), 
            MCP=let["ssf-mcp"], 
            PIP=let["ssf-pip"],
            abd=hs.abduction(let["ssf-abd"])
            )        
    if(let["thumb-oppos"] == "None"):
        thmb = None
    else:
        thmb = hs.thumb(oppos=let["thumb-oppos"])
    if(let["nsf-joints"] == "None"):
        nsf = None
    else:
        nsf = hs.nonSelectedFingers(joints=let["nsf-joints"])    
    handshape = hs.handshape(
        selectedFingers = psf,
        secondarySelectedFingers = ssf,
        thumb = thmb,
        nonSelectedFingers = nsf
        )
    orientation = let["orientation"]
    return hs.arm(handshape=handshape, orientation=orientation)
Пример #2
0
 def toAMhandshape(self):
     # set default value for the thumb: opposed
     oppos = "opposed"
     # translate the selected fingers        
     if self.SF.fing:
         sfMem = shortToMember(bsfingerCodingCols[self.SF.fing]['fingers'])
     if self.SF.thumb and self.SF.thumb == "T" :
         try:
             sfMem.append("thumb")
         except UnboundLocalError:
             sfMem = ["thumb"]            
     if self.SF.oppos and self.SF.oppos == "-":
         oppos = "unopposed"
     else:
         oppos = "opposed"
     if self.SF.abd:
         sfAbd = psfabdCodingCols[self.SF.abd]['abd']
     else:
         sfAbd = None
     if self.SF.joint:
         sfMCP = psfjointCodingCols[self.SF.joint]['MCP']
         sfPIP = psfjointCodingCols[self.SF.joint]['PIP']
     else:
         sfMCP = psfjointCodingCols['empty']['MCP']
         sfPIP = psfjointCodingCols['empty']['PIP']
     sf =  hs.selectedFingers(members = sfMem, MCP=sfMCP, PIP=sfPIP, abd=sfAbd)
     # translate the secondary selected fingers
     if self.SSF:
         if self.SSF.fing:
             ssfMem = shortToMember(bsfingerCodingCols[self.SSF.fing]['fingers'])
         if self.SSF.thumb and self.SSF.thumb == "T" :
             try:
                 ssfMem.append("thumb")
             except UnboundLocalError:
                 ssfMem = ["thumb"]
         if self.SSF.oppos and self.SSF.oppos == "-":
             oppos = "unopposed"
         else:
             oppos = "opposed"
         if self.SSF.abd:
             ssfAbd = ssfabdCodingCols[self.SSF.abd]['abd']
         else:
             ssfAbd = None
         if self.SSF.joint:
             ssfMCP = ssfjointCodingCols[self.SSF.joint]['MCP']
             ssfPIP = ssfjointCodingCols[self.SSF.joint]['PIP']
         else:
             ssfMCP = ssfjointCodingCols['empty']['MCP']
             ssfPIP = ssfjointCodingCols['empty']['PIP']
         ssf = hs.secondarySelectedFingers(members = ssfMem, MCP=ssfMCP, PIP=ssfPIP, abd=ssfAbd)
     else:
         ssf = None
     # translate the nonselected fingers
     if self.NSF:
         if self.NSF.joint:
             ssfJoints = nsfjointCodingCols[self.NSF.joint]['MCP']
         else:
             ssfJoints = None
         nsf = hs.nonSelectedFingers(joints=ssfJoints)
     else:
         nsf = None
     thumb = hs.thumb(oppos=oppos)
     AMhandshape = hs.handshape(selectedFingers = sf, secondarySelectedFingers = ssf, thumb = thumb, nonSelectedFingers = nsf )
     return AMhandshape