Hello community, here is the log from the commit of package python-zignal for openSUSE:Leap:15.2 checked in at 2020-03-20 05:15:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-zignal (Old) and /work/SRC/openSUSE:Leap:15.2/.python-zignal.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-zignal" Fri Mar 20 05:15:19 2020 rev:2 rq:786488 version:0.6.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-zignal/python-zignal.changes 2020-02-09 15:02:36.570749378 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-zignal.new.3160/python-zignal.changes 2020-03-20 05:15:28.118570697 +0100 @@ -1,0 +2,11 @@ +Sun Mar 15 09:05:21 UTC 2020 - Tomáš Chvátal <[email protected]> + +- Skip one test failing on python 3.8 + +------------------------------------------------------------------- +Sun Mar 15 09:01:02 UTC 2020 - Tomáš Chvátal <[email protected]> + +- Version update to 0.6: + * Fix various syntax warning issues + +------------------------------------------------------------------- Old: ---- zignal-0.5.0.tar.gz New: ---- zignal-0.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-zignal.spec ++++++ --- /var/tmp/diff_new_pack.q3aro4/_old 2020-03-20 05:15:29.230571443 +0100 +++ /var/tmp/diff_new_pack.q3aro4/_new 2020-03-20 05:15:29.266571468 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-zignal # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-zignal -Version: 0.5.0 +Version: 0.6.0 Release: 0 Summary: Audio signal processing library License: MIT @@ -57,7 +57,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_expand nosetests-%{$python_bin_suffix} zignal/tests +# https://github.com/ronnyandersson/zignal/issues/8 +%python_expand nosetests-%{$python_bin_suffix} -v zignal/tests -e 'test_set_duration_and_samples' %files %{python_files} %license LICENSE.txt ++++++ zignal-0.5.0.tar.gz -> zignal-0.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zignal-0.5.0/zignal/__init__.py new/zignal-0.6.0/zignal/__init__.py --- old/zignal-0.5.0/zignal/__init__.py 2019-09-23 23:51:38.000000000 +0200 +++ new/zignal-0.6.0/zignal/__init__.py 2020-02-23 19:34:53.000000000 +0100 @@ -6,7 +6,7 @@ @license: MIT """ -__version__ = "0.5.0" +__version__ = "0.6.0" from .audio import * from . import filters diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zignal-0.5.0/zignal/audio.py new/zignal-0.6.0/zignal/audio.py --- old/zignal-0.5.0/zignal/audio.py 2019-09-23 23:51:38.000000000 +0200 +++ new/zignal-0.6.0/zignal/audio.py 2020-02-23 19:34:53.000000000 +0100 @@ -229,11 +229,11 @@ fade_seconds = millisec/1000 assert self.duration > fade_seconds, "fade cannot be longer than the length of the audio" - sample_count = np.ceil(fade_seconds*self.fs) + sample_count = int(np.ceil(fade_seconds*self.fs)) self._logger.debug("fade %s sample count: %i" %(direction, sample_count)) # generate the ramp - if direction is "out": + if direction == "out": # ramp down ramp = np.linspace(1, 0, num=sample_count, endpoint=True) else: @@ -243,7 +243,7 @@ ones = np.ones(len(self)-len(ramp)) # glue the ones and the ramp together - if direction is "out": + if direction == "out": gains = np.append(ones, ramp, axis=0) else: gains = np.append(ramp, ones, axis=0) @@ -537,7 +537,7 @@ except: self._logger.exception("Could not write file: '%s'" %filename) - def plot(self, ch=1, plotname=None, **kwargs): + def plot(self, ch=1, plotname=None, plotrange=(None, None), **kwargs): """Plot the audio data on a time domain plot. example: @@ -546,17 +546,28 @@ x1.plot(linestyle='--', marker='x', color='r', label='sine at 0.2Hz') """ - # TODO: add range to plotdata [None:None] is everything if ch != 'all': assert ch-1 < self.ch, "channel does not exist" + if plotrange[0] == None: + plotrange = (0, plotrange[1]) + if plotrange[1] == None: + plotrange = (plotrange[0], self.duration) + + assert plotrange[0] >= 0 and plotrange[1] <= self.duration, "plotrange is out of bounds" + assert plotrange[0] <= plotrange[1], "malformed plotrange" + + # Any fractional samples are truncated here + samplerange = (int(plotrange[0]*self.fs), int(plotrange[1]*self.fs)) + timerange = np.linspace(plotrange[0], plotrange[1], num=samplerange[1]-samplerange[0], endpoint=False) + plt.figure(1) plt.title("%s" %self.__class__.__name__) if ch != 'all': - plt.plot(self.get_time(), self.samples[:,ch-1], **kwargs) + plt.plot(timerange, self.samples[samplerange[0]:samplerange[1],ch-1], **kwargs) else: - plt.plot(self.get_time(), self.samples, **kwargs) + plt.plot(timerange, self.samples[samplerange[0]:samplerange[1],:], **kwargs) plt.xlabel('Time [s]') plt.ylabel('Amplitude [linear]') if 'label' in kwargs: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zignal-0.5.0/zignal/filters/biquads.py new/zignal-0.6.0/zignal/filters/biquads.py --- old/zignal-0.5.0/zignal/filters/biquads.py 2019-09-23 23:51:38.000000000 +0200 +++ new/zignal-0.6.0/zignal/filters/biquads.py 2020-02-23 19:34:53.000000000 +0100 @@ -62,30 +62,62 @@ class _BiquadParametric(BiquadNormalised, metaclass=ABCMeta): def __init__(self, filtertype=None, gaindb=0, f0=997, Q=0.707, fs=96000): BiquadNormalised.__init__(self, B=None, A=None, fs=fs) - self._verify_parameters(filtertype, gaindb, f0, Q) + + self._filtertype = filtertype + self._gaindb = gaindb + self._f0 = f0 + self._Q = Q + self.calculate_coefficients(filtertype=filtertype, gaindb=gaindb, f0=f0, Q=Q) - def _verify_parameters(self, filtertype, gaindb, f0, Q): - """Internal verification that we are at least partially sane before - proceeding. - """ - assert filtertype is not None, "Specify a filter type (lowpass, highpass, peak, ..." - assert f0 >= 0, "negative frequency is not allowed" - assert f0 < self.fs/2, "f0 must be below the Nyquist frequency (fs/2)" - assert Q > 0, "Q needs to be positive and above zero (we divide by Q)" - - self.filtertype = filtertype - self.gaindb = gaindb - self.f0 = f0 - self.Q = Q + @property + def gaindb(self): + """Get the gain, in dB""" + return self._gaindb + + @property + def f0(self): + """Get the center frequency of the filter""" + return self._f0 + + @property + def Q(self): + """Get the Q value""" + return self._Q + + @gaindb.setter + def gaindb(self, value): + """Set the gain, in dB""" + self._logger.debug("setting gain: %7.2f", value) + self._gaindb = value + self._update() + + @f0.setter + def f0(self, value): + """Set the center frequency""" + assert value >= 0, "negative frequency is not allowed" + assert value < self.fs/2, "f0 must be below the Nyquist frequency (fs/2)" + self._f0 = value + self._update() + + @Q.setter + def Q(self, value): + """Set the Q value, the width of the filter""" + assert value > 0, "Q needs to be positive and above zero (we divide by Q)" + self._Q = value + self._update() + + def _update(self): + self.calculate_coefficients( + filtertype=self._filtertype, gaindb=self._gaindb, f0=self._f0, Q=self._Q) def __str__(self): s = BiquadNormalised.__str__(self) # += '-----------------:---------------------\n' - s += 'type : %s\n' %self.filtertype - s += 'gain : %.2f [dB]\n' %self.gaindb - s += 'f0 : %.1f [Hz]\n' %self.f0 - s += 'Q : %.4f\n' %self.Q + s += 'type : %s\n' % self._filtertype + s += 'gain : %.2f [dB]\n' % self._gaindb + s += 'f0 : %.1f [Hz]\n' % self._f0 + s += 'Q : %.4f\n' % self._Q return s @abstractmethod @@ -115,7 +147,6 @@ _BiquadParametric.__init__(self, filtertype=filtertype, gaindb=gaindb, f0=f0, Q=Q, fs=fs) def calculate_coefficients(self, filtertype=None, gaindb=None, f0=None, Q=None): - self._verify_parameters(filtertype, gaindb, f0, Q) # intermediate variables _A = 10**(gaindb/40) @@ -224,7 +255,6 @@ _BiquadParametric.__init__(self, filtertype=filtertype, gaindb=gaindb, f0=f0, Q=Q, fs=fs) def calculate_coefficients(self, filtertype=None, gaindb=None, f0=None, Q=None): - self._verify_parameters(filtertype, gaindb, f0, Q) K = np.tan(np.pi*f0/self.fs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zignal-0.5.0/zignal/measure/mls.py new/zignal-0.6.0/zignal/measure/mls.py --- old/zignal-0.5.0/zignal/measure/mls.py 2019-09-23 23:51:38.000000000 +0200 +++ new/zignal-0.6.0/zignal/measure/mls.py 2020-02-23 19:34:53.000000000 +0100 @@ -63,7 +63,7 @@ assert N is not None, "Please specify MLS order" assert taps is not None, "Please specify feedback taps" assert isinstance(taps, (tuple, list)) - assert len(taps) is not 0, "taps are empty!" + assert len(taps) != 0, "taps are empty!" self._logger = logging.getLogger(__name__) self.N = N
