sevnpy.io.readlogfiles
- sevnpy.io.logreader.readlogfiles(logfiles: str | List[str] | Tuple[str], events: str | List[str] | Tuple[str], capturing_cols: str | List[str | int] | Tuple[str] = 'default', nproc: int = 1, names: str | int | List[str | int] | None = None, IDs: str | int | List[str | int] | None = None) SEVNDataLog | Dict[str, SEVNDataLog][source]
Read a series of logfiles retrieving the information for the events in input
- Parameters:
logfiles – Path to the logfile or a list of logfiles paths. It accepts wildcard , e.g. logfile_ to list all the logfile in a folder.
events – label of the events to catch, call
logevents_list()to get the list of available events. It could be both a single string with an event label, or a list of label stringscapturing_cols –
Columns to capture If string it has to be a special value, otherwise a list of column names and/or indexes The special values are:
”all”: return all the column names
”default”: return only the column names with a regex patter to catch a str an int or a float
”header”: return only the colum names of the header
It is possible to include duplicated values, but they will be neglected in the output
nproc –
number of processes to be used for a parallel reading on multiple files.
Note
The number of processes will be anyway limited to number of logfiles to be read
names – List of names to consider in the logfile. If None do not filter the names.
IDs – List of IDs to consider in the logfile. If None do not filter the IDs.
- Returns:
log_info –
If the events input is a string returns a single instance of
SEVNDataLogIf the events input is a list of event labels, return a dictionary containing pairs event_label:
SEVNDataLog
- Return type:
SEVNDataLog or Dictionary
- Raises:
KeyError: – If the event in input is not present in the available event list
Examples
Read a single logfile looking for the events SN and RLO_BEGIN
>>> readlogfiles("logfile_0.dat",events=["SN","RLO_BEGIN"])
Read all the logfiles in the folder using wildcards
>>> readlogfiles("logfile_*.dat",events=["SN","RLO_BEGIN"])