dt = 12.0 nt = 300 np.random.seed(seed=1) model_param = [10.0, 1.77, -100.0] pls1 = SimplePowerLawSpectrumWithConstantBackground(model_param, nt=nt, dt=dt) data = TimeSeriesFromPowerSpectrum(pls1).sample t = dt * np.arange(0, nt) amplitude = 0.0 data = data + amplitude * (data.max() - data.min()) * np.sin(2 * np.pi * t / 300.0) # Create a time series object ts = TimeSeries(t, data) ts.label = 'emission' ts.units = 'arb. units' ts.name = 'simulated data [n=%4.2f]' % (model_param[1]) # Get the normalized power and the positive frequencies iobs = ts.PowerSpectrum.ppower this = ([ts.PowerSpectrum.frequencies.positive, iobs],) # _____________________________________________________________________________ # ----------------------------------------------------------------------------- # Wavelet transform using a white noise background # ----------------------------------------------------------------------------- var = ts.data # Range of periods to average avg1, avg2 = (150.0, 400.0) # Significance level
print('Loading data from ' + directory) dc = get_datacube(directory) ny = dc.shape[0] nx = dc.shape[1] nt = dc.shape[2] # Create a time series object dt = 12.0 t = dt * np.arange(0, nt) tsdummy = TimeSeries(t, t) iobs = np.zeros(tsdummy.PowerSpectrum.Npower.shape) # Result # 1 - add up all the emission and do the analysis on the full FOV full_ts = np.zeros((nt)) for i in range(0, nx): for j in range(0, ny): d = dc[j, i, :].flatten() # Fix the data for any non-finite entries d = tsutils.fix_nonfinite(d) d = d - np.mean(d) d = d / np.std(d) ts = TimeSeries(t, d) iobs = iobs + ts.PowerSpectrum.Npower iobs = iobs / (1.0 * nx * ny) ts.label = 'emission (AIA ' + wave + ')' ts.units = 'counts' # Get the normalized power and the positive frequencies iobs = ts.PowerSpectrum.Npower this = ([ts.PowerSpectrum.frequencies.positive, iobs],)
tsoriginal = TimeSeries(t, data) plt.figure(10) tsoriginal.peek() meandata = np.mean(data) # relative data = (data - meandata) / meandata #data = data - smooth(data, window_len=84) # Create a time series object ts = TimeSeries(t, data) ts.label = 'emission' ts.units = 'arb. units' ts.name = 'simulated data [n=%4.2f]' % (model_param[1]) # Get the normalized power and the positive frequencies iobs = ts.PowerSpectrum.ppower this = ([ts.PowerSpectrum.frequencies.positive, iobs],) # _____________________________________________________________________________ # ----------------------------------------------------------------------------- # Wavelet transform using a white noise background # ----------------------------------------------------------------------------- var = ts.data # Range of periods to average avg1, avg2 = (150.0, 400.0) # Significance level