pylbo.gimli.utils

Functions

validate_output_dir(output_dir)

Validates and returns the output directory for the parfiles.

is_symbol_dependent(symbols, expr)

Checks whether an expression depends on any of the symbols in a given list.

is_sympy_number(expr)

Checks whether an expression is a number.

get_equilibrium_parameters(param)

Removes the wavenumbers from the equilibrium parameters.

create_file(filename)

Creates a file with a given path (or asks whether to overwrite it if it

write_pad(file, string, level)

Writes a string to a file with a given indentation level.

Module Contents

pylbo.gimli.utils.validate_output_dir(output_dir)

Validates and returns the output directory for the parfiles.

Parameters:

output_dir (str, PathLike) – The output directory to store the parfiles in. If not given, defaults to the current working directory.

Raises:

NotADirectoryError – If the output directory is not found.

pylbo.gimli.utils.is_symbol_dependent(symbols, expr)

Checks whether an expression depends on any of the symbols in a given list.

Parameters:
  • symbols (list) – The list of symbols to check for.

  • expr (sympy expression) – The expression to check for the symbols in the list.

Returns:

sdep – Whether the expression depends on any of the symbols.

Return type:

bool

pylbo.gimli.utils.is_sympy_number(expr)

Checks whether an expression is a number.

Parameters:

expr (sympy expression) – The expression to check.

Returns:

Whether the expression is a number.

Return type:

bool

pylbo.gimli.utils.get_equilibrium_parameters(param)

Removes the wavenumbers from the equilibrium parameters.

Parameters:

param (dict) – The equilibrium parameters dictionary.

Returns:

The equilibrium parameters without the wavenumbers.

Return type:

str

pylbo.gimli.utils.create_file(filename)

Creates a file with a given path (or asks whether to overwrite it if it exists already).

Parameters:

filename (str) – The file path.

pylbo.gimli.utils.write_pad(file, string, level)

Writes a string to a file with a given indentation level.

Parameters:
  • file (file object) – The file object to write to.

  • string (str) – The string to write.

  • level (int) – The indentation level.