def getDiscriptiveTalkWithWidth(inpath, Start,End, nameFiles, DynEnd, Width,TalkType,Person): #get discription information of the data #width mean how long do you want to check the characteristics #DynEnd dynamic ending #GazeType ori = [] for nameFile in nameFiles: print (nameFile) for i in [1,2]: print (i) (dataTHroot, dataTSroot, dataGroot) = ATS.readInput(inpath, nameFile,i) if DynEnd: #using dynamic ending (yTH, xTH) = (dataTHroot.shape) (yTS, xTS) = (dataTSroot.shape) (yG, xG) = (dataGroot.shape) End = np.amin(np.asarray([yTH,yTS,yG])) #get the actual end time dataTHroot = ATS.shortenData(dataTHroot,Start,End) dataTSroot = ATS.shortenData(dataTSroot,Start,End) dataGroot = ATS.shortenData(dataGroot,Start,End) j = 0 while j < End: startSub = j if j+ Width > End: endSub = End else: endSub = j+Width dataTH = ATS.shortenData(dataTHroot,startSub,endSub) dataTS = ATS.shortenData(dataTSroot,startSub,endSub) dataG = ATS.shortenData(dataGroot,startSub,endSub) if Person == 'H': dataGTH = ATS.combineData(dataTH,dataG,endSub) dataGTHS = ATS.combineData(dataGTH,dataTS,endSub) else: dataGTS = ATS.combineData(dataTS,dataG,endSub) dataGTHS = ATS.combineData(dataGTS,dataTH,endSub) #print (dataGTHS) dataGTHS = formatOneCollumnOfData(dataGTHS,1,TalkType) ori = updateDiscriptiveData(ori,dataGTHS,1,nameFile,i,j) j = j + Width # for i in ori: # print (i) return ori
def getDiscriptiveTwoTalkWithWidth(inpath, Start,End, nameFiles, DynEnd, Width,GoT): #get discription information of the data #width mean how long do you want to check the characteristics #DynEnd dynamic ending ori = [] for nameFile in nameFiles: print (nameFile) for i in [1,2]: print (i) (dataTHroot, dataTSroot, dataGroot) = ATS.readInput(inpath, nameFile,i) if DynEnd: #using dynamic ending (yTH, xTH) = (dataTHroot.shape) (yTS, xTS) = (dataTSroot.shape) (yG, xG) = (dataGroot.shape) End = np.amin(np.asarray([yTH,yTS,yG])) #get the actual end time dataTHroot = ATS.shortenData(dataTHroot,Start,End) dataTSroot = ATS.shortenData(dataTSroot,Start,End) dataGroot = ATS.shortenData(dataGroot,Start,End) dataTHSroot = combinedTwoTalkTogether(dataTHroot,dataTSroot) j = 0 while j < End: startSub = j if j+Width > End: endSub = End else: endSub = j+Width dataG = ATS.shortenData(dataGroot,startSub,endSub) dataTHS = ATS.shortenData(dataTHSroot,startSub,endSub) if GoT == 0: dataGTHS = ATS.combineData(dataG,dataTHS,endSub) else: dataGTHS = ATS.combineData(dataTHS,dataG,endSub) ori = updateDiscriptiveDataForBothTalks(ori,dataGTHS,GoT,nameFile,i,j) j = j + Width return ori
def getReliability(inpath, Start, End, GoTSize): BoC = np.zeros((End, GoTSize), dtype=np.float64) #best of coder ori = [] for i in ["52", "65", "79"]: for j in ["C1", "C2"]: for root, dirs, files in walk(inpath): BoC = np.zeros((End, GoTSize), dtype=np.float64) #best of coder for file in files: if file.endswith(".csv"): if i in file and j in file: print(file) nameOutput = file data = np.genfromtxt(join(root, file), dtype=np.float64, delimiter=',') dyad = int(splitext(file)[0][2:4]) conv = int(splitext(file)[0][6:7]) coder = int(getCoderName(splitext(file)[0][15:17])) beg = getDyadCovCoderInfor(dyad, conv, coder, End) #beg is begining data = AT.shortenData(data, Start, End) combData = AT.combineData(beg, data, End) ori.extend(combData) BoC = bestOfCoderTag(BoC, data, coder, End) data = getBestOfCoderTag(BoC, End) beg = getDyadCovCoderInfor(dyad, conv, 105, End) combData = np.c_[beg, data] ori.extend(combData) time = np.arange(End).reshape([End, 1]) output = np.c_[time, data] np.savetxt(nameOutput + "_combined.csv", output, fmt='%1.3f', delimiter=',') return ori