<jupyter_start><jupyter_text>LS - процедура ко всему ряду<jupyter_code>foEsmean=np.nanmean(foEs)
nyquist=1
#freq, Y = LombScargle(time,foEs-foEsmean).autopower(nyquist_factor=nyquist)
# min and max frequensy in 1/day
min_freq=1./time[ntime-1]
max_freq=1.
freq, Y = LombScargle(time,foEs-foEsmean).autopower(minimum_frequency=min_freq,maximum_frequency=max_freq)
fig, ax = plt.subplots(2, 1)
ax[0].plot(time,foEs)
ax[0].set_xlabel('Time')
ax[0].set_ylabel('Amplitude')

ax[1].plot(freq,Y,'r') # plotting the spectrum

ax[1].set_xlabel('Freq (Hz)')
ax[1].set_ylabel('Y(freq)')
print(freq.min(),freq.max(),len(freq))
plt.xlim([2.,30.])
plt.plot(1./freq,Y,'r')
plt.xlabel('Period(day)')
plt.ylabel('Y')<jupyter_output><empty_output><jupyter_text>Готовим оконное преобразование<jupyter_code># window size in day
w_size=18.

dx=0.042 # step into win
# number of points in windows

w_num=int(w_size/dx)
# number of time's points
w_frec=len(time)-1
# возможны пропуски в данных, ищем их (вроде после удаленгия NaN не надо, но осталось)
bord=[]
i_st_end=np.zeros(2).astype(int)
jstart=0
jend=0
# search windows
for i in range(0,ntime-w_num-1): # цикл по всем точкам xt
   
    ix_start=i
    ix_end=i+w_num
    x_s=time[ix_start]
    x_e=time[ix_end]
    #print(i,x_s,x_e)
    #print(i_st_end)
    while(x_s > time[jstart]):
        jstart=jstart+1
        jend=jstart
        #print(jstart)
    while (x_e > time[jend]):
        jend=jend+1
        if(jend>w_frec):
            jend=w_frec
            break
         
        
    bord.append([jstart,jend])
w_spectr=len(bord)

minW_freq=1./w_size
maxW_freq=1./0.05
#freq0, Y = LombScargle(time[0:w_size],foEs[0:w_size]).autopower(nyquist_factor=0.1) 
freq0, Y = LombScargle(time[0:w_num],foEs[0:w_num]).autopower(minimum_frequency=minW_freq,maximum_frequency=maxW_freq)

i_df=len(freq0)
print(i_df,len(freq),len(bord))
m_LS=np.zeros(i_df*w_spectr).reshape(i_df,w_spectr)

# massive of spectrogramm
# window LS transform

i=0
for gran in bord:
    i_st=gran[0]
    i_en=gran[1]
    foEsmean=np.nanmean(foEs[i_st:i_en])
    
    #freq, m_LS[0:i_df,i] = LombScargle(time[i_st:i_en],foEs[i_st:i_en]).autopower(minimum_frequency=minW_freq,maximum_frequency=maxW_freq)
    #freq, S = LombScargle(time[i_st:i_en],foEs[i_st:i_en]).autopower(minimum_frequency=minW_freq,maximum_frequency=maxW_freq)
    #print(len(S),np.max(freq),np.min(freq))
    m_LS[0:i_df,i] = LombScargle(time[i_st:i_en],foEs[i_st:i_en]-foEsmean).power(freq0)
    #plt.plot(freq,S)
    i=i+1
        
print (np.shape(m_LS),np.shape(freq))         
        
print(len(time[:-w_num-1]),len(m_LS[0,:]),len(m_LS[:,0]),len(freq))
#lev=np.arange(8,16,2)
#lev=np.linspace(0.01,0.3,20)
plt.contourf(time[1:-w_num-1],1./freq0,m_LS[:,1:],levels=20,cmap=cm.rainbow)

plt.colorbar()
plt.savefig("LS_foEs"+str(w_size).format("6.2f")+".png")<jupyter_output>609 609 4247 600
{'fraction_non_alphanumeric': 0.17207678883071553, 'fraction_numerical': 0.030715532286212915, 'mean_word_length': 5.326710816777042, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '316854', 'license': 'MIT', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1358, 'n_words': 157, 'path': 'sources/wind_Es_astroPY.ipynb', 'repo_name': 'olgaborchevkina/ls_astropy_es', 'size': '2865'}