fixing commit, only json script

This commit is contained in:
NT 2021-06-30 18:55:15 +02:00
parent dd5abbc430
commit 0075c76ecb
2 changed files with 17 additions and 0 deletions

View File

@ -1,10 +1,16 @@
import json, re, os
fileList = [
"diffphys-code-burgers.ipynb", "diffphys-code-sol.ipynb", "physicalloss-code.ipynb", # TF
"bayesian-code.ipynb", "supervised-airfoils.ipynb" # pytorch
]
fileList = [ "diffphys-code-burgers.ipynb"] # debug
# shorten "0.008612174447657694, 0.02584669669548606, 0.043136357266407785"
for fnOut in fileList:
fn = fnOut[:-5] + "bak"
print("renaming "+fnOut+ " to "+fn )
@ -26,6 +32,8 @@ for fnOut in fileList:
re1 = re.compile(r"WARNING:tensorflow:")
re2 = re.compile(r"UserWarning:")
re3 = re.compile(r"\[0.008612174447657694, 0.02584669669548606, 0.043136357266407785.+\]" )
re3t = "[0.008612174447657694, 0.02584669669548606, 0.043136357266407785 ... ]"
t="cells"
okay = 0
@ -42,6 +50,14 @@ for fnOut in fileList:
#d[t][i]["outputs"] = ""
#print(d[t][i]["outputs"])
for j in range(len( d[t][i]["source"] )):
#print( d[t][i]["source"][j] )
#print( type(d[t][i]["source"][j] ))
dsOut = re3.sub( re3t, d[t][i]["source"][j] ) # replace long number string (only for burgers)
d[t][i]["source"][j] = dsOut
deletes = deletes+1
#print( d[t][i]["source"][j] +"\n >>> \n" +d2 )
#print(len( d[t][i]["outputs"] ))
for j in range(len( d[t][i]["outputs"] )):
#print(type( d[t][i]["outputs"][j] ))

View File

@ -19,6 +19,7 @@ python3.7 json-cleanup-for-pdf.py
cd _build/latex
mv book.pdf book-xetex.pdf
rm -f book-in.tex sphinxmessages-in.sty book-in.aux book-in.toc
mv book.tex book-in.tex