HENDRIX-ZT2 / DifferentialEQ

Sample and average differential equalization curves and export them to audacity.
0 stars 1 forks source link

Failure due to changes in MatPlot #1

Open dikonov opened 7 months ago

dikonov commented 7 months ago

DiffEQ quits after loading wave data with the following error:

Traceback (most recent call last): File "/home/slava/Звук/DifferentialEQ/DifferentialEQ-master/./difeq.py", line 206, in add self.plot() File "/home/slava/Звук/DifferentialEQ/DifferentialEQ-master/./difeq.py", line 279, in plot self.ax.semilogx(self.freqs[from20Hz:], eq[from20Hz:], basex=2, linestyle="dashed", linewidth=.5, alpha=.5, color=self.colors[self.names.index(name)+1]) File "/usr/lib64/python3/site-packages/matplotlib/axes/_axes.py", line 1875, in semilogx self.set_xscale('log', **d) File "/usr/lib64/python3/site-packages/matplotlib/axes/_base.py", line 74, in wrapper return get_method(self)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3/site-packages/matplotlib/axis.py", line 822, in _set_axes_scale ax._axis_map[name]._set_scale(value, **kwargs) File "/usr/lib64/python3/site-packages/matplotlib/axis.py", line 779, in _set_scale self._scale = mscale.scale_factory(value, self, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3/site-packages/matplotlib/scale.py", line 709, in scale_factory return scale_cls(axis, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: LogScale.__init__() got an unexpected keyword argument 'basex'

It appears to be fixed with the following simple patch:

`--- difeq.py.bak 2024-03-05 22:47:23.261558485 +0300 +++ difeq.py 2024-03-05 22:48:46.371846005 +0300 @@ -276,9 +276,9 @@ from20Hz = (np.abs(self.freqs-20)).argmin()

plot the contributing raw curves

        for name, eq in zip(self.names, np.mean(np.asarray(self.eqs), axis=1)):

- self.ax.semilogx(self.freqs[from20Hz:], eq[from20Hz:], basex=2, linestyle="dashed", linewidth=.5, alpha=.5, color=self.colors[self.names.index(name)+1]) + self.ax.semilogx(self.freqs[from20Hz:], eq[from20Hz:], base=2, linestyle="dashed", linewidth=.5, alpha=.5, color=self.colors[self.names.index(name)+1])

take the average

- self.ax.semilogx(self.freqs_av, np.mean(self.av, axis=0), basex=2, linewidth=2.5, alpha=1, color= self.colors[0]) + self.ax.semilogx(self.freqs_av, np.mean(self.av, axis=0), base=2, linewidth=2.5, alpha=1, color= self.colors[0])

refresh canvas

    self.canvas.draw()`
codename0og commented 6 months ago

Those that might wonder what's the fix exactly;

in plot function, you gotta replace "basex" with "base", so:

` #plot the contributing raw curves for name, eq in zip(self.names, np.mean(np.asarray(self.eqs), axis=1)): self.ax.semilogx(self.freqs[from20Hz:], eq[from20Hz:], base=2, linestyle="dashed", linewidth=.5, alpha=.5, color=self.colors[self.names.index(name)+1])

take the average

        self.ax.semilogx(self.freqs_av, np.mean(self.av, axis=0), base=2, linewidth=2.5, alpha=1, color= self.colors[0])`

Just like so ~