예제 #1
0
 def setAnalysisRightGraph(self, term):
     raw_data = getRawData()
     if term == 0:
         x = raw_data.iloc[:, [0, 1, 5]]
     else:
         x = raw_data.iloc[len(raw_data) - term * 7 : len(raw_data), [0, 1, 5]]
     model = PdTable(x)
     self.analysis_table_1.setModel(model)
예제 #2
0
 def setMonitorPredicted(self, input_name):
     raw_data = getRawData()
     if len(raw_data) == 0:
         self.warnRawData()
         return
     PredictWindow(self.ax, input_name, raw_data)
     self.canvas.draw()
     print(f"{LOG_EXCUTE[9]} 파라미터 : {self.getMonitorInput()}")
예제 #3
0
 def setAllAnalysisGraph(self):
     raw_data = getRawData()
     if len(raw_data) == 0:
         self.warnRawData()
         return
     term = 0
     self.setAnalysisLeftGraph(term)
     self.setAnalysisRightGraph(term)
     print(LOG_EXCUTE[7])
예제 #4
0
 def setAnalysisGraph(self):
     raw_data = getRawData()
     if len(raw_data) == 0:
         self.warnRawData()
         return
     term = self.analysis_spin_1.value()
     if term * 7 > len(raw_data):
         self.warnExceedData()
         return
     else:
         self.setAnalysisLeftGraph(term)
         self.setAnalysisRightGraph(term)
     print(f"{LOG_EXCUTE[6]} 기간 = {self.analysis_spin_1.value()}")
예제 #5
0
def getValues(playerName, stat):
	rawData = data.getRawData()

	values = []
	for i, game_id in enumerate(rawData):
		playedInGame = False
		for player in rawData[game_id][0]:
			if player[idx('name')] == playerName:
				values.append((player[idx(stat)], i+1))
				playedInGame = True
		if playedInGame == False:
			values.append((None, i+1))

	return values
예제 #6
0
def getValues(playerName, stat):
    rawData = data.getRawData()

    values = []
    for i, game_id in enumerate(rawData):
        playedInGame = False
        for player in rawData[game_id][0]:
            if player[idx('name')] == playerName:
                values.append((player[idx(stat)], i + 1))
                playedInGame = True
        if playedInGame == False:
            values.append((None, i + 1))

    return values
예제 #7
0
    def setMonitorEstimated(self, input_name):
        raw_data = getRawData()
        if len(raw_data) == 0:
            self.warnRawData()
            return

        self.ax.cla()
        x = raw_data["Time"]
        y = raw_data[input_name]
        f = raw_data[input_name].rolling(window=5, center=True).mean()  #결함31
        self.ax.plot(x, y, "-b", x, f, "--r", linewidth=0.8)
        self.ax.plot(x, f, "--r", linewidth=1.5)

        self.ax.set_title(f"Raw data versus estimated trend, {input_name}")
        self.ax.legend(["raw data", "estimated trend"], loc="upper left")
        self.ax.set_xlabel("Time(days)")
        self.ax.set_ylabel(input_name)
        self.ax.grid(True)
        self.canvas.draw()
        print(f"{LOG_EXCUTE[8]} 파라미터 : {self.getMonitorInput()}")
예제 #8
0
파일: gen_data.py 프로젝트: 36000/HFSF
def main():
    sig, bg = getRawData()

    sig[sig == 1.] = 10.
    bg[bg == 1.] = 10.
    '''
    newWindow()
    plt.hist(bg[:, 0, 0, 2])
  
    newWindow()
    plt.hist(bg[:, 0, 0, 2], range=(200, 600))
    '''

    sig = cutData(sig, 200, 400)
    bg = cutData(bg, 200, 400)

    sig, bg = evenData(sig, bg)

    lundPlot(sig, SIG)
    lundPlot(bg, BG)
    plt.show()

    saveProData(sig, bg)
    '''
    pt2_f = sig[:, :, :, 4].flatten()
    pt2_f = pt2_f[pt2_f != 10]
    newWindow()
    plt.hist(pt2_f)
  
    newWindow()
    binwidth = 1
    plt.hist(pt2_f, bins=range(int(np.min(pt2_f)), int(np.max(pt2_f)) + binwidth, binwidth), range=(0, 20))
    '''
    print('Signal Shape: ' + str(sig.shape))
    print('Background Shape: ' + str(bg.shape))
    '''
예제 #9
0
    def setAnalysisLeftGraph(self, term):
        raw_data = getRawData()
        if term == 0:
            x = raw_data
        else:
            x = raw_data.iloc[len(raw_data) - term * 7 : len(raw_data), :]


        self.a1.cla()
        x1 = x["Time"]
        y1 = x["OLR"]
        self.a1.plot(x1, y1, "-b", linewidth=0.8)
        self.a1.set_xlabel("Time(days)")
        self.a1.set_ylabel("OLR")
        plt.tight_layout(pad=0.5)
        self.a1.grid(True)

        self.a2.cla()
        x2 = x["Time"]
        y2 = x["Biogas Production"]
        self.a2.plot(x2, y2, "-r", linewidth=0.8)
        self.a2.set_xlabel("Time(days)")
        self.a2.set_ylabel("Biogas Production")
        plt.tight_layout(pad=0.5)
        self.a2.grid(True)

        self.a3.cla()
        x3 = x["Time"]
        x_shift = x.shift(1)
        x_shift=x_shift.fillna(0)
        y3 = (x["OLR"] - x_shift["OLR"]) / x["OLR"] * 100
        y4 = (
            (x["Biogas Production"] - x_shift["Biogas Production"])
            / x["Biogas Production"]
            * 100
        )
        self.a3.fill_between(x3, 0, y3, color="b", alpha=0.4)
        self.a3.fill_between(x3, 0, y4, color="r", alpha=0.4)
        self.a3.set_xlabel("Time(days)")
        self.a3.set_ylabel("Variation of OLR and BP")
        self.a3.legend(["OLR", "Biogas Production"], loc="lower left")
        self.a3.grid(True)
        self.canvas.draw()

        error = abs(y3 - y4).mean()
        total_input_mean = raw_data["OLR"].mean()
        total_output_mean = raw_data["Biogas Production"].mean()
        input_ratio = x["OLR"].mean() / total_input_mean * 100
        output_ratio = x["Biogas Production"].mean() / total_output_mean * 100

        error = round(error, 2)
        total_input_mean = round(total_input_mean, 2)
        total_output_mean = round(total_output_mean, 2)
        input_ratio = round(input_ratio, 2)
        output_ratio = round(output_ratio, 2)

        info_text = f"입력 대비 출력 상관 예측 정확도 : {100-error}%" \
                    f"\n입력 대비 출력 오차율 (일별) : {error}%" \
                    f"\n전체 데이터 평균 OLR 부하량 : {total_input_mean} kg VS/m3" \
                    f"\n전체 데이터 평균 Biogas 출하량 : {total_output_mean} Nm3/kg Vsadd" \
                    f"\n평균 대비 최근 OLR 부하량 비율 : {input_ratio}%" \
                    f"\n평균 대비 최근 BP 출하량 비율 : {output_ratio}%"

        self.analysis_text_1.setText(info_text)