优化了<体动标注>的数据导入

This commit is contained in:
Yorusora
2025-05-21 14:09:23 +08:00
parent 4ec1a69093
commit 88b2a0875a
3 changed files with 46 additions and 59 deletions

View File

@ -92,22 +92,15 @@ class SettingWindow(QMainWindow):
Config.update({
"Path": {
"Input_orgBcg": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
Path(str(self.sampID)) / Path(ConfigParams.ORGBCG_SYNC +
str(Config["InputConfig"]["orgBcgFreq"]) +
ConfigParams.ENDSWITH_TXT))),
Path(str(self.sampID)))),
"Input_BCG": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_ORGBCG_ALIGNED /
Path(str(self.sampID)) / Path(ConfigParams.BCG_SYNC +
str(Config["InputConfig"]["BCGFreq"]) +
ConfigParams.ENDSWITH_TXT))),
Path(str(self.sampID)))),
"Save_a": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
Path(str(self.sampID)) / Path(ConfigParams.ARTIFACT_A +
ConfigParams.ENDSWITH_TXT))),
Path(str(self.sampID)))),
"Save_b": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
Path(str(self.sampID)) / Path(ConfigParams.ARTIFACT_B +
ConfigParams.ENDSWITH_TXT))),
Path(str(self.sampID)))),
"Save_c": str((Path(self.root_path) / ConfigParams.PUBLIC_PATH_LABEL /
Path(str(self.sampID)) / Path(ConfigParams.ARTIFACT_C +
ConfigParams.ENDSWITH_CSV)))
Path(str(self.sampID))))
}
})
@ -1207,9 +1200,35 @@ class Data:
self.df_Artifact_a = DataFrame(columns=["number", "type", "startTime", "endTime"])
def open_file(self):
if Path(Config["Path"]["Input_orgBcg"]).is_file():
Config["Path"]["Input_orgBcg"] = str(Path(Config["Path"]["Input_orgBcg"]).parent)
if Path(Config["Path"]["Input_BCG"]).is_file():
Config["Path"]["Input_BCG"] = str(Path(Config["Path"]["Input_BCG"]).parent)
if (not Path(Config["Path"]["Input_orgBcg"]).exists()) or (not Path(Config["Path"]["Input_BCG"]).exists()):
return Result().failure(info=Constants.INPUT_FAILURE + Constants.FAILURE_REASON["Path_Not_Exist"])
result = PublicFunc.examine_file(Config["Path"]["Input_orgBcg"], ConfigParams.ORGBCG_SYNC)
if result.status:
Config["Path"]["Input_orgBcg"] = result.data["path"]
Config["InputConfig"]["orgBcgFreq"] = result.data["freq"]
else:
return result
result = PublicFunc.examine_file(Config["Path"]["Input_BCG"], ConfigParams.BCG_SYNC)
if result.status:
Config["Path"]["Input_BCG"] = result.data["path"]
Config["InputConfig"]["BCGFreq"] = result.data["freq"]
else:
return result
Config["Path"]["Save_a"] = str(
Path(Config["Path"]["Save_a"]) / Path(ConfigParams.ARTIFACT_A + ConfigParams.ENDSWITH_TXT))
Config["Path"]["Save_b"] = str(
Path(Config["Path"]["Save_b"]) / Path(ConfigParams.ARTIFACT_B + ConfigParams.ENDSWITH_TXT))
Config["Path"]["Save_c"] = str(
Path(Config["Path"]["Save_c"]) / Path(ConfigParams.ARTIFACT_C + ConfigParams.ENDSWITH_CSV))
try:
self.orgBcg = read_csv(Config["Path"]["Input_orgBcg"],
encoding=ConfigParams.UTF8_ENCODING,