def __init__ (self, r_inter, r_intra, kF, mlist): Qm_inter = rpakernel.kernel_m_inter(r_inter.r, mlist, r_inter.label) self.Qm_inter = Kernel(r_inter.r, Qm_inter) Qm_intra = np.zeros((len(r_intra.r), len(r_intra.r))) if (kF * r_intra.r.max() > 0.01): Qm_intra = rpam.kernel_m_intra(r_intra.r, mlist, kF, '3' + r_intra.label) #rpakernel.kernel_m_intra(r, mlist, kF) self.Qm_intra = Kernel(r_intra.r, Qm_intra)
def __init__(self, r_inter, r_intra, kF, mlist): Qm_inter = rpakernel.kernel_m_inter(r_inter.r, mlist, r_inter.label) self.Qm_inter = Kernel(r_inter.r, Qm_inter) Qm_intra = np.zeros((len(r_intra.r), len(r_intra.r))) if (kF * r_intra.r.max() > 0.01): Qm_intra = rpam.kernel_m_intra(r_intra.r, mlist, kF, '3' + r_intra.label) #rpakernel.kernel_m_intra(r, mlist, kF) self.Qm_intra = Kernel(r_intra.r, Qm_intra)
import rpam import rpakernel import numpy as np r = np.linspace(0.01, 50.0, 500) m = np.arange(0.0, 31.0, 1.0) print r print m kF = 3.0 Q = rpam.kernel_m_intra(r, m, kF, '3') #Q1 = rpakernel.kernel_m_intra(r, m, kF) Q1 = rpam.kernel_m_intra(r, m, kF, '4') import pylab as pl for r_i in [0.1, 1.0, 2.0, 5.0, 7.0]: i = np.abs(r - r_i).argmin() pl.figure() pl.plot(r, Q[i, :], label='Q0: r = %g' % r[i]) pl.plot(r, Q1[i, :], label='Q1: r = %g' % r[i]) pl.plot(r, Q1[i, :] - Q[i, :], label='diff: r = %g' % r[i]) pl.legend() pl.show()