seisflows.tools.msg
===================
.. py:module:: seisflows.tools.msg
.. autoapi-nested-parse::
SeisFlows messages tool. For providing a uniform look to SeisFlows print
and log statements that end up in stdout or in log files.
Attributes
----------
.. autoapisummary::
seisflows.tools.msg.DEG
seisflows.tools.msg.base_parameter_file
seisflows.tools.msg.ascii_logo
seisflows.tools.msg.ascii_logo_small
Functions
---------
.. autoapisummary::
seisflows.tools.msg.mjr
seisflows.tools.msg.mnr
seisflows.tools.msg.sub
seisflows.tools.msg.cli
Module Contents
---------------
.. py:data:: DEG
:value: '°'
.. py:function:: mjr(val, char='=')
Message formatter used to block off sections in log files with visually
distinctive separators. Defined as individual functions to reduce call
length.
Major: For important or workflow.main() messages like starting workflow
.. rubric::
>>> print(msg.mjr("Important message here"))
or
>>> logger.info.(msg.mjr("Important message here"))
:type val: str
:param val: formatted message to return
:type char: str
:param char: border character to separate the message from remainder of logs
:rtype: str
:return: formatted string message to be printed to std out
.. py:function:: mnr(val, char='/')
Message formatter used to block off sections in log files with visually
distinctive separators. Defined as individual functions to reduce call
length.
Minor: For key messages, describing things like what iteration were at
.. rubric::
>>> print(msg.mnr("Semi important message here"))
OR
>>> logger.info.(msg.mnr("Semi important message here"))
:type val: str
:param val: formatted message to return
:type char: str
:param char: border character to separate the message from remainder of logs
:rtype: str
:return: formatted string message to be printed to std out
.. py:function:: sub(val, char='-')
Message formatter used to block off sections in log files with visually
distinctive separators. Defined as individual functions to reduce call
length.
Sub: For sub-critical messages, describing things like notes and warnings
.. rubric::
>>> print(msg.mnr("Sub-critical message here"))
OR
>>> logger.info.(msg.sub("Sub-critical message here"))
:type val: str
:param val: formatted message to return
:type char: str
:param char: border character to separate the message from remainder of logs
:rtype: str
:return: formatted string message to be printed to std out
.. py:function:: cli(text='', items=None, wraplen=80, header=None, border=None, hchar='/')
Provide a standardized look to the SeisFlows command line interface messages
The look we are after is something like:
$ seisflows cmd
=======================
HEADER
//////
text
item1
item2
...
itemN
=======================
$ ls -l
.. rubric::
>>> print(msg.cli("stdout text here", items=["a", "b", "c"], header="warning", border="="))
========================================================================
WARNING
///////
stdout text here
a
b
c
========================================================================
:type text: str
:param text: text to format into the cli look
:type items: list
:param items: optional list of items that will be displayed on new lines
after the text. Useful for listing parameters or paths. The items here
are NOT wrapped.
:type wraplen: int
:param wraplen: desired line length to wrap messages.
:type header: str
:param header: optional header line that will be centered (wraplen/2) and
capitalized. Useful for things like 'WARNING' and 'ERROR'
:type border: str
:param border: a character to use to block off
:type hchar: str
:param hchar: character to underline the header with
:rtype output_str: str
:return output_str: formatted string to print out
.. py:data:: base_parameter_file
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""# //////////////////////////////////////////////////////////////////////////////
#
# SeisFlows vUninferable
#
# //////////////////////////////////////////////////////////////////////////////
#
# SeisFlows YAML parameter file that determines code setup and runtime behavior.
# The following commands may be useful for manipulating this file.
#
# * list out all available module choices:
# > seisflows print modules
# * configure the parameter file by autofilling module parameters:
# > seisflows configure
# * swap parameter sets between by choosing new modules:
# > seisflows swap (e.g., seisflows swap solver specfem3d)
#
# YAML syntax tips:
# - NoneType == null
# - infinity == inf
#
# MODULES
# ///////
# workflow (str): The types and order of functions for running SeisFlows
# system (str): Computer architecture of the system being used
# solver (str): External numerical solver to use for waveform simulations
# preprocess (str): Preprocessing schema for waveform data
# optimize (str): Optimization algorithm for the inverse problem
# ==============================================================================
workflow: forward
system: workstation
solver: specfem2d
preprocess: default
optimize: gradient
"""
.. raw:: html
.. py:data:: ascii_logo
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@. .(%@( %@@@.
/@@@@@@@& *@@@@@@@@@& ,@@@@ @@(
@@@@@@@@ @@@@@@@@ &@@@@@@@@@@@@@ .@% @@
*@@@@@@@ @@@@@@@ (@@@@@@ @@ @@ @*
@@@@@@@ @@@@@@@, /@@@@@ @ @ @@
&@@@@@@ @@@@@@@. @@@@@@ @ @ @&
@@@@@@@ @@@@@@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