コード例 #1
0
ファイル: plot_tiempos.py プロジェクト: gabybosc/MPB
        posicion[:, i - 11] = mag[:, i]

    # la matriz diaria:
    MD = np.zeros((M, 9))
    MD[:, 0] = t
    for i in range(1, 4):
        MD[:, i] = B[:, i - 1]
    MD[:, 4] = np.linalg.norm(B, axis=1)
    for i in range(5, 8):
        MD[:, i] = posicion[:, i - 5] / 3390  # en radios marcianos
    MD[:, 8] = np.linalg.norm(posicion, axis=1) - 3390  # altitud en km

    ti = t1 - 0.15
    tf = t4 + 0.15

    t_plot, B_para, B_perp_norm = Bpara_Bperp(B, t, ti, tf)

    ###############################################################################################SWEA
    file_size_swea = os.path.getsize(
        path + f'SWEA/mvn_swe_l2_svyspec_{year}{month}{day}_v04_r01.cdf')
    if file_size_swea > 10000000:
        swea = cdf.CDF(
            path + f'SWEA/mvn_swe_l2_svyspec_{year}{month}{day}_v04_r01.cdf')

        flux_all = swea.varget('diff_en_fluxes')
        energia = swea.varget('energy')
        t_unix = swea.varget('time_unix')

        tu = unix_to_decimal(t_unix)
        ti_swea = np.where(tu == find_nearest(tu, ti))[0][0]
        tf_swea = np.where(tu == find_nearest(tu, tf))[0][0]
コード例 #2
0
zoom_inicial = donde(t, t1 - 0.05)
zoom_final = donde(t, t4 + 0.05)

Bnorm = np.linalg.norm(B, axis=1)

mag_low = np.loadtxt(path + "mag_1s.sts", skiprows=160)
tlow = mag_low[:, 6]  # el dia decimal
tlow = (tlow - int(doy)) * 24  # para que me de sobre la cantidad de horas

Mlow = np.size(tlow)  # el numero de datos
# el campo
Blow = np.zeros((Mlow, 3))
for i in range(7, 10):
    Blow[:, i - 7] = mag_low[:, i]

B_para, B_perp_norm, t_plot = Bpara_Bperp(Blow, tlow, t[0], t[-1])

# ######### SWEA

swea, t_swea, energias, JE_cut = importar_swea(year, month, day, ti, tf)
# inicio_swea = np.where(t_swea == find_nearest(t_swea, t1 - 0.075))[0][0]
# fin_swea = np.where(t_swea == find_nearest(t_swea, t4 + 0.075))[0][0]
# ####### densidad SWIA

# swia, t_swia, density = importar_swia(year, month, day, ti, tf)
t_swica, t_swifa, density_swica, density_swifa = importar_swicfa(
    year, month, day, ti, tf)

# ###### densidad electrones
lpw, t_lpw, e_density = importar_lpw(year, month, day, ti, tf)
コード例 #3
0
plt.plot(t, np.linalg.norm(B, axis=1))
plt.ylim([0, 70])
plt.show()

ti, tf = tiempos()
mag, t, B, posicion = importar_mag_1s(year, month, day, ti, tf)
swea, t_swea, energia, flux_plot = importar_swea(year, month, day, ti, tf)
swia, t_swia, i_density, i_temp, vel_mso = importar_swia(
    year, month, day, ti, tf)
# lpw, t_lpw, e_density = importar_lpw(year, month, day, ti, tf)

B_norm = np.linalg.norm(B, axis=1)

B_para, B_perp_norm, t_plot = Bpara_Bperp(
    B, t, ti + 0.2,
    tf - 0.2)  # estos ti, tf tienen que ser menores que el total de datos

index = np.array((int(year), doy))

happy = False
while not happy:
    val = []
    while len(val) < 4:
        plt.clf()  # clear figure
        fig = plt.figure(
            1, constrained_layout=True
        )  # Lo bueno de esta forma es que puedo hacer que solo algunos compartan eje
        fig.subplots_adjust(top=0.95,
                            bottom=0.1,
                            left=0.05,
コード例 #4
0
ファイル: plot_tiempos.py プロジェクト: gabybosc/MPB
tlow = mag_low[:, 6]  # el dia decimal
tlow = (tlow - int(doy)) * 24  # para que me de sobre la cantidad de horas

Mlow = np.size(tlow)  # el numero de datos
# el campo
Blow = np.zeros((Mlow, 3))
for i in range(7, 10):
    Blow[:, i - 7] = mag_low[:, i]


ti = t1 - 0.15
tf = t4 + 0.15

inicio = np.where(t == find_nearest(t, ti))[0][0]
fin = np.where(t == find_nearest(t, tf))[0][0]
B_para, B_perp_norm, t_plot = Bpara_Bperp(Blow, tlow, ti, tf)
# ##############################################################################################SWEA

swea, t_swea, energias = importar_swea(year, month, day, ti, tf)

energy = swea[:, 7]
JE_total = swea[:, -1]
inicio_swea = np.where(t_swea == find_nearest(t_swea, ti))[0][0]
fin_swea = np.where(t_swea == find_nearest(t_swea, tf))[0][0]

# ##############################################################################################SWIA

swia, t_swia, density = importar_swia(year, month, day, ti, tf)

inicio_swia = np.where(t_swia == find_nearest(t_swia, ti))[0][0]
fin_swia = np.where(t_swia == find_nearest(t_swia, tf))[0][0]
コード例 #5
0
ファイル: MVA_rapido.py プロジェクト: gabybosc/MPB
    error_boot = sigma31
else:
    error_boot = sigma32

angulo_mva = np.arccos(np.clip(np.dot(normal_fit, x3), -1.0, 1.0))


print(f"SZA = {SZAngle:.3g}º y altitud = {int(altitud)}km")
print(f"MVA entre los tiempos {ti_MVA} y {tf_MVA}")
print(f"Cociente de lambdas = {lamb[1]/lamb[2]:.4g}")
print(f"El ángulo entre las normales de MVA y del fit es {angulo_mva * 180/np.pi:.3g}º")

ti = t1 - 0.15
tf = t4 + 0.15

B_para, B_perp_norm, t_plot = Bpara_Bperp(B, t, t1, t4)

swea, t_swea, energia, flux_plot = importar_swea(year, month, day, t1 - 0.5, t4 + 0.5)
swia, t_swia, density, temp, vel = importar_swia(year, month, day, t1 - 0.5, t4 + 0.5)

plt.clf()  # clear figure
fig = plt.figure(
    1, constrained_layout=True
)  # Lo bueno de esta forma es que puedo hacer que solo algunos compartan eje
fig.subplots_adjust(
    top=0.93, bottom=0.07, left=0.05, right=0.95, hspace=0.005, wspace=0.15
)
fig.set_size_inches(15, 10)  # con este tamaño ocupa toda la pantalla de la laptop

ax1 = plt.subplot2grid((3, 2), (0, 0))
plt.plot(t_plot, B_para, linewidth=1, label=r"|$\Delta B \parallel$| / B")