nucleon_elastic_ff.utilities

Utility routines for nucleon_elastic_ff.data module

nucleon_elastic_ff.utilities.find_all_files(root: str, file_patterns: Optional[List[str]] = None, dir_patterns: Optional[List[str]] = None, exclude_file_patterns: Optional[List[str]] = None, match_all: bool = False) → List[str][source]

Recursivly iterates directory to all files which match the patterns.

Arguments
root: str
The string to check.
file_patterns: Optional[List[str]] = None
The regex patterns for files to match.
dir_patterns: Optional[List[str]] = None
The regex patterns for directories to match.
exclude_file_patterns: Optional[List[str]] = None
The regex patterns for files to not match.
match_all: bool = False
If true, all pattern must have a match.
nucleon_elastic_ff.utilities.has_match(string: str, patterns: Union[str, List[str]], match_all: bool = False) → bool[source]

Returns if at least one (match_all = False) of the regex patterns is matched.

Arguments
string: str
The string to check.
patterns: List[str]
The regex patterns to match.
match_all: bool = False
If true, all pattern must have a match.
nucleon_elastic_ff.utilities.set_up_logger(name: str, mode: str = 'a') → logging.Logger[source]

Sets up command line and file logger.

Stream logger default level is INFO. File logger default level is DEBUG. Only adds handlers if no handlers are present.

Arguments
name: str
Name of the logger
mode: str = “a”
Default mode for the file logger