当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.peek_ps方法代码示例

本文整理汇总了Python中timeseries.TimeSeries.peek_ps方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.peek_ps方法的具体用法?Python TimeSeries.peek_ps怎么用?Python TimeSeries.peek_ps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timeseries.TimeSeries的用法示例。


在下文中一共展示了TimeSeries.peek_ps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import peek_ps [as 别名]
"""
plt.figure(1)
ts1.peek_ps()
ts2.peek_ps()

plt.figure(2)
plt.plot(ts1.pfreq, transfer_function12)

plt.figure(3)
plt.plot(ts1.pfreq, ts2.PowerSpectrum.ppower / ts1.PowerSpectrum.ppower)
"""
index3 = dt * (np.arange(0, 2 * window + 1) - window)
weight3 = np.zeros_like(index3) - w1
weight3[index3 == 0] = 1.0 - w1
angfreq = 2 * np.pi * ts1.pfreq

transfer_function13 = tsutils.transfer_function(index3, weight3, angfreq)

plt.figure(4)
plt.plot(1000 * ts1.pfreq, ts3.PowerSpectrum.ppower / ts1.PowerSpectrum.ppower, label='observed transfer function')
plt.plot(1000 * ts1.pfreq, transfer_function13, label='theoretical transfer function')
plt.axvline(3.333, label='300 s oscillation', color='k')
plt.xlabel('frequency (mHz)')
plt.ylabel('emission (arbitrary units)')
plt.legend()

plt.figure(6)
ts1.peek_ps()
ts3.peek_ps()

开发者ID:wafels,项目名称:rednoise,代码行数:31,代码来源:test_transfer_function.py

示例2: do_lstsqr

# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import peek_ps [as 别名]

#.........这里部分代码省略.........
                for f in findex:
                    plt.plot(h[1][1:] / np.log(10.0), hpwr[f, :], label='%7.5f Hz' % (freqs[f]))
                plt.legend(loc=3, fontsize=10)
                plt.savefig(savefig + '.power_spectra_distributions.png')

                # plot out the time series
                plt.figure(4)
                full_ts.peek()
                plt.savefig(savefig + '.full_ts_timeseries.png')
                plt.close('all')

                ###############################################################
                # Time series plots
                # Plot all the analyzed time series
                plt.figure(10)
                for i in range(0, nx):
                    for j in range(0, ny):
                        plt.plot(t, dc_analysed[j, i, :])
                plt.xlabel('time (seconds)')
                plt.ylabel('analyzed emission ' + tsdetails)
                plt.title(data_name)
                plt.ylim(dc_analysed_minmax)
                plt.xlim((t[0], t[-1]))
                plt.savefig(savefig + '.all_analyzed_ts.png')

                # Plot a histogram of the studied data at each time
                bins = 50
                hist_dc_analysed = np.zeros((bins, nt))
                for this_time in range(0, nt):
                    hist_dc_analysed[:, this_time], bin_edges = np.histogram(dc_analysed[:, :, this_time], bins=bins, range=dc_analysed_minmax)
                hist_dc_analysed = hist_dc_analysed / (1.0 * nx * ny)
                plt.figure(12)
                plt.xlabel('time (seconds)')
                plt.ylabel('analyzed emission ' + tsdetails)
                plt.imshow(hist_dc_analysed, aspect='auto', origin='lower',
                           extent=(t[0], t[-1], dc_analysed_minmax[0], dc_analysed_minmax[1]))
                plt.colorbar()
                plt.title(data_name)
                plt.savefig(savefig + '.all_analyzed_ts_histogram.png')

                ###############################################################
                # Fourier power plots
                # Plot all the analyzed FFTs
                plt.figure(11)
                for i in range(0, nx):
                    for j in range(0, ny):
                        ts = TimeSeries(t, dc_analysed[j, i, :])
                        ts.peek_ps()
                plt.loglog()
                plt.axvline(five_min, color='k', linestyle='-.', label='5 mins.')
                plt.axvline(three_min, color='k', linestyle='--', label='3 mins.')
                plt.xlabel('frequency (Hz)')
                plt.ylabel('FFT power ' + tsdetails)
                plt.title(data_name)
                plt.savefig(savefig + '.all_analyzed_fft.png')

                # Plot a histogram of the studied FFTs at each time
                bins = 50
                minmax = [np.min(logpwr), np.max(logpwr)]
                hist_dc_analysed_logpwr = np.zeros((bins, nposfreq))
                for this_freq in range(0, nposfreq):
                    hist_dc_analysed_logpwr[:, this_freq], bin_edges = np.histogram(logpwr[:, :, this_freq], bins=bins, range=minmax)
                hist_dc_analysed_logpwr = hist_dc_analysed_logpwr / (1.0 * nx * ny)
                plt.figure(13)
                plt.xlabel('frequency (Hz)')
                plt.ylabel('FFT power ' + tsdetails)
                plt.imshow(hist_dc_analysed_logpwr, aspect='auto', origin='lower',
                           extent=(freqs[0], freqs[-1], np.exp(minmax[0]), np.exp(minmax[1])))
                plt.semilogy()
                plt.colorbar()
                plt.title(data_name)
                plt.savefig(savefig + '.all_analyzed_fft_histogram.png')

                ###############################################################
                # Save various data products
                # Fourier Power of the analyzed data
                ofilename = region_id
                pkl_write(pkl_location,
                          'OUT.' + ofilename + '.fourier_power.pickle',
                          (freqs, pwr))

                # Analyzed data
                pkl_write(pkl_location,
                          'OUT.' + ofilename + '.dc_analysed.pickle',
                          (t, dc_analysed))

                # Fourier transform
                pkl_write(pkl_location,
                          'OUT.' + ofilename + '.fft_transform.pickle',
                          (freqs, fft_transform))

                # Save the full time series to a CSV file
                csv_timeseries_write(os.path.join(os.path.expanduser(scsv), window, manip),
                                     '.'.join((data_name, 'average_analyzed_ts.csv')),
                                     (t, full_data))

                # Original data
                csv_timeseries_write(os.path.join(os.path.expanduser(scsv)),
                                     '.'.join((ident, 'average_original_ts.csv')),
                                     (t, doriginal))
开发者ID:wafels,项目名称:rednoise,代码行数:104,代码来源:aia_lstsqr3.py

示例3: range

# 需要导入模块: from timeseries import TimeSeries [as 别名]
# 或者: from timeseries.TimeSeries import peek_ps [as 别名]
dt = 12.0
nt = 300

data = np.zeros(nt)

alpha = 0.0001

data[0] = 1.0
for i in range(0, nt - 1):
    data[i+1] = data[i] + alpha*np.random.normal()


ts = TimeSeries(dt * np.arange(0, nt), data)

plt.figure(1)
ts.peek_ps()
plt.loglog()


plt.figure(2)
ts.peek()

this = ([ts.pfreq, ts.ppower],)

norm_estimate = np.zeros((3,))
norm_estimate[0] = ts.ppower[0]
norm_estimate[1] = norm_estimate[0] / 1000.0
norm_estimate[2] = norm_estimate[0] * 1000.0

background_estimate = np.zeros_like(norm_estimate)
background_estimate[0] = np.mean(ts.ppower[-10:-1])
开发者ID:wafels,项目名称:rednoise,代码行数:33,代码来源:test_ar.py


注:本文中的timeseries.TimeSeries.peek_ps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。