bout_runners.log.log_reader

Module containing the LogReader class.

Classes

LogReader(log_path)

Class for reading BOUT++ log files.

class bout_runners.log.log_reader.LogReader(log_path: pathlib.Path)[source]

Class for reading BOUT++ log files.

Examples

>>> from pathlib import Path
>>> path = Path().joinpath('path', 'to', 'BOUT.log.0')
>>> log_reader = LogReader(path)
>>> log_reader.start_time
'2020-05-01 17:07:10'
>>> log_reader.end_time
'2020-05-01 17:07:14'
>>> log_reader.pid
1190
Attributes
__log_pathPath

Path to the log file

file_strstr

The log file as a string

start_timeNone or str

Return the start time of the process.

end_timeNone or str

Return the end time of the process.

pidNone or int

Return the pid of the process.

Methods

started()

Whether or not the execution has started

ended()

Whether or not the execution has ended

pid_exist()

Whether or not the pid can be found

get_simulation_steps()

Return the simulation steps as a dataframe

__is_str_in_file(pattern)

Check whether regex-pattern exists in file

__find_local_time(pattern)

Return the local time of a regex capture

Open and read a log file.

Parameters
log_pathstr or Path

Absolute path to log file

Attributes
end_time

Return the end time of the process.

pid

Return the pid of the process.

start_time

Return the start time of the process.

Methods

ended()

Check whether the run has an end time.

get_simulation_steps()

Return the simulation steps as a dataframe.

pid_exist()

Check whether a process id exist.

started()

Check whether the run has a start time.

property end_time

Return the end time of the process.

Returns
datetime or None

The end time on date time format

ended() → bool[source]

Check whether the run has an end time.

Returns
bool

True if the end signature is found in the file

get_simulation_steps() → pandas.core.frame.DataFrame[source]

Return the simulation steps as a dataframe.

Returns
simulation_stepsDataFrame

Data frame containing details of the simulation steps

property pid

Return the pid of the process.

Returns
int or None

The pid of the process

pid_exist() → bool[source]

Check whether a process id exist.

Returns
bool

True if the pid is found

property start_time

Return the start time of the process.

Returns
datetime or None

The start time on date time format

started() → bool[source]

Check whether the run has a start time.

Returns
bool

True if the start signature is found in the file