Esempio n. 1
0
 def test_plot_inversion1(self):
     # plot_inversion minimum amplitude
     f = fdesign.j0_1(5)
     filt = filters.key_201_2009()
     n = filt.base.size
     a = filt.base[-1]
     b = filt.base[-2]
     spacing = np.log(a) - np.log(b)
     shift = np.log(a) - spacing * (n // 2)
     cvar = 'amp'
     r = np.logspace(0, 1.5, 100)
     f.rhs = f.rhs(r)
     k = filt.base / r[:, None]
     rhs = np.dot(f.lhs(k), filt.j0) / r
     rel_error = np.abs((rhs - f.rhs) / f.rhs)
     imin = np.where(rel_error > 0.01)[0][0]
     fdesign._plot_inversion(f, rhs, r, k, imin, spacing, shift, cvar)
     return plt.gcf()
Esempio n. 2
0
 def test_plot_inversion2(self):
     # plot_inversion maximum r
     f = fdesign.empy_hankel('j2', 50, 100, 1, 1)
     filt = filters.key_201_2009()
     n = filt.base.size
     a = filt.base[-1]
     b = filt.base[-2]
     spacing = np.log(a) - np.log(b)
     shift = np.log(a) - spacing * (n // 2)
     cvar = 'r'
     r = np.logspace(1, 4.5, 100)
     f.rhs = f.rhs(r)
     k = filt.base / r[:, None]
     lhs = f.lhs(k)
     rhs0 = np.dot(lhs[0], filt.j0) / r
     rhs1 = np.dot(lhs[1], filt.j1) / r**2
     rhs = rhs0 + rhs1
     rel_error = np.abs((rhs - f.rhs) / f.rhs)
     imin = np.where(rel_error > 0.01)[0][0]
     fdesign._plot_inversion(f, rhs, r, k, imin, spacing, shift, cvar)
     return plt.gcf()
Esempio n. 3
0
 def test_plot_inversion(self, capsys):
     # Check it doesn't fail, message is correct, and input doesn't matter
     fdesign._plot_inversion(1, 2, 3, 4, 5, 6, 7, 8)
     out, _ = capsys.readouterr()
     assert "* WARNING :: `matplotlib` is not installed, no " in out