Ejemplo n.º 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)
Ejemplo n.º 2
0
    corrientes,
    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)
Ejemplo n.º 3
0
#
# """ángulo entre el B de la magnetofunda y la corriente"""
# inicio_mf = donde(t, ti)
# fin_mf = donde(t, tf)
# j = [float(x) for x in input("Enter the normal in N.NN N.NN N.NN format\n").split()] #[-2.8, -19.2, -12.6]
# B_medio = np.mean(B, axis=0)
#
# ang = angulo(j, B_medio) * 180/np.pi
#
# print(f"El ángulo entre j y B magnetofunda es {ang}º")

# year, month, day, doy = 2016, "03", 16, 76
# ti_MVA, tf_MVA = UTC_to_hdec("18:13:33"), UTC_to_hdec("18:14:06")
# ti, tf = UTC_to_hdec("17:55:00"), UTC_to_hdec("18:30:00")

year, month, day, doy = fechas()  # 10-10-2015
ti_MVA, tf_MVA = 12.675, 12.68444
ti, tf = 12.4, 13

date_entry = f"{year}-{month}-{day}"

mag, t, B, posicion = importar_mag(year, month, day, ti_MVA, tf_MVA)
# ya los importa cortados a los datos, entonces no hace falta que haga el cut yo

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

# la matriz diaria:
MD = np.zeros((M, 9))
MD[:, 0] = t
for i in range(1, 4):
Ejemplo n.º 4
0
data = 'archivo_tradeview1.xlsx'

#--Esta función corresponde a la lectura del archivo. 
df_data = fn.f_leer_archivo(param_archivo=data)
#funcion para conocer el mulplicador PIPS
pips = fn.f_pip_size(param_ins='cornusd')
#Columna de tiempo
df_data = fn.f_columnas_tiempos(param_data=df_data)
#columna de pips
df_data = fn.f_columnas_pips(df_data)
#Cálculo del capital acumulado 
df_data = fn.f_capital_acum(df_data)
#Sesgo
df_data = fn.sesgo(df_data)
#Extraer mes y día de la fecha 
df_data =fn.fechas(df_data)


#Estadística básica
df_1_tabla=fn.f_estadisticas_ba(param_data=df_data)
#Ranking de operaciones 
df_1_ranking=fn.f_estadistica_ba2(param_data=df_data)
df_1_ranking = df_1_ranking.reset_index(drop=True) 

#Condicional para llamar las funciones de acuerdo al archivo que se desea analizar. 

if data == 'archivo_tradeview1.xlsx':
    #Cáluclo del Profit diario 
    df_profit_diario = fn.profitdiario(param_data=df_data)
    profit_sinsabado=fn.sinsabado(param_data=df_data)
    f_estadistica_mad = fn.f_estadistica_mad(param_data=df_profit_diario)