Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NIRS_Workflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CEFE
PACE
NIRS_Workflow
Commits
826b619c
Commit
826b619c
authored
11 months ago
by
Nicolas Barthes
Browse files
Options
Downloads
Patches
Plain Diff
added LaTEX template and function for PDF report
parent
6dec0081
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Report/report.py
+28
-24
28 additions, 24 deletions
Report/report.py
with
28 additions
and
24 deletions
Report/report.py
+
28
−
24
View file @
826b619c
...
...
@@ -184,31 +184,35 @@ def report(*argv):
\bibliography{refs.bib}
\clearpage
\end{document}
"""
return
latex_report
# export the .tex file in the Report folder
filename
=
r
'
report.tex
'
with
open
(
filename
,
'
w
'
)
as
latex_file
:
latex_file
.
write
(
latex_report
)
# create the Tex file - sections in args will be displayed: {'sample':'Sample Selection';'model':'Model Creation';'predict':'Predictions';'help':'LaTEX help for figs and tables';}
latex_report
=
report
(
'
sample
'
,
'
predict
'
,)
# export the .tex file in the Report folder
filename
=
r
'
report.tex
'
with
open
(
filename
,
'
w
'
)
as
latex_file
:
latex_file
.
write
(
latex_report
)
# run pdflatex with bibtex compilation (2nd run)
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\pdflatex.exe
'
,
filename
])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\bibtex.exe
'
,
filename
[:
-
4
]])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\pdflatex.exe
'
,
filename
])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\pdflatex.exe
'
,
filename
])
proc
.
communicate
()
# remove pdflatex compilation files
os
.
unlink
(
filename
[:
-
4
]
+
'
.log
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.aux
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.bbl
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.blg
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.out
'
)
# open the report
proc
=
subprocess
.
Popen
([
filename
[:
-
4
]
+
'
.pdf
'
],
shell
=
True
)
proc
.
communicate
()
\ No newline at end of file
def
compile_latex
():
# path to pdflatex
pdflatex
=
"
C:/Donnees/Logiciels/Papps/PortableApps/Notepad++Portable/LaTEX/texmfs/install/miktex/bin/
"
filename
=
'
report.tex
'
# run pdflatex with bibtex compilation (2nd run)
proc
=
subprocess
.
Popen
([
pdflatex
+
'
pdflatex.exe
'
,
filename
])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\bibtex.exe
'
,
filename
[:
-
4
]])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\pdflatex.exe
'
,
filename
])
proc
.
communicate
()
proc
=
subprocess
.
Popen
([
r
'
C:\Donnees\Logiciels\Papps\PortableApps\Notepad++Portable\LaTEX\texmfs\install\miktex\bin\pdflatex.exe
'
,
filename
])
proc
.
communicate
()
# remove pdflatex compilation files
os
.
unlink
(
filename
[:
-
4
]
+
'
.log
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.aux
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.bbl
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.blg
'
)
os
.
unlink
(
filename
[:
-
4
]
+
'
.out
'
)
# open the report
proc
=
subprocess
.
Popen
([
filename
[:
-
4
]
+
'
.pdf
'
],
shell
=
True
)
proc
.
communicate
()
compile_latex
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment