コード例 #1
0
def init(filepath):

    infile = open(filepath)

    settingsList = ast.literal_eval(infile.read())

    print(settingsList)
    
    global futureDistance
    futureDistance = int(settingsList[0])
    
    global historicData
    historicData = makeHistoricData()

    global currentPatternIndex
    currentPatternIndex = int(settingsList[1])

    global patternLength
    patternLength = int(settingsList[2])

    global currentPattern
    currentPattern = historicData[currentPatternIndex : currentPatternIndex + patternLength]

    global closeMethodNumber
    closeMethodNumber = settingsList[3]

    global decideMethodNumber
    decideMethodNumber = settingsList[4]
    
    global reqCloseScore
    reqCloseScore = settingsList[5]

    global reqNoSimilar
    reqNoSimilar = int(settingsList[6])

    global reqAverageChange
    reqAverageChange = settingsList[7]

    print('Settings initialised.')    
コード例 #2
0
import csv
import matplotlib
from shapeComparison import comparePattern
from shapeComparison import percentageChange
from dataProcessing import makeHistoricData
from matplotlib import pyplot
from functools import reduce


historicData = makeHistoricData()
pastPatterns = []
startPosition = -1000
length = 15
currentPattern = historicData[startPosition : startPosition + length]
print('Current Pattern : ' + str(currentPattern))
historicData = historicData
futureDistance = 10

def generatePastPatterns(patternLength, historicData):
    currentPoint = 0
    endPoint = len(historicData) - patternLength - futureDistance
    pastPatterns = []
    while currentPoint < endPoint:
        #print('Current Point ' +str(currentPoint))
        x = 0
        patternToAdd = []
        while x < patternLength + futureDistance:
            patternToAdd.append(historicData[currentPoint + x])
            #print('Data item to add' + str(historicData[currentPoint + x]))
            x += 1
            #print('x = ' + str(x))
コード例 #3
0
import csv
import matplotlib
from shapeComparison import comparePattern
from shapeComparison import percentageChange
from dataProcessing import makeHistoricData
from matplotlib import pyplot
from functools import reduce

historicData = makeHistoricData()
pastPatterns = []
startPosition = -1000
length = 15
currentPattern = historicData[startPosition:startPosition + length]
print('Current Pattern : ' + str(currentPattern))
historicData = historicData
futureDistance = 10


def generatePastPatterns(patternLength, historicData):
    currentPoint = 0
    endPoint = len(historicData) - patternLength - futureDistance
    pastPatterns = []
    while currentPoint < endPoint:
        #print('Current Point ' +str(currentPoint))
        x = 0
        patternToAdd = []
        while x < patternLength + futureDistance:
            patternToAdd.append(historicData[currentPoint + x])
            #print('Data item to add' + str(historicData[currentPoint + x]))
            x += 1
            #print('x = ' + str(x))