Пример #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
# la posición(x,y,z)
posicion = np.zeros((M, 3))
for i in range(9, 12):
    posicion[:, i - 9] = 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] = Bnorm
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

cruce = np.where(t == find_nearest_final(t, (t2 + t3) / 2))[0][0]
x = posicion[cruce, 0]
y = posicion[cruce, 1]
z = posicion[cruce, 2]

r = np.sqrt(x**2 + y**2 + z**2)
phi = np.arctan2(y, x)
theta = np.arccos(z / r)

longitude = phi / np.pi * 180
latitude = theta / np.pi * 180 - 90

if latitude < 0:
    print(f"latitude = {-latitude:.3g}ºN, longitude = {longitude:.3g}ºE")
else:
    print(f"latitude = {latitude:.3g}ºS, longitude = {longitude:.3g}ºE")
Пример #3
0
    MD[:, i] = posicion[:, i - 5] / 3390  #en radios marcianos
MD[:, 8] = np.linalg.norm(posicion, axis=1) - 3390  #altitud en km

#si quiero elegir entre ciertas horas:

# t1 = float(input("t1 = "))
# t2 = float(input("t2 = "))
# t3 = float(input("t3 = "))
# t4 = float(input("t4 = "))
t1 = 18.2167
t2 = 18.2204
t3 = 18.235
t4 = 18.2476

inicio = np.where(t == find_nearest_inicial(t, t2))[0][0]
fin = np.where(t == find_nearest_final(t, t3))[0][0]

t_1 = np.where(t == find_nearest(t, t1))[0][0]
t_2 = np.where(t == find_nearest(t, t2))[0][0]
t_3 = np.where(t == find_nearest(t, t3))[0][0]
t_4 = np.where(t == find_nearest(t, t4))[0][0]

#################

#ahora empieza el MVA con los datos que elegí
MD_cut = MD[inicio:fin + 1, :]
M_cut = np.size(MD_cut[:, 0])
B_cut = B[inicio:fin + 1, :]

M_ij = Mij(B_cut)
# np.savetxt('outs/matriz_%d'%dia[0], M_ij) #guarda la matriz de cada dia
Пример #4
0
posicion = np.zeros((M, 3))
for i in range(11, 14):
    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)  #la norma de B
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

inicio = np.where(t == find_nearest_inicial(t, t2))[0][0]
fin = np.where(t == find_nearest_final(t, t3))[0][0]

t_1 = np.where(t == find_nearest(t, t1))[0][0]
t_2 = np.where(t == find_nearest(t, t2))[0][0]
t_3 = np.where(t == find_nearest(t, t3))[0][0]
t_4 = np.where(t == find_nearest(t, t4))[0][0]

#################
#Filtramos los cantidad_datos
b, a = signal.butter(3, 0.01, btype='lowpass')
Bx_filtrado = signal.filtfilt(b, a, B[:, 0])
By_filtrado = signal.filtfilt(b, a, B[:, 1])
Bz_filtrado = signal.filtfilt(b, a, B[:, 2])
B_filtrado = np.linalg.norm(np.array([Bx_filtrado, By_filtrado, Bz_filtrado]),
                            axis=0)  #es el axis 0 porque no está traspuesta
Пример #5
0
angulo_B_mva = angulo(x3, B_medio_vectorial)
angulo_B_boot = angulo(normal_boot, B_medio_vectorial)

######
# Espesor de la MPB proyectado sobre las distintas normales

x_14_fit, x_23_fit = ancho_mpb(t1, t2, t3, t4, normal_ajuste, v_media)
x_14_MVA, x_23_MVA = ancho_mpb(t1, t2, t3, t4, x3, v_media)
x_14_boot, x_23_boot = ancho_mpb(t1, t2, t3, t4, normal_boot, v_media)

#########

# Análisis de corrientes

inicio_up = np.where(t == find_nearest_inicial(t, t1 - 0.015))[0][0]
fin_up = np.where(t == find_nearest_final(t, t1))[0][0]
B_upstream = np.mean(B[inicio_up:fin_up, :], axis=0)  # nT

inicio_down = np.where(t == find_nearest_inicial(t, t4))[0][0]
fin_down = np.where(t == find_nearest_final(t, t4 + 0.015))[0][0]
B_downstream = np.mean(B[inicio_down:fin_down, :], axis=0)  # nT

omega = angulo(B_upstream, B_downstream)

J_s_MVA, J_v_MVA = corrientes(x3, B_upstream, B_downstream, x_23_MVA)
J_s_fit, J_v_fit = corrientes(normal_ajuste, B_upstream, B_downstream,
                              x_23_fit)
J_s_boot, J_v_boot = corrientes(normal_boot, B_upstream, B_downstream,
                                x_23_boot)

fuerza_mva = np.cross(J_v_MVA * 1e-9, B[inicio_down, :] * 1e-9)  # N/m^3 #en t4
Пример #6
0
M = np.size(t)  #el numero de datos

#el campo
B = np.zeros((M, 3))
for i in [1, 2, 3]:
    B[:, i - 1] = datos[:, i]

MD = np.zeros((M, 5))
MD[:, 0] = t
for i in range(1, 4):
    MD[:, i] = B[:, i - 1]
MD[:, 4] = datos[:, -1]  #la norma de B

#si quiero elegir entre ciertas horas:
t1 = find_nearest_inicial(t, ti)
t2 = find_nearest_final(t, tf)
inicio = np.where(t == t1)[0][0]
fin = np.where(t == t2)[0][0]

t_1 = np.where(t == find_nearest(t, 18.2167))[0][0]
t_2 = np.where(t == find_nearest(t, 18.2204))[0][0]
t_3 = np.where(t == find_nearest(t, 18.235))[0][0]
t_4 = np.where(t == find_nearest(t, 18.2476))[0][0]

#################
#ahora empieza el MVA con los datos que elegí
MD_cut = MD[inicio:fin + 1, :]
M_cut = np.size(MD_cut[:, 0])
B_cut = B[inicio:fin + 1, :]

M_ij = Mij(B_cut)
Пример #7
0
        -1.0,
        1.0,
    )) * 180 / np.pi)

B_norm_medio = np.linalg.norm(B_medio_vectorial)

# hodograma(B1, B2, B3, 'nT', 'MAVEN MAG MVA ')

# el error
phi, delta_B3 = error(lamb, B_cut, len(B_cut), x)

###############
####fit
orbita = (
    posicion[np.where(t == find_nearest_inicial(t, t1 - 1))[0][0]:np.where(
        t == find_nearest_final(t, t4 + 1))[0][0], :, ] / 3390
)  # radios marcianos

t_nave = find_nearest(t, (t2 + t3) /
                      2)  # el tiempo en el medio de la hoja de corriente
index = np.where(t == t_nave)[0][0]
x0 = 0.78
e = 0.9
normal_fit, X1, Y1, Z1, R, L0 = ajuste_conico(posicion, index, orbita, x3)

B3_fit = np.dot(B_cut, normal_fit)

#############
##Bootstrap
N_boot = 1000
normal_boot, phi_boot, delta_B3_boot, out, out_phi = bootstrap(