seisflows.tools.msg

SeisFlows messages tool. For providing a uniform look to SeisFlows print and log statements that end up in stdout or in log files.

Attributes

DEG

base_parameter_file

ascii_logo

ascii_logo_small

Functions

mjr(val[, char])

Message formatter used to block off sections in log files with visually

mnr(val[, char])

Message formatter used to block off sections in log files with visually

sub(val[, char])

Message formatter used to block off sections in log files with visually

cli([text, items, wraplen, header, border, hchar])

Provide a standardized look to the SeisFlows command line interface messages

Module Contents

seisflows.tools.msg.DEG = '°'
seisflows.tools.msg.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

>>> print(msg.mjr(“Important message here”)) or >>> logger.info.(msg.mjr(“Important message here”))

Parameters:
  • val (str) – formatted message to return

  • char (str) – border character to separate the message from remainder of logs

Return type:

str

Returns:

formatted string message to be printed to std out

seisflows.tools.msg.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

>>> print(msg.mnr(“Semi important message here”)) OR >>> logger.info.(msg.mnr(“Semi important message here”))

Parameters:
  • val (str) – formatted message to return

  • char (str) – border character to separate the message from remainder of logs

Return type:

str

Returns:

formatted string message to be printed to std out

seisflows.tools.msg.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

>>> print(msg.mnr(“Sub-critical message here”)) OR >>> logger.info.(msg.sub(“Sub-critical message here”))

Parameters:
  • val (str) – formatted message to return

  • char (str) – border character to separate the message from remainder of logs

Return type:

str

Returns:

formatted string message to be printed to std out

seisflows.tools.msg.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

text item1 item2 … itemN =======================

$ ls -l

Parameters:
  • text (str) – text to format into the cli look

  • items (list) – 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.

  • wraplen (int) – desired line length to wrap messages.

  • header (str) – optional header line that will be centered (wraplen/2) and capitalized. Useful for things like ‘WARNING’ and ‘ERROR’

  • border (str) – a character to use to block off

  • hchar (str) – character to underline the header with

Rtype output_str:

str

Return output_str:

formatted string to print out

seisflows.tools.msg.base_parameter_file = Multiline-String
Show Value
"""# //////////////////////////////////////////////////////////////////////////////
#
#                             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 <module> <name> (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
"""
Show Value
"""

                             @@@@@@@@@@@@@@@@@@@@@@@
                       @@@@@@@@@.         .(%@&#(     %@@@.
                  /@@@@@@@&      *@@@@@@@@@&         ,@@@@  @@(
               @@@@@@@@      @@@@@@@@       &@@@@@@@@@@@@@  .@% @@
            *@@@@@@@      @@@@@@@      (@@@@@@               @@ @@ @*
          @@@@@@@      @@@@@@@,     /@@@@@                       @ @ @@
        &@@@@@@      @@@@@@@.     @@@@@@                           @ @ @&
       @@@@@@@      @@@@@@@      @@@@@@                             @@ @ @
     %@@@@@@      @@@@@@@@      @@@@@@                               @@ @ @&
    @@@@@@@      @@@@@@@@      @@@@@@                                 @* @ (@
   @@@@@@@       @@@@@@@       @@@@@@                                 @@ @@ @@
   @@@@@@&      @@@@@@@@      ,@@@@@@/                               .@@ .@& @
  @@@@@@@       @@@@@@@@       @@@@@@@                               @@@  @@ ,@
  @@@@@@@       @@@@@@@@       @@@@@@@@                             @@@  (@@  @
 @@@@@@@@       @@@@@@@@.       @@@@@@@@@                         @@@@   @@@  @@
 @@@@@@@@       @@@@@@@@@        @@@@@@@@@@@                   @@@@@@   @@@@  @@
 @@@@@@@@       ,@@@@@@@@@         @@@@@@@@@@@@@%         %@@@@@@@@.   @@@@   @@
  @@@@@@@        @@@@@@@@@@*         #@@@@@@@@@@@@@@@@@@@@@@@@@@@     @@@@   @@
  @@@@@@@@        @@@@@@@@@@@            @@@@@@@@@@@@@@@@@@@@&      @@@@@    @@
   @@@@@@@@        *@@@@@@@@@@@*               .@@@@@@&           @@@@@@    @@
   &@@@@@@@@         @@@@@@@@@@@@@&                            @@@@@@@(    @@@
    @@@@@@@@@          @@@@@@@@@@@@@@@@                   %@@@@@@@@@%    #@@@
     (@@@@@@@@@          *@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@      @@@#
       @@@@@@@@@#            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@       @@@@
        (@@@@@@@@@@              @@@@@@@@@@@@@@@@@@@@@@@@@%         @@@@#
          &@@@@@@@@@@%                   #@@@@@@@@(              @@@@@&
             @@@@@@@@@@@@                                    %@@@@@@.
               &@@@@@@@@@@@@@@                          *@@@@@@@@@
                   @@@@@@@@@@@@@@@@@@@@&/.   ,%@@@@@@@@@@@@@@@
                       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                             &@@@@@@@@@@@@@@@@@@@@@&
    """
seisflows.tools.msg.ascii_logo_small = Multiline-String
Show Value
"""
                                    @@@@@@@@@@
                               .@@@@.    .%&(  %@.
                            @@@@   @@@@   &@@@@@@ ,%@
                         @@@@   @@@,  /@@              @
                        @@@   @@@@   @@@              @
                      @@@@   @@@@   @@@                @  @
                      @@@   @@@@   ,@@@                @ @
                     @@@@   @@@@    @@@@              @@ @ @
                     @@@@   @@@@@    @@@@@          @@@ @@ @
                     @@@@    @@@@@     @@@@@@@@@@@@@@  @@  @
                      @@@@    @@@@@@        @@@&     @@@  @
                      @@@@@     @@@@@@@@         %@@@@#  @@
                        @@@@#      @@@@@@@@@@@@@@@@@   @@
                         &@@@@@          @@@@(       @@&
                            @@@@@@@             /@@@@
                                @@@@@@@@@@@@@@@@@
                                    @@@@@@@@@@
"""