def plotnow_psd_all(fpath,yrmoday,chan,var,st_hour,st_minute,ed_hour,ed_minute,supply_index=False): flp=select_h5(fpath,yrmoday,st_hour,st_minute,ed_hour,ed_minute) fld=select_dat(fpath,yrmoday,st_hour,st_minute,ed_hour,ed_minute) i=0 while len(flp)<3: i+=1 flp=select_h5(fpath,yrmoday,st_hour,int(st_minute)-i,ed_hour,int(ed_minute)+i) #print('Number of h5:',len(flp)) #print('Initial h5:',flp[0][-11:][:5]) #print('Final h5:',flp[-1][-11:][:5]) #print('Number of dat:',len(fld)) #print('Initial dat:',fld[0][-12:][:4]) #print('Final dat:',fld[-1][-12:][:4]) pp=get_h5_pointing(flp) dd=get_demodulated_data_from_list(fld,supply_index=supply_index) combined=combine_cofe_h5_pointing(dd,pp) fs=30*256 for c in range(16): ch='ch%s' %str(c) #plt.psd(combined['sci_data'][ch][var]) freqs,pxx=nps(combined['sci_data'][ch][var],Fs=fs) ## plt.ylabel('Power Spectral Density ' + var +r'$^2$/Hz') ## plt.show() ## freqs,pxx=nps(combined['sci_data'][chan][var],fsreturn freqs,pxx plt.plot(freqs,pxx,label=ch) plt.legend(bbox_to_anchor=(1,1),loc=2,borderaxespad=0) plt.show() return freqs,pxx
def plotnow_psd(fpath,yrmoday,chan,var,st_hour,st_minute,ed_hour,ed_minute,supply_index=False): """ function to automatically read last 2 science files and last few pointing files, combine and plot signal vs azimuth. yrmoday should be a string '20130502' fpath should point to the spot where acq_tel and converter.py were run """ fs=30*256 flp=select_h5(fpath,yrmoday,st_hour,st_minute,ed_hour,ed_minute) fld=select_dat(fpath,yrmoday,st_hour,st_minute,ed_hour,ed_minute) i=0 while len(flp)<3: i+=1 flp=select_h5(fpath,yrmoday,st_hour,int(st_minute)-i,ed_hour,int(ed_minute)+i) #print('Number of h5:',len(flp)) #print('Initial h5:',flp[0][-11:][:5]) #print('Final h5:',flp[-1][-11:][:5]) #print('Number of dat:',len(fld)) #print('Initial dat:',fld[0][-12:][:4]) #print('Final dat:',fld[-1][-12:][:4]) pp=get_h5_pointing(flp) dd=get_demodulated_data_from_list(fld,supply_index=supply_index) combined=combine_cofe_h5_pointing(dd,pp) #plt.psd(combined['sci_data'][chan][var],Fs=fs) freqs,pxx=nps(combined['sci_data'][chan][var],Fs=fs) ## plt.ylabel('Power Spectral Density ' + var +r'$^2$/Hz') ## plt.show() ## freqs,pxx=nps(combined['sci_data'][chan][var],fsreturn freqs,pxx plt.plot(freqs,pxx,label=chan) plt.legend(bbox_to_anchor=(1,1),loc=2,borderaxespad=0) plt.show() return freqs,pxx
def plotnow_psd(fpath, yrmoday, chan, var, st_hour, st_minute, ed_hour, ed_minute, supply_index=False): """ function to automatically read last 2 science files and last few pointing files, combine and plot signal vs azimuth. yrmoday should be a string '20130502' fpath should point to the spot where acq_tel and converter.py were run """ fs = 30 flp = select_h5(fpath, yrmoday, st_hour, st_minute, ed_hour, ed_minute) fld_demod, fld = select_dat(fpath, yrmoday, st_hour, st_minute, ed_hour, ed_minute) i = 0 while len(flp) < 3: i += 1 flp = select_h5(fpath, yrmoday, st_hour, int(st_minute) - i, ed_hour, int(ed_minute) + i) pp = get_h5_pointing(flp) #dd=get_demodulated_data_from_list(fld,supply_index=supply_index) dd = get_all_demodulated_data(fld_demod, fld) combined = combine_cofe_h5_pointing(dd, pp) name = chantoname(chan) freqs, pxx = nps(combined['sci_data'][chan][var], Fs=fs) plt.plot(freqs, np.sqrt(pxx), label=name) plt.legend(bbox_to_anchor=(1, 1), loc=2, borderaxespad=0) plt.ylabel('V/$\sqrt{Hz}$') plt.xlabel('Hz') plt.yscale('log') #plt.xscale('log') plt.show() return freqs, pxx
def plotnow_psd_all(fpath, yrmoday, chan, var, st_hour, st_minute, ed_hour, ed_minute, supply_index=False): flp = select_h5(fpath, yrmoday, st_hour, st_minute, ed_hour, ed_minute) fld_demod, fld = select_dat(fpath, yrmoday, st_hour, st_minute, ed_hour, ed_minute) i = 0 while len(flp) < 3: i += 1 flp = select_h5(fpath, yrmoday, st_hour, int(st_minute) - i, ed_hour, int(ed_minute) + i) pp = get_h5_pointing(flp) #dd=get_demodulated_data_from_list(fld,supply_index=supply_index) dd = get_all_demodulated_data(fld_demod, fld) combined = combine_cofe_h5_pointing(dd, pp) fs = 30 for c in range(16): ch = 'ch%s' % str(c) name = chantoname(ch) #plt.psd(combined['sci_data'][ch][var]) freqs, pxx = nps(combined['sci_data'][ch][var], Fs=fs) plt.plot(freqs, np.sqrt(pxx), label=name) plt.ylabel('V/$\sqrt{Hz}$') plt.xlabel('Hz') plt.yscale('log') plt.xscale('log') plt.legend(bbox_to_anchor=(1, 1), loc=2, borderaxespad=0) plt.show() return freqs, pxx