Пример #1
0
def datos():
    year, month, day, doy = fechas()
    ti, tf = tiempos()
    # path = f'../../../datos/clweb/{year}-{month}-{day}/' #path a los datos desde la laptop
    path = f"../../../../../media/gabybosc/datos/clweb/{year}-{month}-{day}/"
    mag = np.loadtxt(path + "MAG.asc")

    M = len(mag[:, 0])  # el numero de datos

    hh = mag[:, 3]
    mm = mag[:, 4]
    ss = mag[:, 5]

    t = hh + mm / 60 + ss / 3600  # hdec
    t_utc = [f"{int(hh[j])}:{int(mm[j])}" for j in range(len(t))]

    posicion = np.zeros((M, 3))
    for i in range(9, 12):
        posicion[:, i - 9] = mag[:, i] / 3390

    inicio = np.where(t == find_nearest_inicial(t, ti))[0][0]
    fin = np.where(t == find_nearest_final(t, tf))[0][0]

    posicion_cut = posicion[inicio:fin, :]
    t_cut = t[inicio:fin]

    return (t_cut, posicion_cut, year, month, day)
Пример #2
0
    find_nearest,
    find_nearest_final,
    find_nearest_inicial,
    fechas,
    tiempos,
)
"""
Hace el MVA
calcula el ángulo entre normales
calcula el ancho de la mpb
calcula la corriente
No estoy segura de si debería cambiar algo más que simplemente el orden como tomo t1 t2 t3 t4
"""

year, month, day, doy = fechas()
ti, tf = tiempos("Región de análisis (no MVA)")
ti_MVA, tf_MVA = tiempos("Intervalo del MVA")

print(
    "Si tira error de que no encuentra el path, hay que abrir una vez el disco manualmente para que lo monte"
)

mag, t, B, posicion = importar_mag(year, month, day, ti, tf)
lpw, t_lpw, e_density = importar_lpw(year, month, day, ti, tf)
x3, B_cut, t_cut, posicion_cut, nr = MVA(year, month, day, ti_MVA, tf_MVA)
normal_ajuste, t4, t3, t2, t1 = ajuste(year, month, day, doy, ti_MVA, tf_MVA,
                                       nr)

M = len(t)
M_cut = len(t_cut)
Пример #3
0
    fechas,
    tiempos,
)
from MVA_hires import MVA
from importar_datos import importar_lpw, importar_mag
"""
Hace el MVA
calcula el ángulo entre normales
calcula el ancho de la mpb
calcula la corriente

NO NECESITA YA ACTUALIZAR LA FECHA EN GDOCS
"""

year, month, day, doy = fechas()
ti_MVA, tf_MVA = tiempos()

mag, t, B, posicion = importar_mag(year, month, day, ti_MVA - 1, tf_MVA + 1)
lpw, t_lpw, e_density = importar_lpw(year, month, day, ti_MVA - 1, tf_MVA + 1)

(
    x3,
    normal_boot,
    normal_fit,
    inicio,
    fin,
    B_cut,
    t1,
    t2,
    t3,
    t4,
Пример #4
0
import matplotlib.pyplot as plt
from funciones import fechas, tiempos
from importar_datos import importar_mag
"""
Hace un filtro butterworth para quitar el ruido de la señal que es de aproximadamente 180 ms.
Primero usa buttord para encontrar el orden.
Es un filtro digital con lo cual pide que las frecuencias estén normalizadas
respecto de la frec de Nyquist. En este caso Nyquist es 32Hz/2 = 16Hz.
Como las frecuencias están normalizadas, da lo mismo usar f o w.
N es el orden del filtro, en general voy a querer que N sea cercano a 10.

Comentado está otro filtro más fuerte.
"""

year, month, day, doy = fechas()
ti, tf = tiempos()

mag, t, B, posicion = importar_mag(year, month, day, ti, tf)
path = "../../datos/MAG_hires/"

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

# de 18.2539  a 18.255: 18:15:14 a 18:15:18

Tseg = 180e-3  # 180ms
fs = 1 / Tseg / 16  # f normalizada, da lo mismo si es omega o frec
fp = 3 / 16  # fp < fs para que sea pasabajos
N, Wn = signal.buttord(fp, fs, 3, 50)
b, a = signal.butter(N, Wn, "low")
Bx_filtrado = signal.filtfilt(b, a, B[:, 0])
By_filtrado = signal.filtfilt(b, a, B[:, 1])
Пример #5
0
sys.path.append("..")

from funciones import fechas, donde, tiempos, diezmar

np.set_printoptions(precision=4)

"""
Calcula el E convectivo. Igual debería asegurarme de que esté funcionando bien
porque tengo mis dudas.
Usa los datos de SWIA de pds y los de MAG de clweb.
"""

# ##########DATOS
year, month, day, doy = fechas()
ti_ms, tf_ms = tiempos("magnetofunda")  # 18.06, 18.2193  #
ti_down, tf_down = tiempos("región downstream")  # 18.3, 18.5  #


def importar_mag(year, month, day, ti, tf):
    path = (
        f"../../datos/clweb/{year}-{month}-{day}/"  # path a los datos desde la laptop
    )
    if os.path.isfile(path + "mag_filtrado.txt"):
        mag = np.loadtxt(path + "mag_filtrado.txt", skiprows=2)
        B = mag[:, :3]
        mag = np.loadtxt(path + "MAG.asc")

    else:
        mag = np.loadtxt(path + "MAG.asc")
        B = mag[:, 6:9]
Пример #6
0
    inicio = donde(t, ti)
    fin = donde(t, tf)

    t_cut = t[inicio:fin]
    vel_cut = vel_mso_xyz[inicio:fin]
    vel_norm_cut = vel_norm[inicio:fin]
    d_cut = density[inicio:fin]

    return swifa, t_cut, d_cut, vel_cut, vel_norm_cut


mp = 1.67e-27  # kg
mu_0 = np.pi * 4e-7  # T m / A
year, month, day, doy = fechas()
ti_sw, tf_sw = tiempos("tiempo inicial y final en el viento solar\n")
# ti_MS, tf_MS = tiempos("tiempo inicial y final de la magnetofunda\n")

hoja_parametros, hoja_MVA, hoja_Bootstrap, hoja_Ajuste = importar_gdocs()

fila = input("En qué fila del gdoc estamos?\n")
tf_MPR = float(hoja_parametros.cell(fila, 6).value)
ti_MPR = tf_MPR - 0.015
normal = [
    float(hoja_MVA.cell(fila, 16).value),
    float(hoja_MVA.cell(fila, 17).value),
    float(hoja_MVA.cell(fila, 18).value),
]

swifa, t_sw, density_sw, vel_sw, vel_norm_sw = importar_swifa(
    year, month, day, ti_sw, tf_sw)
Пример #7
0
from funciones import (
    datenum,
    donde,
    proyecciones,
    fechas,
    tiempos,
)

np.set_printoptions(precision=4)
"""
Este script plotea mag, swea, swia y lpw en la región de interés
Es la fig principal del grl.

"""
year, month, day, doy = fechas()
ti, tf = tiempos("tiempo inicial y final en el viento solar\n")

path = f"../../../datos/clweb/{year}-{month}-{day}/"
# path = f"../../../../../media/gabybosc/datos/clweb/{year}-{month}-{day}/"  # path a los datos desde la desktop.
datos_t = np.loadtxt("../outputs/t1t2t3t4.txt")

mag, t, B, posicion = importar_mag(year, month, day, ti, tf)
t1, t2, t3, t4 = importar_t1t2t3t4(year, doy, int(ti))

t_up = t1 - 0.015
t_down = t4 + 0.015

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

# ############ tiempos UTC
year = int(year)