Ejemplo n.º 1
0
def Stockaufsatz(matrixnew,extractedstep,Einheitsvektor ="rE1"):
    re1 = Init.getData(matrixnew,sensors=["RNS","LNS"],datas=[ Einheitsvektor])
    ACC = Init.getData(matrixnew,sensors=["RNS","LNS"],datas=["acc"],specifiedDatas="x")
    ACCright =  Ableitung(ACC[:,:],[2],1)[:,2:]
    ACCleft = Ableitung(ACC[:,:],[3],1)[:,2:]


    Vektor = np.zeros((len(re1),3))
    Vektor[:,2] = 1
    anlematrixre1 = angle(re1[:,2:5],Vektor)
    anlematrixre = angle(re1[:,5:8],Vektor)
    anglestickright = anlematrixre1[:,0]
    anglestickleft = anlematrixre[:,0]

    rightpeak = []
    leftpeak = []
    for i in range(0,len(extractedstep)):
        posleft = (np.argmax(ACCleft[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        leftpeak.append(anglestickleft[(extractedstep[i,0])+posleft,0])
        posright = (np.argmax(ACCright[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        rightpeak.append(anglestickright[(extractedstep[i,0])+posright,0])


    print rightpeak

    return rightpeak,leftpeak
Ejemplo n.º 2
0
def Passgang(matrixnew,extractedstep):
    ACC = Init.getData(matrixnew,sensors=["RNS","LLL"],datas=["acc"],specifiedDatas="x")
    ACC2 = Init.getData(matrixnew,sensors=["LNS","RLL"],datas=["acc"],specifiedDatas="x")

    ACC = Ableitung(ACC[:,:],[2,3],1)[:,2:]
    ACC2 = Ableitung(ACC2[:,:],[2,3],1)[:,2:]
    zeitverschiebung =[]
    zeitverschiebunglinks =[]
    for i in range(0,len(extractedstep)):

        maxpos = (np.argmax(ACC2[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        minpos= (np.argmax(ACC2[(extractedstep[i,0]):(extractedstep[i,1]),1]))
        print abs(maxpos-minpos)
        print "_______"
        print (extractedstep[i,1]-extractedstep[i,0])
        zeitverschiebung.append(float(abs(maxpos-minpos))/float((extractedstep[i,1]-extractedstep[i,0])))
        maxpos = (np.argmax(ACC[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        minpos= (np.argmax(ACC[(extractedstep[i,0]):(extractedstep[i,1]),1]))
        zeitverschiebunglinks.append(float(abs(maxpos-minpos))/float((extractedstep[i,1]-extractedstep[i,0])))


    vereinigung=[]
    for j in range(0,len(zeitverschiebunglinks)):
        if(zeitverschiebung[j]>=zeitverschiebunglinks[j]):
            vereinigung.append(zeitverschiebunglinks[j])
        else: vereinigung.append(zeitverschiebung[j])
    plt.plot(vereinigung)
    plt.show()
    return vereinigung
Ejemplo n.º 3
0
def Fussabrollen(matrixnew,extractedstep):
    ACC = Init.getData(matrixnew,sensors=["RLL","LLL"],datas=["acc"],specifiedDatas="x")
    ACCright =  Ableitung(ACC[:,:],[2],1)[:,2:]
    ACCleft = Ableitung(ACC[:,:],[3],1)[:,2:]




    anlematrixre1 = winkelgesamt(matrixnew,Sensoren=["RUA","RLA"])
    anlematrixre = winkelgesamt(matrixnew,Sensoren=["LUA","LLA"])
    anglestickright = anlematrixre1
    anglestickleft = anlematrixre
    plt.plot(anglestickleft)
    plt.plot(anglestickright)
    plt.show()

    rightpeak = []
    leftpeak = []
    for i in range(0,len(extractedstep)):
        posleft = (np.argmax(ACCleft[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        leftpeak.append(anglestickleft[(extractedstep[i,0])+posleft])
        posright = (np.argmax(ACCright[(extractedstep[i,0]):(extractedstep[i,1]),0]))
        rightpeak.append(anglestickright[(extractedstep[i,0])+posright])


    print rightpeak

    return rightpeak,leftpeak
Ejemplo n.º 4
0
def aufrechtgehen(matrixnew, extractedstep):
        back = Init.getData(matrixnew,sensors=["STE","CEN"],datas=[ "rE1"])
        Vektor = np.zeros((len(back),3))
        Vektor[:,0] = 1
        angleSTEmovement = angle(back[:,2:5],Vektor)
        angleCENmovement = angle(back[:,5:8],Vektor)
        Vektor[:,0] = 0
        Vektor[:,2] = 1
        angleSTEupwards = angle(back[:,2:5],Vektor)
        angleCENupwards = angle(back[:,5:8],Vektor)
        angleSTEupwardsstep = []
        angleSTEmovementstep =[]
        angleSTEmovementstep = []
        angleCENupwardsstep = []
        for i in range(0,len(extractedstep)):
            angleCENupwardsstep.append(np.sum(angleCENupwards[(extractedstep[i,0]):(extractedstep[i,1])])/((extractedstep[i,1])-(extractedstep[i,0])))
            angleSTEupwardsstep.append(np.sum(angleSTEupwards[(extractedstep[i,0]):(extractedstep[i,1])])/((extractedstep[i,1])-(extractedstep[i,0])))


        plt.subplot(2,1,1)
        plt.plot(angleSTEupwardsstep)
        plt.subplot(2,1,2)

        plt.plot(angleCENupwardsstep)
        plt.show()
        difference = (np.absolute([x-y for x,y in zip(angleCENupwardsstep,angleSTEupwardsstep)]))
        return  angleSTEupwardsstep,angleCENupwardsstep, difference
Ejemplo n.º 5
0
def sensorwinkel(matrixnew, extractedstep, Sensoren= ["RUA","RLA"]):
    re1 = Init.getData(matrixnew,sensors=Sensoren,datas=[ "rE1","rE2","rE3"])
    anlematrixre1 = angle(re1[:,11:14],re1[:,2:5])
    anglearm = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,14:17],re1[:,5:8])
    anglearm2 = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,17:20],re1[:,8:11])
    anglearm3 = anlematrixre1[:,0]
    anglecomb= [ ]

    for i in range(0,len(anglearm)):
        anglecomb.append(np.sqrt((np.square(anglearm2[i,0]))+(np.square(anglearm[i,0]))+(np.square(anglearm3[i,0]))))

    print anglecomb
    maxanglearm = []
    minanglearm = []
    for i in range(0,len(extractedstep)):
        maxpos = (np.argmax(anglecomb[(extractedstep[i,0]):(extractedstep[i,1])]))
        maxanglearm.append((anglecomb[(extractedstep[i,0])+maxpos]))
        minpos= (np.argmin(anglecomb[(extractedstep[i,0]):(extractedstep[i,1])]))
        minanglearm.append(anglecomb[(extractedstep[i,0])+minpos])

    angleE = np.c_[minanglearm,maxanglearm]
    print "---------------------------------------------------------------------"
    angleE= 180-angleE
    return angleE
Ejemplo n.º 6
0
def findsync(dataMatrix):

    datamatrix = Init.getData(dataMatrix,sensors=["STE"],datas=[ "acc"])
    signal= dataMatrix[:,2]
    maxAbsValue, maxAbsFreq = FourierTransformation.maxAbsFreq(signal)
    Filtered = FeatureKonstruktion.filter(datamatrix,[2,3,4],maxAbsFreq)
    plt.plot(Filtered[:,2:])
    plt.show()
Ejemplo n.º 7
0
def winkelgesamt(matrixnew,Sensoren= ["RUA","RLA"]):
    re1 = Init.getData(matrixnew,sensors=Sensoren,datas=[ "rE1","rE2","rE3"])
    print len(matrixnew)
    anlematrixre1 = angle(re1[:,11:14],re1[:,2:5])
    anglearm = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,14:17],re1[:,5:8])
    anglearm2 = anlematrixre1[:,0]
    anlematrixre1 = angle(re1[:,17:20],re1[:,8:11])
    anglearm3 = anlematrixre1[:,0]
    anglecomb= [ ]
    plt.plot(anglearm)
    plt.plot(anglearm2)
    plt.plot(anglearm3)
    plt.show()
    for i in range(0,len(anglearm)):
        anglecomb.append(np.sqrt((np.square(anglearm2[i,0]))+(np.square(anglearm[i,0]))+(np.square(anglearm3[i,0]))))
    print len(anglecomb)
    return anglecomb
Ejemplo n.º 8
0
#
# Copyright (C) 2004 Daniel Larsson
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

import Init

# Add the languages we support
Init.add_translation('remus-server', 'sv', 'Swedish',
                     'sv_SE.ISO8859-1', '/images/sv.png')
Init.add_translation('remus-server', 'en', 'English',
                     'en_US.ISO8859-1', '/images/en.png')
Ejemplo n.º 9
0
            Log.log("Game over, displaying game state")
            matrix = [
                    [(x, y) in board.blocks for x in xrange(board.blocks_width)]
                    for y in xrange(board.blocks_height)
                    ]
            Matrix.put(matrix, f="_")

            if ((len(self.highscores) < HIGHSCORES or any(board.score > score["score"] for score in self.highscores)) and 
                    not Shared.options.get("uber_tetromino") and not Shared.options.get("flip_tetromino")
                    ):
                self.addJob("name_inputbox", Jobs.InputBox(self, "New Highscore!\nName: "))
                self.running = self.getName
            else:
                self.addJob("window-game_over", Jobs.Notification(self, "window-game_over", "Game Over"))
                self.addJob("endtimer", Jobs.TimedExecution(self, self.quitGame, seconds=3, anykey=True))

    def eventHandler(self, event):
        if event.type == QUIT:
            self.quit()

        elif event.type == KEYDOWN:
            if event.key == Shared.keymap["game"]["pause"]:
                self.call(Menus.PauseMenu, sound_enabled=False, caption="Tetris - Paused")
            if event.key == Shared.keymap["game"]["player1"]["uber_tetromino"] and Shared.options["gameplay"].get("uber_tetromino"):
                self.jobs.interface.addJob("tetromino", makeUberTetromino(self.jobs.interface.jobs.board))

if __name__ == '__main__':
    import Init
    Init.initGame(TetrisGame, caption="Loltris").run()
Ejemplo n.º 10
0
doc = """
Usage:
    loltris [--loglevel=n] [--dev]
    loltris (-h | --help | --version | -v)

Options:
    loltris --help,-h        Loltris documentation
    loltris --version,-v     Print the loltris version and exit
    loltris --loglevel=n     Set loglevel, 0="ONLY CRITICAL" 5="ALL"
"""

import sys
import docopt

from Globals import *

nice_version = "Loltris v{}".format(VERSION)
args = docopt.docopt(doc, version=nice_version)

## Launch the game
if args["-h"] or args["--help"]:
    print(doc)
    sys.exit()
if args["-v"]:
    print(nice_version)
    sys.exit()

import Menus
import Init
Init.initGame(Menus.MainMenu, caption="Loltris").run()
#
# Copyright (C) 2004 Daniel Larsson
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

import Init

# Add the languages we support
Init.add_translation('remus-audiostore', 'sv', 'Svenska',
                     'sv_SE.ISO8859-1', '/images/sv.png')
Init.add_translation('remus-audiostore', 'en', 'English',
                     'en_US.ISO8859-1', '/images/en.png')
Ejemplo n.º 12
0
 def __del__(self):
     Init._Shutdown()
Ejemplo n.º 13
0
 def __init__(self):
     Init._Init()
Ejemplo n.º 14
0
'''
Created on 2011-7-14

@author: zheng
'''

import Constant, Init, P4, Build, Sign, Upload, Email, Check

import sys



if __name__ == '__main__':
	
	Init.system_init()

	project=Init.init_choice(len(sys.argv))

	project.project_init()

	P4.download( project )

	P4.getDescribe (project , "1")
#	Check.check( project )
	
#	Build.build( project )

#	Sign.sign( project)		

#	Upload.upload( project )
Ejemplo n.º 15
0
import Init
import Display
import Action


if __name__ == '__main__':

    # PYGAME INIT
    pygame.init()
    Game.screen = pygame.display.set_mode((Const.windowHeight, Const.windowLength))
    Game.screen.fill(Colour.darkGrey)
    pygame.display.set_caption('SupNetwork')
    clock = pygame.time.Clock()

    # DISPLAY
    Init.array()
    Display.all_cell()

    # GAME LOOP
    while True:
        for event in pygame.event.get():
            clock.tick(30)

            if event.type == MOUSEBUTTONUP:
                x, y = event.pos
                if Const.margin < x < Const.margin+Const.cellSize*Const.gameSize \
                        and Const.margin < y < Const.margin+Const.cellSize*Const.gameSize:
                    Action.click(x, y)

            if event.type == QUIT:
                pygame.quit()