util
¶
Utility functions for the OwlPy library.
- arange2(start, stop, step, dtype=<class 'float'>, epsilon=1e-06, error='raise')[source]¶
Return evenly spaced numbers over a specified interval.
Like
numpy.arange()
but returning floating point numbers by default and with defined behaviour when stepsize is inconsistent with interval bounds. It is considered inconsistent if the difference between the closest multiple ofstep
andstop
is larger thanepsilon * step
. Inconsistencies are handled according to theerror
parameter. If it is set to'raise'
an exception of typeArangeError
is raised. If it is set to'round'
,'floor'
, or'ceil'
,stop
is silently changed to the closest, the next smaller, or next larger multiple ofstep
, respectively.This function has been adapted from Pyrocko (pyrocko.util.arange2).
- get_traces_data_as_array(traces)[source]¶
Merge data samples from multiple traces into a 2D array.
- Parameters
traces (list of
obspy.Trace
orpyrocko.Trace
objects) – Input waveforms.- Raises
OwlPyError
if traces have different time span, sample rate or data type, or if traces is an empty list.- Returns
2D array as
data[itrace, isample]
.- Return type