obspy.core.util.misc

Various additional utilities for ObsPy.

copyright:

The ObsPy Development Team (devs@obspy.org)

license:

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

Public Functions

CatchOutput

A context manager that captures input to stdout/stderr.

SuppressOutput

A context manager that suppresses output to stdout/stderr.

TemporaryWorkingDirectory

A context manager that changes to a temporary working directory.

buffered_load_entry_point

Return name entry point of group for dist or raise ImportError :type dist: str :param dist: The name of the distribution containing the entry point.

complexify_string

Converts a string in the form "(real, imag)" into a complex type.

factorize_int

Calculate prime factorization of integer.

flat_not_masked_contiguous

Find contiguous unmasked data in a masked array along the given axis.

get_untracked_files_from_git

Tries to return a list of files (absolute paths) that are untracked by git in the repository.

get_window_times

Function calculating a list of times making up equal length windows from within a given time interval.

guess_delta

Estimate time delta in seconds between each sample from given channel name.

limit_numpy_fft_cache

NumPy's FFT implementation utilizes caches to speedup subsequent FFTs of the same size.

ptp

Replacement for numpy.ndarray.ptp() and the corresponding method on MaskedArray objects which are being removed in numpy 2.0 Basically just makes sure we call the correct replacement function numpy put in place for regular and masked arrays.

score_at_percentile

Calculates the score at the given per percentile of the sequence a.

to_int_or_zero

Converts given value to an integer or returns 0 if it fails.

Private Functions

Warning

Private functions are mainly for internal/developer use and their API might change without notice.

_py3_windowsconsoleio_workaround

This monkey patch prevents crashing Py >=3.6 under Windows while using the SuppressOutput context manager.

_yield_obj_parent_attr

Recurse an object, yield a tuple of object, parent, attr.

_yield_resource_id_parent_attr

Specialized form of _yield_obj_parent_attr for getting ResourceIdentifiers.

Classes

CaptureIO

MatplotlibBackend

A helper class for switching the matplotlib backend.