s_max_H = 2  #axisymmteric magnetic field. B has only s = 1.

#for a-coefficients
j_max = 10

#if we want to use smoothened kernels
smoothen = False
#nl_list = [[0, 65], [0, 61], [0, 63], [0, 67], [0, 69]]
#nl_list = [(0, 69), (0, 71), (0, 73), (0, 75), (0, 77), (0, 79), (0, 81), (0, 83), (0, 85)]
nl_list = [(0, 75), (0, 77), (0, 79)]
# nl_list = [(1, 5), (1, 7), (1, 9)]
# nl_list = [(1,10)]
nl_list = np.array(nl_list)
omega_list = np.loadtxt('muhz.dat') * 1e-6 / OM  #normlaised frequency list
omega_nl = np.array(
    [omega_list[fn.find_nl(mode[0], mode[1])] for mode in nl_list])
omega_ref0 = np.mean(omega_nl)

#print omega_nl
#sys.exit()

total_m = len(nl_list) + 2 * np.sum(nl_list, axis=0)[1]

# Z = np.zeros((total_m, total_m))
# Z_diag = np.identity(total_m)
# Z_dpt = np.zeros((total_m, total_m))
# mi_beg = 0
# for i in range(len(nl_list)):
#     mj_beg = 0
#     for j in range(len(nl_list)):
#         tstamp()
#PLOTTING CORRECTION TO SHRAVAN'S KERNEL
	
import timing
kernclock = timing.stopclock() #stopclock object for timing program
tstamp = kernclock.lap
import numpy as np
import matplotlib.pyplot as plt
import functions as fn
from os import getcwd

tstamp('library loading') #printing elapsed time from beginning of runtime

n,l,m = 1,60,0
n_,l_,m_ = n,l,2
nl = fn.find_nl(n,l)
nl_ = fn.find_nl(n_,l_)
s = 22
t = m_-m


#Savitsky golay filter for smoothening
window = 45  #must be odd
order = 3

if(nl == None or nl_ == None):
	print("Mode not found. Exiting."); exit()

#loading required functions
eig_dir = (getcwd() + '/eig_files')
U,V = fn.load_eig(n,l,eig_dir)
U_,V_= fn.load_eig(n_,l_,eig_dir)
Ejemplo n.º 3
0
width = 50
eps = 0.2
ind_om = list(zip(om_sorted_ind, np.take(omega_list, om_sorted_ind)))

for i in range(len(omega_list)):
    mode_set = [fn.find_mode(ind_om[i][0])]
    omega0 = ind_om[i][1]
    l0 = fn.find_mode(ind_om[i][0])[1]
    n0 = fn.find_mode(ind_om[i][0])[0]
    for j in range(max(0, i - width), min(len(omega_list), i + width + 1)):
        omega1 = ind_om[j][1]
        l1 = fn.find_mode(ind_om[j][0])[1]
        n1 = fn.find_mode(ind_om[j][0])[0]
        #if (np.abs(omega0 - omega1) < eps and i != j and n0 != n1 and np.abs(l0-l1) < 4 and (l0-l1)%2==0 and l0 < 100 and l0 > 20):
        if (np.abs(omega0 - omega1) < eps and i != j and n0 == n1):
            mode_set.append(fn.find_mode(ind_om[j][0]))
    if (len(mode_set) > 1):
        omega_set = [
            omega_list[fn.find_nl(mode[0], mode[1])] for mode in mode_set
        ]
        if (omega_set[1] < omega_set[0]):
            ind0 = np.argmin(np.argsort(omega_set))
            temp = mode_set[0]
            mode_set[:ind0] = mode_set[1:ind0 + 1]
            mode_set[ind0] = temp
            temp = omega_set[0]
            omega_set[:ind0] = omega_set[1:ind0 + 1]
            omega_set[ind0] = temp

        print(mode_set)
        print(omega_set)
Ejemplo n.º 4
0
    def ret_kerns(self):
        n, l, m, n_, l_, m_ = self.n, self.l, self.mm, self.n_, self.l_, self.mm_
        r_start, r_end = self.r_range
        nl = fn.find_nl(n, l)
        nl_ = fn.find_nl(n_, l_)

        len_m, len_m_, len_s = np.shape(self.ss_o)

        #Savitsky golay filter for smoothening
        window = 45  #must be odd
        order = 3

        if (nl == None or nl_ == None):
            print("Mode not found. Exiting.")
            exit()

        #loading required functions
        eig_dir = (getcwd() + '/eig_files')
        Ui, Vi = fn.load_eig(n, l, eig_dir)
        Ui_, Vi_ = fn.load_eig(n_, l_, eig_dir)
        rho = np.loadtxt('rho.dat')

        #slicing the radial function acoording to radial grids
        r = self.r
        rho = rho[r_start:r_end]
        Ui = Ui[r_start:r_end]
        Vi = Vi[r_start:r_end]
        Ui_ = Ui_[r_start:r_end]
        Vi_ = Vi_[r_start:r_end]

        tstamp()
        om = np.vectorize(fn.omega)
        parity_fac = (-1)**(l + l_ + self.ss_o)  #parity of selected modes
        prefac = 1./(4.* np.pi) * np.sqrt((2*l_+1.) * (2*self.ss_o+1.) * (2*l+1.) \
                    / (4.* np.pi)) * self.wig_red_o(-m_,m_-m,m)
        tstamp('prefac computation')

        #EIGENFUCNTION DERIVATIVES

        #smoothing

        #interpolation params
        #npts = 30000
        #r_new = np.linspace(np.amin(r),np.amax(r),npts)

        #Ui,dUi,d2Ui = fn.smooth(U,r,window,order,npts)
        #Vi,dVi,d2Vi = fn.smooth(V,r,window,order,npts)

        #Ui_,dUi_,d2Ui_ = fn.smooth(U_,r,window,order,npts)
        #Vi_,dVi_,d2Vi_ = fn.smooth(V_,r,window,order,npts)

        #rho_sm, __, __ = fn.smooth(rho,r,window,order,npts)
        ##re-assigning with smoothened variables
        #r = r_new
        #rho = rho_sm

        ##no smoothing
        dUi, dVi = np.gradient(Ui, r), np.gradient(Vi, r)
        dUi_, dVi_ = np.gradient(Ui_, r), np.gradient(Vi_, r)
        d2Ui_, d2Vi_ = np.gradient(dUi_, r), np.gradient(dVi_, r)
        tstamp('load eigfiles')

        #making U,U_,V,V_,dU,dU_,dV,dV_,d2U,d2U_,d2V,d2V_ of same shape

        U = np.tile(Ui, (len_s, 1))
        V = np.tile(Vi, (len_s, 1))
        dU = np.tile(dUi, (len_s, 1))
        dV = np.tile(dVi, (len_s, 1))
        U_ = np.tile(Ui_, (len_s, 1))
        V_ = np.tile(Vi_, (len_s, 1))
        dU_ = np.tile(dUi_, (len_s, 1))
        dV_ = np.tile(dVi_, (len_s, 1))
        d2U_ = np.tile(d2Ui_, (len_s, 1))
        d2V_ = np.tile(d2Vi_, (len_s, 1))
        r = np.tile(r, (len_s, 1))

        tstamp()

        #B-- EXPRESSION
        Bmm = -r*(self.wig_red(0,-2,2)*om(l,0)*om(l,2)*V*dU_ + self.wig_red(2,-2,0)*om(l_,0)* \
                om(l_,2)*V_*dU)
        Bmm += self.wig_red(1, -2, 1) * om(l_, 0) * om(
            l, 0) * (U - V) * (U_ - V_ + r * dV_)
        Bmm = (((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                 * (Bmm/r**2)[np.newaxis,:,:]
        #B-- EXTRA
        Bmm_ = om(l_,0)*(self.wig_red(2,-2,0)*om(l_,2)*U*(V_ - r*dV_) + om(l,0)*V \
                *(self.wig_red(3,-2,-1)*om(l_,2)*om(l_,3)*V_ + self.wig_red(1,-2,1) \
                *(-U_ + V_ + om(l_,2)**2 *V_ - r*dV_)))
        Bmm_ = (((-1)**np.abs(1+m_))*prefac)[:,:,:,np.newaxis] \
                 * (Bmm_/r**2)[np.newaxis,:,:]

        #        tstamp('Bmm done')

        #B0- EXPRESSION
        B0m = self.wig_red(1, -1, 0) * om(
            l_, 0) * (U - (om(l, 0)**2) * V) * (U_ - V_ + r * dV_)
        B0m += om(l,0)*(om(l_,0)*(self.wig_red(-1,-1,2)*om(l,2)*V*(U_ - V_ + r*dV_) \
            + 2*r*self.wig_red(2,-1,-1)*om(l_,2)*V_*dV) + self.wig_red(0,-1,1) \
            *((U-V)*(2*U_ - 2*(om(l_,0)**2)*V_ - r*dU_) + r**2 * dU_*dV))

        B0m = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B0m/r**2)[np.newaxis,:,:]

        #B0- EXTRA
        B0m_ = om(l,0)*V*(self.wig_red(2,-1,-1)*om(l_,0)*om(l_,2)*(U_ - 3*V_ + r*dV_) \
                + self.wig_red(0,-1,1)*((2+om(l_,0)**2)*U_ - 2*r*dU_ + om(l_,0)**2 \
                *(-3*V_ + r*dV_)))
        B0m_ += self.wig_red(1, -1, 0) * om(
            l_, 0) * U * (U_ - V_ - r * (dU_ - dV_ + r * d2V_))
        B0m_ = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B0m_/r**2)[np.newaxis,:,:]
        #        tstamp('B0m done')

        #B00 OLD
        B00 = -self.wig_red(0,0,0)*(2*U_ - 2*om(l_,0)**2 * V_ - r*dU_)*(-2*U + 2*om(l,0)**2 *V + \
                r*dU)
        B00 -= 2*r*(self.wig_red(-1,0,1) + self.wig_red(1,0,-1))*om(l_,0)*om(l,0) \
            *(U_ - V_ + r*dV_)*dV

        # B00 = np.tile(B00,(len_m,len_m_,1,1))

        B00 = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B00/r**2)[np.newaxis,:,:]
        #B00 EXTRA
        B00_ = -(self.wig_red(-1, 0, 1) + self.wig_red(1, 0, -1)) * om(
            l_, 0) * om(l, 0) * V * (-4 * U_ + 2 *
                                     (1 + om(l_, 0)**2) * V_ + r *
                                     (dU_ - 2 * dV_))
        B00_ += self.wig_red(
            0, 0, 0) * U * (2 * U_ - 2 * r * dU_ - 2 * om(l_, 0)**2 *
                            (V_ - r * dV_) + r * r * d2U_)

        #B00_ = np.tile(B00_,(len_m,len_m_,1,1))

        B00_ = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B00_/r**2)[np.newaxis,:,:]

        #        tstamp('B00 done')

        #B+- OLD
        Bpm = -r**2 * self.wig_red(0, 0, 0) * dU_ * dU
        Bpm += om(l_,0)*om(l,0)*(-2*(self.wig_red(-2,0,2)+self.wig_red(2,0,-2))*om(l_,2)*om(l,2)*V_*V \
                + self.wig_red(-1,0,1)*(U-V)*(U_ - V_ + r*dV_) + self.wig_red(1,0,-1) \
                *(U-V)*(U_ - V_ + r*dV_))

        # Bpm = np.tile(Bpm,(len_m,len_m_,1,1))

        Bpm = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (Bpm/r**2)[np.newaxis,:,:]
        #B0+- EXTRA
        Bpm_ = (self.wig_red(-1, 0, 1) + self.wig_red(1, 0, -1)) * om(
            l_, 0) * om(l, 0) * V * (U_ - V_ + r * (-dU_ + dV_))
        Bpm_ += self.wig_red(0, 0, 0) * r * r * U * d2U_

        # Bpm_ = np.tile(Bpm_,(len_m,len_m_,1,1))

        Bpm_ = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (Bpm_/r**2)[np.newaxis,:,:]

        #        tstamp('Bpm done')

        Bmm += Bmm_
        B0m += B0m_
        B00 += B00_
        Bpm += Bpm_

        Bmm = Bmm.astype('float64')
        B0m = B0m.astype('float64')
        B00 = B00.astype('float64')
        Bpm = Bpm.astype('float64')

        #constructing the other two components of the kernel
        Bpp = parity_fac[:, :, :, np.newaxis] * Bmm
        Bp0 = parity_fac[:, :, :, np.newaxis] * B0m

        return Bmm, B0m, B00, Bpm, Bp0, Bpp
r_end = 1.0
start_ind = fn.nearest_index(r, r_start)
end_ind = fn.nearest_index(r, r_end)
r = r[start_ind:end_ind + 1]
OM = np.loadtxt('OM.dat')

# n1,l1 = 4,3
# n2,l2 = 1,10
# n3,l3 = 0,60

n1, l1 = 15, 102
n2, l2 = 15, 50
n3, l3 = 15, 10

omega_list = np.loadtxt('muhz.dat')
omega_nl1 = omega_list[fn.find_nl(n1, l1)]
omega_nl2 = omega_list[fn.find_nl(n2, l2)]
omega_nl3 = omega_list[fn.find_nl(n3, l3)]

m = np.array([0])
m_ = np.array([0])
s = np.array([2])

#condition about whether or not to scale by rho
multiplyrho = True
smoothen = True

# plot_fac = OM**2 * 1e12 * (4.*np.pi/3) * 1e-10 #unit = muHz G^(-2) V_sol^(-1)
plot_fac = OM**2 * 1e12 * 1e-10  #unit = muHz G^(-2)

#extracting rho in an unclean fashion
import functions as fn
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
import submatrix

OM = np.loadtxt('OM.dat')
r = np.loadtxt('r.dat')
n, l = 0, 200
m = np.arange(-l, l + 1)
omega_ref = np.loadtxt('muhz.dat')[fn.find_nl(n, l)] * 1e-6 / OM

a = submatrix.diffrot(n, n, l, l, r, omega_ref)
b = np.loadtxt('omegs200')

#a = np.sqrt(omega_ref**2 + a.astype('float64')) * 1e6 *OM
a = (omega_ref + a.astype('float64') / (2. * omega_ref)) * 1e6 * OM

plt.subplot(211)
plt.plot(m, a, label='dpt')
plt.plot(m, b, label='obs')
plt.legend()
plt.grid(True)

plt.subplot(212)
plt.plot(m, a - b, label='dpt - obs')
plt.legend()
plt.grid(True)

del_omega_a = a - omega_ref * OM * 1e6
del_omega_b = b - omega_ref * OM * 1e6
Ejemplo n.º 7
0
#R_sol = 6.956e10 cm
#B_0 = 10e5 G
#OM = np.sqrt(4*np.pi*R_sol*B_0**2/M_sol)

OM = np.loadtxt('OM.dat') #importing normalising frequency value from file (in Hz (cgs))

field_type = 'dipolar'o
r = np.loadtxt('r.dat')
r_start, r_end = 0.,1.
start_ind, end_ind = [fn.nearest_index(r, pt) for pt in (r_start, r_end)]
r = r[start_ind:end_ind]

nl_list = np.array([ [0, 97], [0, 99], [0, 101]])
#nl_list = np.array([[0,2],[0,3]])
omega_list = np.loadtxt('muhz.dat') * 1e-6 / OM #normlaised frequency list
omega_nl = np.array([omega_list[fn.find_nl(mode[0], mode[1])] for mode in nl_list])
omega_ref = np.sqrt(np.mean(omega_nl**2))

#print omega_nl
#sys.exit()

total_m = len(nl_list) + 2*np.sum(nl_list, axis = 0)[1]

Z = np.empty((total_m, total_m))
Z_diag = np.identity(total_m)
Z_dpt = np.zeros((total_m, total_m))
mi_beg = 0
for i in range(len(nl_list)):
    mj_beg = 0
    for j in range(len(nl_list)): 
        tstamp()
Ejemplo n.º 8
0
    def ret_kerns(self):
        n, l, m, n_, l_, m_ = self.n, self.l, self.mm, self.n_, self.l_, self.mm_
        r_start, r_end = self.r_range
        nl = fn.find_nl(n, l)
        nl_ = fn.find_nl(n_, l_)

        len_m, len_m_, len_s = np.shape(self.ss_o)

        #Savitsky golay filter for smoothening
        window = 45  #must be odd
        order = 3

        if (nl == None or nl_ == None):
            print("Mode not found. Exiting.")
            exit()

        tstamp()
        om = np.vectorize(fn.omega)
        parity_fac = (-1)**(l + l_ + self.ss_o)  #parity of selected modes
        prefac = 1./(4.* np.pi) * np.sqrt((2*l_+1.) * (2*self.ss_o+1.) * (2*l+1.) \
                    / (4.* np.pi)) * self.wig_red_o(-m_,m_-m,m)
        tstamp('prefac computation')

        #EIGENFUCNTION DERIVATIVES

        ##########################################################3
        #smoothingR2 = 0.78
        #interpolation params
        # npts = 3000
        # r_new = np.linspace(np.amin(self.r),np.amax(self.r),npts)
        # self.ss_i,__ = np.meshgrid(self.s,r_new, indexing = 'ij')

        # Ui,dUi,d2Ui = fn.smooth(self.Ui,self.r,window,order,npts)
        # Vi,dVi,d2Vi = fn.smooth(self.Vi,self.r,window,order,npts)

        # Ui_,dUi_,d2Ui_ = fn.smooth(self.Ui_,self.r,window,order,npts)
        # Vi_,dVi_,d2Vi_ = fn.smooth(self.Vi_,self.r,window,order,npts)

        # rho_sm, __, __ = fn.smooth(self.rho,self.r,window,order,npts)
        # #re-assigning with smoothened variables
        # r = r_new
        # rho = rho_sm

        ###############################################################
        #no smoothing

        r = self.r
        rho = self.rho
        Ui = self.Ui
        Vi = self.Vi
        Ui_ = self.Ui_
        Vi_ = self.Vi_

        dUi, dVi = np.gradient(Ui, r), np.gradient(Vi, r)
        dUi_, dVi_ = np.gradient(Ui_, r), np.gradient(Vi_, r)
        d2Ui_, d2Vi_ = np.gradient(dUi_, r), np.gradient(dVi_, r)
        tstamp('load eigfiles')

        #################################################################3

        #making U,U_,V,V_,dU,dU_,dV,dV_,d2U,d2U_,d2V,d2V_ of same shape

        U = np.tile(Ui, (len_s, 1))
        V = np.tile(Vi, (len_s, 1))
        dU = np.tile(dUi, (len_s, 1))
        dV = np.tile(dVi, (len_s, 1))
        U_ = np.tile(Ui_, (len_s, 1))
        V_ = np.tile(Vi_, (len_s, 1))
        dU_ = np.tile(dUi_, (len_s, 1))
        dV_ = np.tile(dVi_, (len_s, 1))
        d2U_ = np.tile(d2Ui_, (len_s, 1))
        d2V_ = np.tile(d2Vi_, (len_s, 1))
        r = np.tile(r, (len_s, 1))

        tstamp()

        print(np.shape(V), np.shape(V_), np.shape(dU_), np.shape(r))

        #B-- EXPRESSION
        Bmm = self.wig_red(3, -2, -1) * om(l, 0) * om(l_, 0) * om(l_, 2) * om(
            l_, 3) * V * V_
        Bmm += self.wig_red(0, -2, 2) * om(l, 0) * om(l, 2) * r * V * dU_
        Bmm += self.wig_red(1, -2, 1) * om(l_, 0) * om(
            l, 0) * (-U * U_ + U * V_ + om(l_, 2)**2 * V * V_ - r * U * dV_)
        Bmm += self.wig_red(2, -2, 0) * om(l_, 0) * om(
            l_, 2) * (U * V_ + r * dU * V_ - r * U * dV_)
        Bmm = (((-1)**np.abs(1+m_))*prefac)[:,:,:,np.newaxis] \
                 * (Bmm/r**2)[np.newaxis,:,:]
        #tstamp('Bmm done')

        #B0- EXPRESSION
        B0m = self.wig_red(0, -1, 1) * om(
            l, 0) * (2 * U * U_ + om(l_, 2)**2 * V * U_ + om(l_, 0)**2 *
                     (-2 * U * V_ - V * V_ + r * V * dV_) + r *
                     (-U - V + r * dV) * dU_)
        B0m += self.wig_red(-1, -1, 2) * om(l, 0) * om(l_, 0) * om(
            l, 2) * V * (U_ - V_ + r * dV_)
        B0m += self.wig_red(2, -1, -1) * om(l, 0) * om(l_, 0) * om(
            l_, 2) * (V * U_ - 3 * V * V_ + r * V * dV_ + 2 * r * dV * V_)
        B0m -= self.wig_red(1, -1, 0) * om(
            l_, 0) * (-2 * U * U_ + om(l_, 0)**2 * V * U_ + om(l, 0)**2 *
                      (-V * V_ + r * V * dV_) + U *
                      (2 * V_ + r * (dU_ - 2 * dV_ + r * d2V_)))
        B0m = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B0m/r**2)[np.newaxis,:,:]
        #tstamp('B0m done')

        #        print(np.shape(self.wig_red(-1,-0,1)))
        #        exit()

        #B00 EXPRESSION
        B00 = -(self.wig_red(-1, 0, 1) + self.wig_red(1, 0, -1)) * om(
            l_, 0) * om(l, 0) * (V *
                                 (-4 * U_ + 2 * (1 + om(l_, 0)**2) * V_ + r *
                                  (dU_ - 2 * dV_)) + 2 * r * dV *
                                 (U_ - V_ + r * dV_))
        B00 += self.wig_red(0, 0, 0) * (
            (6 * U - 4 * om(l, 0)**2 * V - 2 * r * dU) * U_ +
            2 * om(l_, 0)**2 *
            ((-3 * U + 2 * om(l, 0)**2 * V + r * dU) * V_ + r * U * dV_) + r *
            ((-4 * U + 2 * om(l, 0)**2 * V + r * dU) * dU_ + r * U * d2U_))
        B00 = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (B00/r**2)[np.newaxis,:,:]
        #tstamp('B00 done')

        #B+- EXPRESSION
        Bpm = -2 * (self.wig_red(-2, 0, 2) + self.wig_red(2, 0, -2)) * om(
            l_, 0) * om(l, 0) * om(l_, 2) * om(l, 2) * V * V_
        Bpm += (self.wig_red(-1, 0, 1) + self.wig_red(1, 0, -1)) * om(
            l_, 0) * om(l, 0) * (-r * V * dU_ + U * (U_ - V_ + r * dV_))
        Bpm += self.wig_red(0, 0, 0) * r * r * (-dU * dU_ + U * d2U_)
        Bpm = (0.5*((-1)**np.abs(m_))*prefac)[:,:,:,np.newaxis] \
                * (Bpm/r**2)[np.newaxis,:,:]
        #tstamp('Bpm done')

        Bmm = Bmm.astype('float64')
        B0m = B0m.astype('float64')
        B00 = B00.astype('float64')
        Bpm = Bpm.astype('float64')

        #constructing the other two components of the kernel
        Bpp = parity_fac[:, :, :, np.newaxis] * Bmm
        Bp0 = parity_fac[:, :, :, np.newaxis] * B0m

        return Bmm, B0m, B00, Bpm, Bp0, Bpp
#rearranging so that we can iterate for all l's over a fixed n's
for i in range(1, 33):  #max n goes upto 32
    nl_arr_temp = nl_list[nl_list[:, 0] == i]
    nl_arr = np.append(nl_arr, nl_arr_temp[nl_arr_temp[:, 1] > 2], axis=0)

nl_arr = nl_arr.astype(int)

Bmm_all = np.zeros((len(nl_arr), npts))
B0m_all = np.zeros((len(nl_arr), npts))
B00_all = np.zeros((len(nl_arr), npts))
Bpm_all = np.zeros((len(nl_arr), npts))

#some dummy n,l to get rho. I know its unclean.
n0 = nl_arr[0, 0]
l0 = nl_arr[0, 1]
omega_nl0 = omega_list[fn.find_nl(n0, l0)]

rho,__,__,__,__,_,_ = np.array(gkerns.Hkernels(n0,l0,m,n0,l0,m,s,r)\
                        .ret_kerns_axis_symm(a_coeffkerns = True))

for i in range(len(nl_arr)):
    nl = nl_arr[i]
    n = nl[0]
    l = nl[1]

    omega_nl = omega_list[fn.find_nl(n, l)]

    print(s, n, l)
    __, Bmm, B0m,B00, Bpm,_,_ = np.array(gkerns.Hkernels(n,l,m,n,l,m,s,r)\
                        .ret_kerns_axis_symm(a_coeffkerns = True))*plot_fac/(-2*omega_nl)