diff --git a/modelsusceptcontrasts.py b/modelsusceptcontrasts.py index 78d7f0c..cddeea5 100644 --- a/modelsusceptcontrasts.py +++ b/modelsusceptcontrasts.py @@ -34,7 +34,8 @@ def plot_chi2(ax, s, data_file, rate): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - chi2 = np.abs(data['prss'])*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) ax.set_visible(True) ax.set_aspect('equal') i0 = np.argmin(freqs < -fcutoff) diff --git a/modelsusceptlown.py b/modelsusceptlown.py index 9fdb121..a3289f7 100644 --- a/modelsusceptlown.py +++ b/modelsusceptlown.py @@ -31,7 +31,8 @@ def plot_chi2(ax, s, data_file, rate): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - chi2 = np.abs(data['prss'])*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) ax.set_visible(True) ax.set_aspect('equal') i0 = np.argmin(freqs < -fcutoff) diff --git a/modelsusceptovern.py b/modelsusceptovern.py index aeaae02..d79c916 100644 --- a/modelsusceptovern.py +++ b/modelsusceptovern.py @@ -26,8 +26,8 @@ def plot_chi2(ax, s, data_file): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - dt_fix = 1 # 0.0005 - prss = np.abs(data['prss'])/dt_fix*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)/0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) ax.set_visible(True) ax.set_aspect('equal') i0 = np.argmin(freqs < -300) @@ -36,8 +36,8 @@ def plot_chi2(ax, s, data_file): if i1 == 0: i1 = len(freqs) freqs = freqs[i0:i1] - prss = prss[i0:i1, i0:i1] - vmax = np.quantile(prss, 0.996) + chi2 = chi2[i0:i1, i0:i1] + vmax = np.quantile(chi2, 0.996) ten = 10**np.floor(np.log10(vmax)) for fac, delta in zip([1, 2, 3, 4, 6, 8, 10], [0.5, 1, 1, 2, 3, 4, 5]): @@ -45,7 +45,7 @@ def plot_chi2(ax, s, data_file): vmax = fac*ten ten *= delta break - pc = ax.pcolormesh(freqs, freqs, prss, vmin=0, vmax=vmax, + pc = ax.pcolormesh(freqs, freqs, chi2, vmin=0, vmax=vmax, rasterized=True) ax.set_title(f'$N=10^{np.log10(n):.0f}$', fontsize='medium') ax.set_xlim(0, 300) @@ -77,8 +77,8 @@ def plot_overn(ax, s, files, nmax=1e6, title=False): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - dt_fix = 1 # 0.0005 - chi2 = np.abs(data['prss'])/dt_fix*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)/0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) ns.append(n) i0 = np.argmin(freqs < 0) i1 = np.argmax(freqs > 300) diff --git a/noisesplit.py b/noisesplit.py index 2ba4604..2801eab 100644 --- a/noisesplit.py +++ b/noisesplit.py @@ -83,8 +83,8 @@ def plot_overn(ax, s, files, nmax=1e6): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - dt_fix = 1 # 0.0005 - chi2 = np.abs(data['prss'])/dt_fix*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)/0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) ns.append(n) i0 = np.argmin(freqs < 0) i1 = np.argmax(freqs > fcutoff) @@ -131,7 +131,8 @@ def plot_chi2_contrast(ax1, ax2, s, files, nums, nsmall, nlarge, rate): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - chi2 = np.abs(data['prss'])*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) cax = plot_chi2(ax, s, freqs, chi2, n, rate) cax.set_ylabel('') print(f'Modeled cell {"-".join(files[i].name.split("-")[2:-2])} at {100*alpha:4.1f}% contrast: noise_frac={1:3.1f}, nsegs={n}') @@ -147,7 +148,8 @@ def plot_chi2_split(ax1, ax2, s, files, nums, nsmall, nlarge, rate): noise_frac = data['noise_frac'] freqs = data['freqs'] pss = data['pss'] - chi2 = np.abs(data['prss'])*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) cax = plot_chi2(ax, s, freqs, chi2, n, rate) cax.set_ylabel('') print(f'Modeled cell {"-".join(files[i].name.split("-")[2:-1])} at {100*alpha:4.1f}% contrast: noise_frac={noise_frac:3.1f}, nsegs={n}') @@ -169,7 +171,8 @@ def plot_chi2_data(ax, s, cell_name, run): alpha = data['alpha'] freqs = data['freqs'] pss = data['pss'] - chi2 = np.abs(data['prss'])*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + prss = data['prss'] + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) print(f'Measured cell {"-".join(data_file.name.split("-")[:-2])} at {100*alpha:4.1f}% contrast: r={ratebase:3.0f}Hz, CV={cvbase:4.2f}, dt={1000*deltat:4.2f}ms, nfft={nfft}, win={1000*deltat*nfft:6.1f}ms, nsegs={n}') print() plot_chi2(ax, s, freqs, chi2, n, ratebase) diff --git a/punitexamplecell.py b/punitexamplecell.py index ea2ab8f..e8045fc 100644 --- a/punitexamplecell.py +++ b/punitexamplecell.py @@ -76,7 +76,7 @@ def load_spectra(path, cell_name, run=None): prss = data['prss'] nsegs = int(data['n']) gain = np.abs(prs)/pss - chi2 = np.abs(prss)*0.5/np.sqrt(pss.reshape(1, -1)*pss.reshape(-1, 1)) + chi2 = np.abs(prss)*0.5/(pss.reshape(1, -1)*pss.reshape(-1, 1)) return fcutoff, contrast, freqs, gain, chi2