SCRIPTS LaTeX make_settings_tableΒΆ

# -*-Python-*-
# Created by eldond at 2018 Jul 11  09:19

"""
This script generates a LaTeX snippet to produce a table containing module settings. It is meant to be included in a
larger, more complete LaTeX source using \input{}.

defaultVars parameters
----------------------
:param save_to: reference to location in OMFIT tree where output should be saved
"""


defaultVars(save_to=scratch)

table = '''
\\begin{{table}}
\caption{{TUTORIAL module settings}}
\\begin{{tabular}}{{ll p{{6cm}} p{{6cm}} }}
\hline\hline
Group & Setting & Value & Notes \\\\
\hline
SETUP & workDir & \\verb|{workDir:}| & \\\\
SETUP & executable & \\verb|{executable:}| & \\\\
\hline
EXPERIMENT & shot & {shot:} & This shot is pretty good\\\\
EXPERIMENT & time & {time:} & \\\\
EXPERIMENT & device & {device:} & \\\\
EXPERIMENT & shots & {shots:} & \\\\
EXPERIMENT & times & {times:} & \\\\
EXPERIMENT & runid & {runid:} & \\\\
\hline
REMOTE\\_SETUP & serverPicker & \\verb|{serverPicker:}| & \\\\
REMOTE\\_SETUP & workDir & \\verb|{remoteDir:}| & \\\\
REMOTE\\_SETUP & server & \\verb|{server:}| & \\\\
REMOTE\\_SETUP & tunnel & \\verb|{tunnel:}| & \\\\
\hline\hline
\end{{tabular}}
\label{{table:settings}}
\end{{table}}
'''.format(
    workDir=evalExpr(root['SETTINGS']['SETUP']['workDir']),
    executable=root['SETTINGS']['SETUP']['executable'],
    shot=root['SETTINGS']['EXPERIMENT']['shot'],
    time=root['SETTINGS']['EXPERIMENT']['time'],
    device=tokamak(root['SETTINGS']['EXPERIMENT']['device']),
    shots=atleast_1d(root['SETTINGS']['EXPERIMENT']['shots']),
    times=atleast_1d(root['SETTINGS']['EXPERIMENT']['times']),
    runid=root['SETTINGS']['EXPERIMENT']['runid'],
    serverPicker=evalExpr(root['SETTINGS']['REMOTE_SETUP']['serverPicker']),
    remoteDir=root['SETTINGS']['REMOTE_SETUP']['workDir'],
    server=root['SETTINGS']['REMOTE_SETUP']['server'],
    tunnel=root['SETTINGS']['REMOTE_SETUP']['tunnel'],
)

save_to['settings_table.tex'] = OMFITascii('settings_table.tex', fromString=table)