import matplotlib.pyplot as plt plt.style.use("ggplot") from mtspec import mtspec, sine_psd from mtspec.util import _load_mtdata data = _load_mtdata('PASC.dat.gz') plt.subplot(311) plt.plot(data, color='black') plt.xlim(0, len(data)) spec, freq = mtspec(data, 1.0, 1.5, number_of_tapers=1) plt.subplot(323) plt.loglog(freq, spec, color='black') plt.xlim(freq[0], freq[-1]) plt.text(x=0.5, y=0.85, s="Single Taper", transform=plt.gca().transAxes, ha="center") spec, freq = mtspec(data, 1.0, 4.5, number_of_tapers=5) plt.subplot(324) plt.loglog(freq, spec, color='black') plt.xlim(freq[0], freq[-1]) plt.text(x=0.5, y=0.85, s="5 Tapers Multitaper", transform=plt.gca().transAxes, ha="center") spec, freq = sine_psd(data, 1.0) plt.subplot(325)
import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = _load_mtdata("v22_174_series.dat.gz") spec, freq, jackknife, fstatistics, _ = mtspec(data=data, delta=4930., time_bandwidth=3.5, number_of_tapers=5, nfft=312, statistics=True, rshape=0, fcrit=0.9) # Convert to million years. freq *= 1E6 plt.subplot(211) plt.plot(freq, fstatistics, color="black") plt.xlim(freq[0], freq[-1]) plt.xlabel("Frequency [c Ma$^{-1}]$") plt.ylabel("F-statistics for periodic lines") # Plot the confidence intervals. for p in [90, 95, 99]: y = np.percentile(fstatistics, p)
import matplotlib.pyplot as plt import numpy as np import scipy.fftpack from mtspec import mt_deconvolve, mtspec from mtspec.util import _load_mtdata plt.style.use("ggplot") # Load and demean data. pasc = _load_mtdata('PASC.dat.gz') ado = _load_mtdata('ADO.dat.gz') pasc -= pasc.mean() ado -= ado.mean() r = mt_deconvolve(pasc, ado, delta=1.0, time_bandwidth=4.0, number_of_tapers=7, nfft=len(pasc), demean=True, weights="adaptive") deconvolved = r["deconvolved"] Pdeconv = deconvolved[-500:][::-1] Pdeconv /= Pdeconv.max() nfft = 2 * len(pasc) pasc = scipy.fftpack.fft(pasc, n=nfft) ado = scipy.fftpack.fft(ado, n=nfft) cc = pasc * ado.conj()
import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = _load_mtdata('v22_174_series.dat.gz') # Calculate the spectral estimation. spec, freq, jackknife, _, _ = mtspec( data=data, delta=4930.0, time_bandwidth=3.5, number_of_tapers=5, nfft=312, statistics=True) fig = plt.figure() ax1 = fig.add_subplot(2, 1, 1) # Plot in thousands of years. ax1.plot(np.arange(len(data)) * 4.930, data, color='black') ax1.set_xlim(0, 800) ax1.set_ylim(-1.0, 1.0) ax1.set_xlabel("Time [1000 years]") ax1.set_ylabel("Change in $\delta^{18}O$") ax2 = fig.add_subplot(2, 1, 2) ax2.set_yscale('log') # Convert frequency to Ma. freq *= 1E6 ax2.plot(freq, spec, color='black') ax2.fill_between(freq, jackknife[:, 0], jackknife[:, 1], color="red", alpha=0.3)
import matplotlib.pyplot as plt import numpy as np import scipy.fftpack from mtspec import mt_deconvolve, mtspec from mtspec.util import _load_mtdata plt.style.use("ggplot") # Load and demean data. pasc = _load_mtdata('PASC.dat.gz') ado = _load_mtdata('ADO.dat.gz') pasc -= pasc.mean() ado -= ado.mean() r = mt_deconvolve(pasc, ado, delta=1.0, time_bandwidth=4.0, number_of_tapers=7, nfft=len(pasc), demean=True, weights="adaptive") deconvolved = r["deconvolved"] Pdeconv = deconvolved[-500:][::-1] Pdeconv /= Pdeconv.max() nfft = 2 * len(pasc) pasc = scipy.fftpack.fft(pasc, n=nfft)
import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = _load_mtdata("v22_174_series.dat.gz") spec, freq, jackknife, fstatistics, _ = mtspec( data=data, delta=4930., time_bandwidth=3.5, number_of_tapers=5, nfft=312, statistics=True, rshape=0, fcrit=0.9) # Convert to million years. freq *= 1E6 plt.subplot(211) plt.plot(freq, fstatistics, color="black") plt.xlim(freq[0], freq[-1]) plt.xlabel("Frequency [c Ma$^{-1}]$") plt.ylabel("F-statistics for periodic lines") # Plot the confidence intervals. for p in [90, 95, 99]: y = np.percentile(fstatistics, p) plt.hlines(y, freq[0], freq[-1], linestyles="--", color="0.2") plt.text(x=99, y=y + 0.2, s="%i %%" % p, ha="right") plt.subplot(212) plt.semilogy(freq, spec, color="black") plt.xlim(freq[0], freq[-1])
import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = _load_mtdata('v22_174_series.dat.gz') # Calculate the spectral estimation. spec, freq, jackknife, _, _ = mtspec(data=data, delta=4930.0, time_bandwidth=3.5, number_of_tapers=5, nfft=312, statistics=True) fig = plt.figure() ax1 = fig.add_subplot(2, 1, 1) # Plot in thousands of years. ax1.plot(np.arange(len(data)) * 4.930, data, color='black') ax1.set_xlim(0, 800) ax1.set_ylim(-1.0, 1.0) ax1.set_xlabel("Time [1000 years]") ax1.set_ylabel("Change in $\delta^{18}O$") ax2 = fig.add_subplot(2, 1, 2) ax2.set_yscale('log') # Convert frequency to Ma.