In [20]:
from __future__ import print_function, division
import glob
from pykdf.kdf import load_kdf
import pandas as pd
import numpy as np
from scipy.signal import welch
from scipy.stats import spearmanr
from bw.util import fit_gaussian
import matplotlib.pyplot as plt
%matplotlib inline
History of spectral analysis. Power useful.
Recent work in systems, cognitive, neuoscience and computational neuroscience suggest power in an oscillatory band is an insuffucient characterization. Variations in peak width carry relevant information about both the biological and cognitive state of the system. However while these preliminary results suggest peak width may be an important variable, there are variety of potential mechanisms by which peak width can change, and no way to identify which mechanism(s) are present in the a given dataset. In this computational study we compare five alternative senarios by which peak width could vary, identifying situations in which one may be clearly and qualitativly identified from the rest.
Coupled - slow, fast
Mixed f, fixed drive Drive ramp, single f N Burst Var of slide
In [2]:
# %run make ie kur
In [87]:
files = glob.glob("../data/drivie1/*.hdf5")
# -
ps = []
fits = []
psds = []
powers = []
widths = []
centers = []
for fi in files:
res = load_kdf(fi)
t = res['t']
dt = res['dt']
times = np.linspace(0, t, t * int(1 / float(dt)))
lfp = res['lfp']
# -
# Get PSD and peak properties.
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 20)
fs = fs[m]
psd = psd[m]
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-2)
# -
fits.append(fit)
psds.append(psd)
powers.append(power)
widths.append(2.355 * width)
centers.append(center)
ps.append([res['P']] * len(center))
ps = np.concatenate(ps)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# -
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ps, psds, fits):
plt.plot(fs, psd, linewidth=1.5 * p, color='k', alpha=.3)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
# plt.plot(ps, centers, '.k')
plt.plot(powers, ps, '.k', alpha=0.6)
plt.ylabel("Stimulus (AU)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, .3)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
# plt.plot(ps, centers, '.k')
plt.plot(centers, ps, '.k', alpha=0.6)
plt.ylabel("Stimulus (AU)")
plt.xlabel("Peak centers (Hz)")
# plt.ylim(0, .3)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
# plt.plot(ps, centers, '.k')
plt.plot(widths, ps, '.k', alpha=0.6)
plt.ylabel("Stimulus (AU)")
plt.xlabel("Peak width (Hz)")
# plt.ylim(0, .3)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k')
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
# plt.xlim(0, .3)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k')
plt.ylabel("Peak center (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, .3)
plt.savefig("../figs/drivie1.pdf")
print(len(fits), " peaks found.")
print("corr(Drive, widths)", spearmanr(ps, widths))
print("corr(Drive, centers)", spearmanr(ps, centers))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
Figure X. The relationship between peak width, power, and stimulation strength for a single fast oscillating population. As the stimulus strength increases both the frequency of oscillation and and peak power increase, in a roughly linear manner. Peak width is however uneffect. a. Power spectrum of the simulated LFP. Darker lines represent stronger stimuluation. b. Center frequency as a function of stimulation strength. c. Peak power as a function of oscillatory frequency. d. Peak width as a funciton of oscillatory frequency.
In [88]:
path = "/home/ejp/src/bw/data/mixie_n/"
n_sim = [3, 5, 7, 9, 10, 12, 14, 16, 18, 20]
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + 'n{}_run*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
n = res['N']
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-3)
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(2.355 * width)
centers.append(center)
ns.append([n] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# -
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.1)
plt.xlabel("Peak power (Hz)")
plt.ylabel("Pop size (N)")
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.1)
plt.xlabel("Peak center (Hz)")
plt.ylabel("Pop size (N)")
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Pop size (N)")
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.semilogy()
# plt.ylim(0, 1)
# plt.xlim(0, 1)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.1)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, .5)
plt.savefig("../figs/mixie_n.pdf")
# -
print(len(fits), " peaks found.")
print("corr(N pop, centers)", spearmanr(ns, centers))
print("corr(N pop, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
Figure X. Oscillatory properties as a function of number of independent oscillators.
In [89]:
path = "/home/ejp/src/bw/data/mixie_s/"
n_sim = ['0.5', '0.7', '0.9', '1.1', '1.3', '1.5', '1.7', '1.9', '2.0']
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + 's{}_run*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-4)
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(width)
centers.append(center)
ns.append([float(n)] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# -
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.1)
plt.ylabel("Pop drive SD (AU)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.1)
plt.ylabel("Pop drive SD (AU)")
plt.xlabel("Peak center (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.1)
plt.ylabel("Pop drive SD (AU)")
plt.xlabel("Peak width (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
# plt.xlim(0, 1)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.1)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, 2)
plt.savefig("../figs/mixie_s.pdf")
# -
print(len(fits), " peaks found.")
print("corr(Drive SD, centers)", spearmanr(ns, centers))
print("corr(Drive SD, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
In [90]:
path = "/home/ejp/src/bw/data/burstie1/"
n_sim = [0, ]
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + '*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
w = res['w']
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-2)
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(width)
centers.append(center)
ns.append([w] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# ----------------------------------------------------------------------
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.3)
plt.ylabel("Burst length (s)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.3)
plt.ylabel("Burst length (s)")
plt.xlabel("Peak center (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.3)
plt.ylabel("Burst length (s)")
plt.xlabel("Peak width (Hz)")
# plt.ylim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.3)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
# plt.xlim(0, 1)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.3)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, 2)
plt.savefig("../figs/burstie1.pdf")
# -
print(len(fits), " peaks found.")
print("corr(burst L, centers)", spearmanr(ns, centers))
print("corr(burst L, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
In [92]:
import sys
path = "/home/ejp/src/bw/data/driftie_d/"
n_sim = ['0.01', '0.03', '0.05', '0.07', '.1', '.2', '.3']
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + 'd{}_run*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
try:
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-3)
except:
print("Lin alg error on {}".format(sys.exc_info()[0]))
continue
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(width)
centers.append(center)
ns.append([float(n)] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# -------------------------------------------------------------------------
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(powers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Drift SD (AU)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(centers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Drift SD (AU)")
plt.xlabel("Peak center (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(widths[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Drift SD (AU)")
plt.xlabel("Peak width (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
# plt.xlim(0, 1)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.1)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, 2)
plt.savefig("../figs/driftie_d.pdf")
# -
print(len(fits), " peaks found.")
print("corr(drift, centers)", spearmanr(ns, centers))
print("corr(drift, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
In [93]:
import sys
path = "/home/ejp/src/bw/data/kur_k/"
n_sim = ['1', '3', '6', '9', '12']
# ----------------------------------------------------------------------
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + 'k{}_run*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
try:
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-2)
except:
print("Lin alg error on {}".format(sys.exc_info()[0]))
continue
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(width)
centers.append(center)
ns.append([float(n)] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# ----------------------------------------------------------------------
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(powers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Coupling strength (AU)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(centers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Coupling strength (AU)")
plt.xlabel("Peak center (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(widths[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Coupling strength (AU)")
plt.xlabel("Peak width (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
plt.xlim(0, 2)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.1)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
plt.xlim(0, 2)
plt.savefig("../figs/kur_k.pdf")
# -
print(len(fits), " peaks found.")
print("corr(K, centers)", spearmanr(ns, centers))
print("corr(K, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
In [94]:
import sys
path = "/home/ejp/src/bw/data/kur_r/"
n_sim = ['1', '3', '5', '7', '9']
# ----------------------------------------------------------------------
ns = []
psds = []
powers = []
widths = []
centers = []
fits = []
for n in n_sim:
files = glob.glob(path + 'r{}_run*.hdf5'.format(n))
for fi in files:
res = None
res = load_kdf(fi)
lfp = res['lfp']
dt = res['dt']
fs, psd = welch(lfp, int(1 / dt), scaling='density', nperseg=3000)
m = np.logical_and(fs < 40, fs > 15)
fs = fs[m]
psd = psd[m]
try:
center, power, width, fit = fit_gaussian(fs, psd, 20, mph=1e-2)
except:
print("Lin alg error on {}".format(sys.exc_info()[0]))
continue
psds.append(psd)
fits.append(fit)
powers.append(power)
widths.append(width)
centers.append(center)
ns.append([float(n)] * center.size)
ns = np.concatenate(ns)
centers = np.concatenate(centers)
powers = np.concatenate(powers)
widths = np.concatenate(widths)
# ----------------------------------------------------------------------
plt.figure(figsize=(5, 18))
n_plot = 6
n = 1
plt.subplot(n_plot, 1, n)
for p, psd, fit in zip(ns, psds, fits):
plt.plot(fs, psd, color='k', alpha=.6)
plt.plot(fs, fit, linestyle='--', color='blue', alpha=.6)
plt.legend(loc='bottom', ncol=10)
plt.xlabel("Freq. (Hz)")
plt.ylabel("Power (AU)")
plt.tight_layout()
# plt.ylim(1e-4, 1)
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(powers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(powers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Theta SD (Hz)")
plt.xlabel("Peak power (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(centers, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(centers[m]), n0, '.r', alpha=0.9, lw=10)
plt.ylabel("Theta SD (Hz)")
plt.xlabel("Peak center (Hz)")
# plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, ns, '.k', alpha=0.1)
for n0 in n_sim:
m = n0 == ns
plt.plot(np.nanmedian(widths[m]), n0, '.r', alpha=0.9, lw=10)
plt.xlabel("Theta SD (Hz)")
plt.ylabel("Peak width (Hz)")
plt.ylim(0, 5)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, powers, '.k', alpha=0.1)
plt.xlabel("Peak width (Hz)")
plt.ylabel("Peak power (AU)")
# plt.ylim(0, 1)
# plt.xlim(0, 1)
plt.tight_layout()
n += 1
plt.subplot(n_plot, 1, n)
plt.plot(widths, centers, '.k', alpha=0.1)
plt.ylabel("Osc. freq (Hz)")
plt.xlabel("Peak width (Hz)")
plt.tight_layout()
# plt.ylim(20, 40)
# plt.xlim(0, 2)
plt.savefig("../figs/kur_r.pdf")
# -
print(len(fits), " peaks found.")
print("corr(R, centers)", spearmanr(ns, centers))
print("corr(R, widths)", spearmanr(ns, widths))
print("corr(widths, powers)", spearmanr(widths, powers))
print("corr(widths, centers)", spearmanr(widths, centers))
In [ ]: