Partitial recomputation after efdbaaca03 commit

This commit is contained in:
Artyom Titov 2026-08-19 16:15:09 +03:00
commit 75de65cf4c
67 changed files with 296006 additions and 274763 deletions

36
automation/run_notebook.py Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env python
import subprocess
from pathlib import Path
import sys
def wolfram_string(path: Path) -> str:
"""
Превращает путь в безопасную строку Wolfram Language.
"""
s = str(path.resolve())
s = s.replace("\\", "\\\\").replace('"', '\\"')
return f'"{s}"'
def calculate_notebook(path: Path) -> bool:
print(f"\n{'=' * 70}")
print(f"Считаю: {path.name}")
print(f"{'=' * 70}")
nb_path = wolfram_string(path)
code = f'''
$HistoryLength = 0;
Print["Начало вычисления: {path.name}"];
NotebookEvaluate[
{nb_path},
InsertResults -> True
];
Print["Готово: {path.name}"];
Exit[];
'''
result = subprocess.call(["WolframKernel", "-nopromt", "-run", code])
return result == 0
calculate_notebook(Path("./notebook1.nb"))