dug_seis.util module#
Utility functionality useful across DUGSeis.
- dug_seis.util.compute_intervals(project: dug_seis.project.project.DUGSeisProject, interval_length_in_seconds: float, interval_overlap_in_seconds: float) List[Tuple[UTCDateTime, UTCDateTime]] #
Compute intervals to loop over all data in a project.
- Parameters:
project – DUGSeis project object. The temporal bounds will be read from it.
interval_length_in_seconds – The length of each interval in seconds.
interval_overlap_in_seconds – The overlap between two intervals in seconds.
- Returns:
A list of (start time, end time) obspy.UTCDateTime tuples.
- dug_seis.util.filter_settings_to_function(filter_settings: Dict[str, Any]) Callable #
Convert project filter settings to a callable function.
- Parameters:
filter_settings – The filter settings as given in a DUGSeis project.
- Returns:
A function that can be applied to obspy.Trace objects.
- dug_seis.util.pretty_filesize(num: Union[int, float]) str #
Handy formatting for human readable filesizes.
From http://stackoverflow.com/a/1094933/1657047
- Parameters:
num – The filesize in bytes.
- dug_seis.util.setup_logging_to_file(folder: Optional[Union[str, Path]] = None, log_level: str = 'info')#
Helper function to setup the logging in a tqdm aware fashion.
- Parameters:
folder – Folder where the log file should be stored. If not given it will only log to stdout.
log_level – Desired log level as a string.