示例#1
0
import numpy as np
import matplotlib.pyplot as plt
from funciones import fechas
from funciones_plot import plot_datetime
from importar_datos import importar_mag_1s
"""
Plotea sólo los datos de MAG de baja resolución
"""

np.set_printoptions(precision=4)

year, month, day, doy = fechas()
mag, t, B, posicion = importar_mag_1s(year, month, day, 0.1, 24)

plt.figure()
plot_datetime(year, month, day, t, np.linalg.norm(B, axis=1))
plt.xlabel("t (UTC)")
plt.ylabel("|B|")
plt.ylim(ymin=0, ymax=70)
plt.title("MAG lowres hdec")

plt.show(block=False)
示例#2
0
    exit()

fila, hoja_parametros, hoja_MVA, hoja_Bootstrap, hoja_Ajuste = importar_fila(
    year, month, day, doy, ti)
normal = [
    float(hoja_MVA.cell(fila, 16).value),
    float(hoja_MVA.cell(fila, 17).value),
    float(hoja_MVA.cell(fila, 18).value),
]

t1 = float(hoja_parametros.cell(fila, 6).value)
t2 = float(hoja_parametros.cell(fila, 7).value)
t3 = float(hoja_parametros.cell(fila, 8).value)
t4 = float(hoja_parametros.cell(fila, 9).value)

mag, t_mag_entero, B_entero, posicion = importar_mag_1s(
    year, month, day, ti, tf)
swia, t_swia_entero, density, temperature, vel_mso_xyz = importar_swia(
    year, month, day, ti, tf)
"""
giroradio: rg = mp * v_perp / (q_e * B)  en la región upstream
where vperp is the component of the velocity perpendicular to the
direction of the magnetic field and B is the strength of the magnetic field
"""
# selecciono la región upstream:
inicio_mag = donde(t_mag_entero, t1 - 0.1)
fin_mag = donde(t_mag_entero, t1 - 0.05)
inicio_swia = donde(t_swia_entero, t1 - 0.1)
fin_swia = donde(t_swia_entero, t1 - 0.05)

t_mag = t_mag_entero[inicio_mag:fin_mag]
B = B_entero[inicio_mag:fin_mag] * 1e-9  # T
示例#3
0
def Kij(B, m):
    """Calcula la matriz Kij para el vector m-ésimo de campo B."""
    P_ij = np.zeros((3, 3))
    for i in range(3):  # para las tres coordenadas
        for j in range(3):
            P_ij[i, j] = (
                delta_ij(i, j) - B[m, i] * B[m, j] / np.linalg.norm(B[m, :]) ** 2
            )

    K_ij = np.linalg.norm(B[m, :]) ** 2 * P_ij
    return K_ij


year, month, day, doy = 2016, "03", 16, "076"  # fechas()
ti, tf = 18.2258, 18.235  # tiempos()
mag, t, B, posicion = importar_mag_1s(year, month, day, ti, tf)
swia, t_swia, density, temp, v = importar_swia(year, month, day, ti, tf)

# si hay buenos datos de v_electrones usamos ve en lugar de v


normal = [0.920, -0.302, 0.251]
# B y v no tienen la misma cantidad de puntos, tengo que diezmar (como siempre)

idx = diezmar(t, t_swia)
B_cut = B[idx]

K0 = np.mean(
    [Kij(B_cut, m) for m in range(len(B_cut))], axis=0
)  # tiene que ser una matriz
KK = np.mean([np.dot(Kij(B_cut, m), v[m, :]) for m in range(len(B_cut))], axis=0)