-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatcher.py
More file actions
29 lines (25 loc) · 1.27 KB
/
Copy pathpatcher.py
File metadata and controls
29 lines (25 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import re
with open("/home/dldx/gh/智能靶标查找系统/backend/api/tasks.py", "r") as f:
content = f.read()
# Find and replace the sigmoid line with sigmoid + debug log
old_text = """ # 用sigmoid压缩,将raw_confidence(0~1.0)映射到(0.1, 0.95)
# 避免极端值和扎堆1.0
import math
confidence = 0.1 + 0.85 / (1.0 + math.exp(-6.0 * (raw_confidence - 0.45)))"""
new_text = """ # 用sigmoid压缩,将raw_confidence(0~1.0)映射到(0.1, 0.95)
# 避免极端值和扎堆1.0
import math
confidence = 0.1 + 0.85 / (1.0 + math.exp(-6.0 * (raw_confidence - 0.45)))
# DEBUG
add_task_log(task_id, "info", f"DBG {target}: raw={raw_confidence:.4f} sig={confidence:.4f} lig={ligand_s:.3f} dj={docking_s_adjusted:.3f} net={network_s:.3f} sc={strategy_count} be={binding_energy}")"""
if old_text in content:
content = content.replace(old_text, new_text, 1)
with open("/home/dldx/gh/智能靶标查找系统/backend/api/tasks.py", "w") as f:
f.write(content)
print("PATCHED OK")
else:
print("PATTERN NOT FOUND")
# Show context around sigmoid
idx = content.find("sigmoid")
if idx >= 0:
print("CONTEXT:", content[idx-100:idx+200])