You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memb_analisis_2d3d/Codigo2D_Ejemplo.py

70 lines
2.1 KiB

'''
Ejemplo de implementacion del Ánalisis en el plano ecuatorial
'''
import numpy as np
import matplotlib.pyplot as plt
# from Codigo1 import mcart_msph,msph_mcart,gengraficasph
import Codigo2D_FiltroZ as c1
import Codigo2D_Interpolacion as c2
import Codigo2D_Coefs as c3 # Este incluye a ajuste de Helfrich y a Base
T = 300 # temperatura
time = 50 # tiempo para graficar
# %% PROGRAMA ARIN
normalizacion = 7*10**5 # No es necesaria son uds de los datos
MATRIZ = np.load('matrizcartesianas.npy') # DATOS PROGRAMA ARIN
MATRIZESF = c1.mcart_msph(MATRIZ)
MATRIZESF[:,:,0] = MATRIZESF[:,:,0] / normalizacion # cambiamos el radio / normalizamos (Ver luego que tambien intorud)
MATRIZCART = c1.msph_mcart(MATRIZESF)
# %% FILTRO EN Z
RMatrix = MATRIZESF[:,:,0] # radios
VMR = np.mean(RMatrix) # Valor medio del radio
Z1 = (VMR/10)*0.1 # Una centesima del radio medio
FiltroCart,FiltroEsf = c1.filtroz(MATRIZ,Z1,normalizacion) # Filtramos
# %% INTERPOLACION
MSph = c2.newinterpolate2(FiltroEsf,2001) # Interpolamos
MCart = c1.msph_mcart(MSph)
MCart[:,:,2] = 0
# %% CALCULO DE BENDING Y STRETCH
nmax = 19
nmin = 4 # NOTA nmin = 0, es el modo 1
qx,u,qxnew,unew,bend,stretch = c3.calculatecoefs(MSph,nmin,nmax,T)
# %% GRAFICA
plt.figure()
plt.plot(qx[nmin:nmax],u[nmin:nmax],marker = "o",color = "blue")
plt.plot(qxnew,unew,color="red", linestyle="-.")
plt.title("Coeficientes en función de qx", fontweight="bold")
plt.xlabel("qx", fontweight="bold")
plt.ylabel(r"$\langle \mathbf{|u|^2} \rangle$", fontsize=14)
# GRAFICA FILTRO (Simplemente para ver forma)
mask = FiltroEsf[time,:,0] != 0
FiltroEsfmask = FiltroEsf[time,mask] # Eliminar 0's para ver mejor la grafica
plt.figure()
plt.plot(MSph[time, :, 2], MSph[time, :, 0], marker=".", linestyle="--", color="blue", label=r"Interpolación datos filtro ($\Delta z_1$)")
z1_label = f"$\Delta z_1$ = {np.format_float_scientific(Z1, precision=2)}"
plt.plot(FiltroEsfmask[:,2], FiltroEsfmask[:,0], marker="h", linestyle="none", color="red", label=z1_label)
plt.title("Radio en función de phi", fontweight="bold")
plt.xlabel("PHI", fontweight="bold")
plt.ylabel("R [m]", fontweight = "bold")
plt.legend()
plt.show()