Releases: audeering/audmath
Releases · audeering/audmath
Release v1.4.1
- Added: support for
numpy
2.0 - Removed: support for Python 3.8
Release v1.4.0
- Added:
audmath.similarity()
%0A* Added: support for Python 3.12
Release v1.3.0
- Added:
audmath.samples()
- Removed: support for Python 3.7
Release v1.2.1
'^ *' # space
'(' # 1st group: value
'[\\-\\+]?[0-9]*[.]?[0-9]*'
')'
' *' # space
'(' # 2nd group: unit
'[a-zA-Zμ]*'
')'
' *$' # space
duration: typing.Optional[
typing.Union[float, int, str, np.timedelta64]
],
and ``sampling_rate`` is always ignored.
If duration is
``None``,
:obj:`numpy.nan`,
:obj:`pandas.NA`,
:obj:`pandas.NaT`,
``''``,
``'None'``,
``'NaN'``,
``'NaT'``,
or any other lower/mixed case version of those strings
:obj:`numpy.nan` is returned.
If duration is
:obj:`numpy.inf`,
``'Inf'``
or any other lower/mixed case version of that string
:obj:`numpy.inf` is returned,
and ``-``:obj:`numpy.inf` for the negative case
>>> duration_in_seconds('Inf')
inf
>>> duration_in_seconds(None)
nan
# none/-inf/inf duration
if duration.lower() in ['', 'none', 'nan', 'nat']:
return np.NaN
elif duration.lower() == '-inf':
return -np.inf
elif duration.lower() == 'inf' or duration.lower() == '+inf':
return np.inf
match = re.match(VALUE_UNIT_PATTERN, duration)
if not value or value == '+':
elif value == '-':
value = -1.0
# handle nan/none durations
elif (
duration is None
or duration.__class__.__name__ == 'NaTType'
or duration.__class__.__name__ == 'NAType'
or np.isnan(duration)
):
return np.NaN
(None, None, np.NaN),
(None, 1000, np.NaN),
('', None, np.NaN),
('', 1000, np.NaN),
('none', None, np.NaN),
('none', 1000, np.NaN),
('None', None, np.NaN),
('None', 1000, np.NaN),
('nan', None, np.NaN),
('nan', 1000, np.NaN),
('NaN', None, np.NaN),
('NaN', 1000, np.NaN),
('nat', None, np.NaN),
('nat', 1000, np.NaN),
('NaT', None, np.NaN),
('NaT', 1000, np.NaN),
(np.NaN, None, np.NaN),
(np.NaN, 1000, np.NaN),
(pd.NaT, None, np.NaN),
(pd.NaT, 1000, np.NaN),
(pd.NA, None, np.NaN),
(pd.NA, 1000, np.NaN),
(np.timedelta64('NaT', 's'), None, np.NaN),
(np.timedelta64('NaT', 's'), 1000, np.NaN),
('inf', None, np.inf),
('inf', 1000, np.inf),
('Inf', None, np.inf),
('Inf', 1000, np.inf),
(np.inf, None, np.inf),
(np.inf, 1000, np.inf),
(np.Inf, None, np.inf),
(np.Inf, 1000, np.inf),
('+inf', None, np.inf),
('+inf', 1000, np.inf),
('+Inf', None, np.inf),
('+Inf', 1000, np.inf),
(+2, None, 2.0),
(+2, 1000, 0.002),
(+2.0, None, 2.0),
(+2.0, 1000, 0.002),
('+s', None, 1.0),
('+s', 1000, 1.0),
(' +s', None, 1.0),
(' +s', 1000, 1.0),
('+2s', None, 2.0),
('+2s', 1000, 2.0),
('+2s ', None, 2.0),
('+2s ', 1000, 2.0),
(' +2s', None, 2.0),
(' +2s', 1000, 2.0),
('+2 s', None, 2.0),
('+2 s', 1000, 2.0),
('+2 s', None, 2.0),
('+2 s', 1000, 2.0),
('+2000ms', None, 2.0),
('+2000ms', 1000, 2.0),
('+2000.0ms', None, 2.0),
('+2000.0ms', 1000, 2.0),
('+2000 ms', None, 2.0),
('+2000 ms', 1000, 2.0),
('+2000.0 ms', None, 2.0),
('+2000.0 ms', 1000, 2.0),
('+2000', None, 2000.0),
('+2000', 1000, 2.0),
('+2000 ', None, 2000.0),
('+2000 ', 1000, 2.0),
('+2000.0', None, 2000.0),
('+2000.0', 1000, 2.0),
('+2000.1', None, 2000.1),
('+2000.1', 1000, 2.0000999999999998),
('+0.5', None, 0.5),
('+0.5', 2, 0.25),
('+3', 1.5, 2.0),
(np.timedelta64(+2, 's'), None, 2.0),
(np.timedelta64(+2, 's'), 1000, 2.0),
(np.timedelta64(+2000, 'ms'), None, 2.0),
(np.timedelta64(+2000, 'ms'), 1000, 2.0),
(pd.to_timedelta(+2, 's'), None, 2.0),
(pd.to_timedelta(+2, 's'), 1000, 2.0),
(pd.to_timedelta(+2000, 'ms'), None, 2.0),
(pd.to_timedelta(+2000, 'ms'), 1000, 2.0),
('-inf', None, -np.inf),
('-inf', 1000, -np.inf),
('-Inf', None, -np.inf),
('-Inf', 1000, -np.inf),
(-2, None, -2.0),
(-2, 1000, -0.002),
(-2.0, None, -2.0),
(-2.0, 1000, -0.002),
('-s', None, -1.0),
('-s', 1000, -1.0),
(' -s', None, -1.0),
(' -s', 1000, -1.0),
('-2s', None, -2.0),
('-2s', 1000, -2.0),
('-2s ', None, -2.0),
('-2s ', 1000, -2.0),
(' -2s', None, -2.0),
(' -2s', 1000, -2.0),
('-2 s', None, -2.0),
('-2 s', 1000, -2.0),
('-2 s', None, -2.0),
('-2 s', 1000, -2.0),
('-2000ms', None, -2.0),
('-2000ms', 1000, -2.0),
('-2000.0ms', None, -2.0),
('-2000.0ms', 1000, -2.0),
('-2000 ms', None, -2.0),
('-2000 ms', 1000, -2.0),
('-2000.0 ms', None, -2.0),
('-2000.0 ms', 1000, -2.0),
('-2000', None, -2000.0),
('-2000', 1000, -2.0),
('-2000 ', None, -2000.0),
('-2000 ', 1000, -2.0),
('-2000.0', None, -2000.0),
('-2000.0', 1000, -2.0),
('-2000.1', None, -2000.1),
('-2000.1', 1000, -2.0000999999999998),
('-0.5', None, -0.5),
('-0.5', 2, -0.25),
('-3', 1.5, -2.0),
(np.timedelta64(-2, 's'), None, -2.0),
(np.timedelta64(-2, 's'), 1000, -2.0),
(np.timedelta64(-2000, 'ms'), None, -2.0),
(np.timedelta64(-2000, 'ms'), 1000, -2.0),
(pd.to_timedelta(-2, 's'), None, -2.0),
(pd.to_timedelta(-2, 's'), 1000, -2.0),
(pd.to_timedelta(-2000, 'ms'), None, -2.0),
(pd.to_timedelta(-2000, 'ms'), 1000, -2.0),
duration_in_seconds = audmath.duration_in_seconds(duration, sampling_rate)
if np.isnan(expected):
assert np.isnan(duration_in_seconds)
else:
assert duration_in_seconds == expected
Release v1.2.0
- Added:
audmath.duration_in_seconds()
to convert any duration value to seconds
Release v1.1.1
- Added: support for Python 3.11
- Changed: split API documentation into sub-pages
for each function
Release v1.1.0
- Added:
audmath.rms()
to calculate root mean square of signal - Added:
audmath.db()
to convert from amplitude to decibel - Added:
audmath.invert_db()
to convert from decibel to amplitude - Added:
audmath.window()
to provide different kind
of (half-)windows - Added: support for Python 3.10
Release v1.0.0
- Added: Python 3.9 support
- Removed: Python 3.6 support
Release v0.9.4
- Fixed: bottom margin in API table
Release v0.9.3
- Changed: use new
sphinx-audeering-theme