Ejemplo n.º 1
0
def plotatemp(vec, sessoes_sujeito):
    for i in range(len(sessoes_sujeito)):
        #intervalos de tempo da sessao
        x = vec[vec[:, 13] == sessoes_sujeito[i], 14]
        #fluxo de temperatura
        y1 = vec[vec[:, 13] == sessoes_sujeito[i], 3]
        y1norm = y1 / max(y1)
        y1norm_mavg = movavg(y1norm, 11)
        #temperatura proxima ao corpo
        y2 = vec[vec[:, 13] == sessoes_sujeito[i], 5]
        y2norm = y2 / max(y2)
        y2norm_mavg = movavg(y2norm, 3)
        #temperatura da pele
        y3 = vec[vec[:, 13] == sessoes_sujeito[i], 7]
        y3norm = y3 / max(y3)
        y3norm_mavg = movavg(y3norm, 3)

        figure(i + 1)
        #scatter(x,y1, c='r', marker = 'o')
        #scatter(x,y2, c='b', marker = 'o')
        #scatter(x,y3, c='g', marker = 'o')
        #scatter(x,y1norm, c='r', marker = 'o')
        #scatter(x,y2norm, c='b', marker = 'o')
        #scatter(x,y3norm, c='g', marker = 'o')
        #scatter(x,y2-y3, c='g', marker = 'o')
        scatter(x[5:-5], y1norm_mavg, c='r', marker='+')
        scatter(x[1:-1], y2norm_mavg - 0.2, c='b', marker='o')
        scatter(x[1:-1], y3norm_mavg, c='g', marker='o')
    show()
Ejemplo n.º 2
0
def plotaacelerom(vec, sessoes_sujeito):
    for i in range(len(sessoes_sujeito)):
        #intervalos de tempo da sessao
        x = vec[vec[:, 13] == sessoes_sujeito[i], 14]
        xtrim = x[5:-5]
        #pedometro
        y1 = vec[vec[:, 13] == sessoes_sujeito[i], 6]
        y1norm = y1 / max(y1)
        y1norm_mavg = movavg(y1norm, 11)
        # acelerometro 1
        y2 = vec[vec[:, 13] == sessoes_sujeito[i], 8]
        y2norm = y2 / max(y2)
        y2norm_mavg = movavg(y2norm, 11)
        # acelerometro 2
        y3 = vec[vec[:, 13] == sessoes_sujeito[i], 9]
        y3norm = y3 / max(y3)
        y3norm_mavg = movavg(y3norm, 11)
        # acelerometro 3
        y4 = vec[vec[:, 13] == sessoes_sujeito[i], 10]
        y4norm = y4 / max(y4)
        y4norm_mavg = movavg(y4norm, 11)
        # acelerometro 4
        y5 = vec[vec[:, 13] == sessoes_sujeito[i], 11]
        y5norm = y5 / max(y5)
        y5norm_mavg = movavg(y5norm, 11)

        figure(i + 1)
        #scatter(xtrim,y1norm_mavg, c='g', marker = 'o')
        scatter(xtrim, y2norm_mavg, c='r', marker='>')
        #scatter(xtrim,y3norm_mavg, c='r', marker = '<')
        scatter(xtrim, y4norm_mavg, c='b', marker='>')
        #scatter(xtrim,y5norm_mavg, c='b', marker = '<')
    show()
def plotaacelerom(vec, sessoes_sujeito):
    for i in range(len(sessoes_sujeito)):
        #intervalos de tempo da sessao
        x = vec[vec[:,13] == sessoes_sujeito[i],14]
        xtrim = x[5:-5]
        #pedometro
        y1 = vec[vec[:,13] == sessoes_sujeito[i],6]
        y1norm = y1/max(y1)
        y1norm_mavg = movavg(y1norm,11)        
        # acelerometro 1        
        y2 = vec[vec[:,13] == sessoes_sujeito[i],8]
        y2norm = y2/max(y2)        
        y2norm_mavg = movavg(y2norm,11)
        # acelerometro 2        
        y3 = vec[vec[:,13] == sessoes_sujeito[i],9]
        y3norm = y3/max(y3)        
        y3norm_mavg = movavg(y3norm,11)
        # acelerometro 3        
        y4 = vec[vec[:,13] == sessoes_sujeito[i],10]
        y4norm = y4/max(y4)        
        y4norm_mavg = movavg(y4norm,11)
        # acelerometro 4        
        y5 = vec[vec[:,13] == sessoes_sujeito[i],11]
        y5norm = y5/max(y5)        
        y5norm_mavg = movavg(y5norm,11)
        
        figure(i+1)
        #scatter(xtrim,y1norm_mavg, c='g', marker = 'o')
        scatter(xtrim,y2norm_mavg, c='r', marker = '>')
        #scatter(xtrim,y3norm_mavg, c='r', marker = '<')
        scatter(xtrim,y4norm_mavg, c='b', marker = '>')
        #scatter(xtrim,y5norm_mavg, c='b', marker = '<')
    show()
def plotatemp(vec, sessoes_sujeito):
    for i in range(len(sessoes_sujeito)):
        #intervalos de tempo da sessao
        x = vec[vec[:,13] == sessoes_sujeito[i],14]
        #fluxo de temperatura
        y1 = vec[vec[:,13] == sessoes_sujeito[i],3]
        y1norm = y1/max(y1)
        y1norm_mavg = movavg(y1norm,11)        
        #temperatura proxima ao corpo
        y2 = vec[vec[:,13] == sessoes_sujeito[i],5]
        y2norm = y2/max(y2)        
        y2norm_mavg = movavg(y2norm,3)
        #temperatura da pele
        y3 = vec[vec[:,13] == sessoes_sujeito[i],7]
        y3norm = y3/max(y3)        
        y3norm_mavg = movavg(y3norm,3)

        figure(i+1)        
        #scatter(x,y1, c='r', marker = 'o')
        #scatter(x,y2, c='b', marker = 'o')
        #scatter(x,y3, c='g', marker = 'o')
        #scatter(x,y1norm, c='r', marker = 'o')
        #scatter(x,y2norm, c='b', marker = 'o')
        #scatter(x,y3norm, c='g', marker = 'o')
        #scatter(x,y2-y3, c='g', marker = 'o')
        scatter(x[5:-5],y1norm_mavg, c='r', marker = '+')
        scatter(x[1:-1],y2norm_mavg-0.2, c='b', marker = 'o')
        scatter(x[1:-1],y3norm_mavg, c='g', marker = 'o')
    show()
Ejemplo n.º 5
0
We can use argsort to order an array by one of its columns (or rows)
http://docs.scipy.org/doc/numpy-1.5.x/reference/generated/numpy.argsort.html"""
ord_cot = cotacoes[cotacoes[:, 0].argsort(), :]

"""We can see there is a great scale change... 
maybe it's a good idea to treat as two separate series"""
cot_after = cotacoes[0:3555, :]
figure(2)
title("Bovespa Trunked Series")
plot(cot_after[:, 0], cot_after[:, 1])

"""Applying smoothing, as before,
with windows varying its size:"""
figure(3)
title("Bovespa - one week smoothing")
plot(cot_after[5:-5, 0], movavg(cot_after[:, 1], 11))
figure(4)
title("Bovespa - one month smoothing")
plot(cot_after[10:-10, 0], movavg(cot_after[:, 1], 21))
figure(5)
title("Bovespa - six months smoothing")
plot(cot_after[60:-60, 0], movavg(cot_after[:, 1], 121))

"""
Smoothing with a gaussian filter
1) Building a gaussian filter with 31 points and standard deviation of 4
http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.gaussian.html
2) Normalizing the filter dividing by the sum of the elements
3) Convoluting the serie with the filter
4) Comparing the series (original, moving averages and Gaussian smoothed)
"""
Ejemplo n.º 6
0
title('Bovespa Historical Series')
'''And what if the dates were not ordered?
We can use argsort to order an array by one of its columns (or rows)
http://docs.scipy.org/doc/numpy-1.5.x/reference/generated/numpy.argsort.html'''
ord_cot = cotacoes[cotacoes[:, 0].argsort(), :]
'''We can see there is a great scale change... 
maybe it's a good idea to treat as two separate series'''
cot_after = cotacoes[0:3555, :]
figure(2)
title('Bovespa Trunked Series')
plot(cot_after[:, 0], cot_after[:, 1])
'''Applying smoothing, as before,
with windows varying its size:'''
figure(3)
title('Bovespa - one week smoothing')
plot(cot_after[5:-5, 0], movavg(cot_after[:, 1], 11))
figure(4)
title('Bovespa - one month smoothing')
plot(cot_after[10:-10, 0], movavg(cot_after[:, 1], 21))
figure(5)
title('Bovespa - six months smoothing')
plot(cot_after[60:-60, 0], movavg(cot_after[:, 1], 121))
'''
Smoothing with a gaussian filter
1) Building a gaussian filter with 31 points and standard deviation of 4
http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.gaussian.html
2) Normalizing the filter dividing by the sum of the elements
3) Convoluting the serie with the filter
4) Comparing the series (original, moving averages and Gaussian smoothed)
'''
Ejemplo n.º 7
0
pl.subplots_adjust(wspace=0.001,hspace=0.4)

# ephemeris
T0 = 2453964.3307097
P = 0.1545255

# make all the plots
for line,color,marker,n in zip([r'$H_{\alpha}$',r'$H_{\beta}$',r'$He_{II}$ '],['r','g','b'],['.','x','+'],[1,2,3]):
    # plot the lightcurves
    pl.subplot(211)
    X = pl.load(Lines[line])
    x = X[:,0]
    p = (x-T0)/P
    ew = X[:,1]
    pl.plot(p,X[:,1],'%s%s'%(color,marker),label=line)
    p_ave = pl.movavg(p,40)
    ew_ave = pl.movavg(ew,40)
    pl.plot(p_ave,ew_ave,'%s-'%color)
    pl.ylim(-55,5)
    pl.legend(loc='lower left')
    pl.grid()

    # plot periodograms
    pl.subplot('23%s'%(n+3))
    if n ==1:
        pl.ylabel('Amplitude')
    if n == 2:
        pl.xlabel('Frequency (c/d)')


    # calculate periodograms