From 5a49716a706566eb7badc39f0107ba3fa9b42ea1 Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Thu, 30 Nov 2023 23:21:03 +0100 Subject: [PATCH 1/9] Replace polish names --- figures/kCSD_properties/L_curve_simulation.py | 2 +- figures/kCSD_properties/figure_LC.py | 2 +- figures/kCSD_properties/figure_LCandCV.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/figures/kCSD_properties/L_curve_simulation.py b/figures/kCSD_properties/L_curve_simulation.py index 79b9d93..209e456 100644 --- a/figures/kCSD_properties/L_curve_simulation.py +++ b/figures/kCSD_properties/L_curve_simulation.py @@ -118,7 +118,7 @@ def main_loop(src_width, total_ele, inpos, lpos, nm, noise=0, srcs=1): for i, noise in enumerate(n_spec): plt.close('all') noise = np.round(noise, 5) - print('numer rekonstrukcji: ', i, 'noise level: ', noise) + print('number of reconstruction: ', i, 'noise level: ', noise) #Electrodes ele_pos, pots = electrode_config(total_ele, true_csd, t_csd_x, t_csd_y, inpos, lpos) ele_y = ele_pos[:, 1] diff --git a/figures/kCSD_properties/figure_LC.py b/figures/kCSD_properties/figure_LC.py index 6a782df..e2f7221 100644 --- a/figures/kCSD_properties/figure_LC.py +++ b/figures/kCSD_properties/figure_LC.py @@ -105,7 +105,7 @@ def make_plots(title, m_norm, m_resi, true_csd, curveseq, ele_y, noise_lvl = np.linspace(0, 0.5, noises) #df = np.load('data_fig4_and_fig13_lc_noise25.0.npz') Rs = np.linspace(0.025, 8*0.025, 8) - title = ['nazwa_pliku'] + title = ['file_name'] save_as = 'noise' make_plots(title, df['m_norm'], df['m_resi'], df['true_csd'], df['curve_surf'], df['ele_y'], df['pots_n'], diff --git a/figures/kCSD_properties/figure_LCandCV.py b/figures/kCSD_properties/figure_LCandCV.py index 95c0853..134ed30 100644 --- a/figures/kCSD_properties/figure_LCandCV.py +++ b/figures/kCSD_properties/figure_LCandCV.py @@ -74,7 +74,7 @@ def plot_surface(curve_surf, errsy, save_as): df = np.load(os.path.join('LC2', 'data_fig4_and_fig13_LC_noise25.0.npz')) Rs = np.linspace(0.025, 8*0.025, 8) - title = ['nazwa_pliku'] + title = ['file_name'] save_as = 'noise' plot_surface(df['curve_surf'], df['errsy'], save_as+'surf') plt.close('all') From c6c8f38f881a9799d8311d476fd7670dd25bce56 Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Sat, 16 Dec 2023 22:31:58 +0100 Subject: [PATCH 2/9] Uncomment data path --- figures/kCSD_properties/figure_LC.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/figures/kCSD_properties/figure_LC.py b/figures/kCSD_properties/figure_LC.py index e2f7221..e0da6f1 100644 --- a/figures/kCSD_properties/figure_LC.py +++ b/figures/kCSD_properties/figure_LC.py @@ -100,10 +100,10 @@ def make_plots(title, m_norm, m_resi, true_csd, curveseq, ele_y, fig.savefig(save_as+'.png') if __name__=='__main__': -# os.chdir("./LCurve/LC2") + os.chdir("./LCurve/LC2") noises = 3 noise_lvl = np.linspace(0, 0.5, noises) - #df = np.load('data_fig4_and_fig13_lc_noise25.0.npz') + df = np.load('data_fig4_and_fig13_LC_noise25.0.npz') Rs = np.linspace(0.025, 8*0.025, 8) title = ['file_name'] save_as = 'noise' From b916b318d96e7aabb56da971172dbe16865fbcdc Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Sun, 17 Dec 2023 00:39:50 +0100 Subject: [PATCH 3/9] Modify make_plot_perf to take noise_lvl as an argument (#150) --- figures/kCSD_properties/L_curve_simulation.py | 2 +- figures/kCSD_properties/figure_LCandCVperformance.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/figures/kCSD_properties/L_curve_simulation.py b/figures/kCSD_properties/L_curve_simulation.py index 209e456..4a2e99c 100644 --- a/figures/kCSD_properties/L_curve_simulation.py +++ b/figures/kCSD_properties/L_curve_simulation.py @@ -179,5 +179,5 @@ def main_loop(src_width, total_ele, inpos, lpos, nm, noise=0, srcs=1): os.chdir('..') np.save('sim_results', sim_results) sim_results = np.load('sim_results.npy') - make_plot_perf(sim_results) + make_plot_perf(sim_results, noise_lvl) diff --git a/figures/kCSD_properties/figure_LCandCVperformance.py b/figures/kCSD_properties/figure_LCandCVperformance.py index 5257802..849ea26 100644 --- a/figures/kCSD_properties/figure_LCandCVperformance.py +++ b/figures/kCSD_properties/figure_LCandCVperformance.py @@ -20,7 +20,7 @@ def set_axis(ax, x, y, letter=None): transform=ax.transAxes) return ax -def make_plot_perf(sim_results): +def make_plot_perf(sim_results, noise_lvl): rms_lc = sim_results[0, 2] lam_lc = sim_results[0, 0] rms_cv = sim_results[1, 2] @@ -81,4 +81,4 @@ def make_plot_perf(sim_results): noises = 9 noise_lvl = np.linspace(0, 0.5, noises) sim_results = np.load('sim_results.npy') - make_plot_perf(sim_results) + make_plot_perf(sim_results, noise_lvl) From 697fe3f7b29c610d208c12bd37ddbcd8fcc6f2da Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Sun, 17 Dec 2023 23:25:26 +0100 Subject: [PATCH 4/9] Update CSD resolution --- figures/kCSD_properties/error_propagation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/figures/kCSD_properties/error_propagation.py b/figures/kCSD_properties/error_propagation.py index 0719573..22c4b62 100755 --- a/figures/kCSD_properties/error_propagation.py +++ b/figures/kCSD_properties/error_propagation.py @@ -80,8 +80,8 @@ def _BipolarColormap(name, negative, positive): h = 50. # distance between the electrode plane and the CSD plane conductivity = 1.0 # S/m -csd_at = np.mgrid[0.:1.:100j, - 0.:1.:100j] +csd_at = np.mgrid[0.:1.:101j, + 0.:1.:101j] csd_x, csd_y = csd_at D = 2 - 1.618 From b14cfdb0fb8b168603bd13f68ee2ab183b5eccef Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Mon, 18 Dec 2023 11:42:38 +0100 Subject: [PATCH 5/9] Replace deprecated griddata function --- figures/kCSD_properties/tutorial_basic_3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/figures/kCSD_properties/tutorial_basic_3d.py b/figures/kCSD_properties/tutorial_basic_3d.py index 827c521..afb7056 100644 --- a/figures/kCSD_properties/tutorial_basic_3d.py +++ b/figures/kCSD_properties/tutorial_basic_3d.py @@ -5,7 +5,7 @@ import matplotlib.pyplot as plt from matplotlib import cm from matplotlib import gridspec -from matplotlib.mlab import griddata +from scipy.interpolate import griddata from scipy.spatial import distance from kcsd import csd_profile as CSD from kcsd import KCSD3D From 58c8d81d83a982a6412b932cc0a22853935112df Mon Sep 17 00:00:00 2001 From: Marta Bejtka Date: Mon, 18 Dec 2023 11:47:31 +0100 Subject: [PATCH 6/9] Update README to figures --- figures/kCSD_properties/README.txt | 125 ++++++----------------------- 1 file changed, 25 insertions(+), 100 deletions(-) diff --git a/figures/kCSD_properties/README.txt b/figures/kCSD_properties/README.txt index feab9d8..2434cbc 100644 --- a/figures/kCSD_properties/README.txt +++ b/figures/kCSD_properties/README.txt @@ -1,4 +1,4 @@ -Instructions for the figures from kCSD-revisited paper. +Instructions for the figures from kCSD-python, reliable current source density estimation with quality control. ~~~~~~~~~~~~~~~~~~~~~~~ Figure 1 - Schematic @@ -6,42 +6,20 @@ Figure 1 - Schematic name: figure1.png ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 2 - 1D spectral properties of kCSD method - -figure_eigensources_M_1D.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 3 - Noise-free Electrode / Basis source placement - -figure_Tbasis.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 4 - Noisy electrodes / Basis source placement - -figure_Tbasis_noise.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 5 - L-curve method for regularization +Figure 2 - L-curve method for regularization You will need to run L_curve_simulation.py first. figure_LC.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 6 - L-curve versus Cross-validation - -You will need to run L_curve_simulation.py first. - -figure_LCandCVperformance.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 7 - Error propagation map +Figure 3 - Error propagation map error_propagation.py colorblind_friendly.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 8 - Reliability map +Figure 4 - Reliability map 2D reliability_map_2d.py @@ -49,7 +27,7 @@ error_maps_2D/point_error_large_100_all_ele.npy error_maps_2D/point_error_small_100_all_ele.npy ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 9 - Reliability map; Use case in a 2D dipolar large source +Figure 5 - Reliability map; Use case in a 2D dipolar large source kCSD_with_reliability_map_2D.py @@ -57,7 +35,7 @@ error_maps_2D/point_error_large_100_all_ele.npy error_maps_2D/point_error_small_100_all_ele.npy ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 10 - Average Error (Diff) when broken electrode and loss in reconstruction quality +Figure 6 - Average Error (Diff) when broken electrode and loss in reconstruction quality You will need to run tutorial3.py first or download files from here https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 @@ -65,66 +43,39 @@ https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 tutorial_broken_electrodes_diff_err.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 11 - Simulated cortical recordings in Traubs's model -You will need to download files from: -https://repod.pon.edu.pl/dataset/thalamocortical-network/resource/6add09e1-bfe4-4082-b990-24b469756886 +Figure 7 - L-Curve and CV landscape -npx/traub_data_kcsd_column_figure.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 12 - LFP and CSD as a function of time - Traub's model - -You will need to download files from: -https://repod.pon.edu.pl/dataset/thalamocortical-network/resource/6add09e1-bfe4-4082-b990-24b469756886 +You will need to run L_curve_simulation.py first. -npx/figure_traub_timespace.py +figure_LCandCV.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 13 - Six first eigensources for a single bank of a Neuropixels probe - -You will need to download files from: -https://repod.pon.edu.pl/dataset/thalamocortical-network/resource/6add09e1-bfe4-4082-b990-24b469756886 -npx/figure_traub_eigensources.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Figure 14 - LFP and CSD space profiles - experimental data from a single bank of a Neuropixels probe +Figure 8 - Basic features tutorial -You will need to download files from: +You will need to run tutorial3.py first or download files from here +https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 -npx/kCSD2D_reconstruction_from_npx.py +tutorial_basic.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 15 - LFP and CSD as a function of time - experimental data - -You will need to download files from: - -npx/kCSD2D_reconstruction_from_npx.py -~~~~~~~~~~~~~~~~~~~~~~~~ -Figure 16 - L-Curve and CV landscape +Figure 9 - Noisy electrodes tutorial -You will need to run L_curve_simulation.py first. - -figure_LCandCV.py +tutorial_noisy_electrodes.py ~~~~~~~~~~~~~~~~~~~~~~~ -Figure 17 - Schematic - location of Neuropixels bank 0 - -name: figure17.png +Figure 10 - Broken electrodes tutorial -===================== -Supplementary Figures -===================== - -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Figure 2-Figure supplement 1 - spectral properties of kCSD method for simple 2D case +Download first from +https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 +(generated from tweaking tutorial3.py) -figure_eigensources_M_2D.py +tutorial_broken_electrodes.py -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Figure 7-Figure supplement 1 - Error propagation maps for 1D +~~~~~~~~~~~~~~~~~~~~~~~ +Figure 11 - Error propagation maps for 1D pots_propagation.py @@ -141,38 +92,12 @@ All supplementary figures to Figure 13 were created using different 'start' and 'stop'parameters at: npx/figure_traub_eigensources.py -================ -Appendix Figures -================ - ~~~~~~~~~~~~~~~~~~~~~~~ -Appendix 1 Figure 1 - Basic features tutorial - -You will need to run tutorial3.py first or download files from here -https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 - -tutorial_basic.py - -~~~~~~~~~~~~~~~~~~~~~~~ -Appendix 1 Figure 2 - Noisy electrodes tutorial - -tutorial_noisy_electrodes.py - -~~~~~~~~~~~~~~~~~~~~~~~~ -Appendix 1 Figure 3 - Broken electrodes tutorial - -Download first from -https://www.dropbox.com/sh/6kykj4d3dx3fp5s/AAACtN49VCbAHA9otOfNXbnOa?dl=0 -(generated from tweaking tutorial3.py) - -tutorial_broken_electrodes.py - -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Appendix 1 Figure 4 - 3D source reconstruction +Figure 12 - 3D source reconstruction tutorial_basic_3d.py -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Appendix 1 Figure 5 - sKCSD example +~~~~~~~~~~~~~~~~~~~~~~~ +Figure 13 - sKCSD example skcsd_and_l_curve_complex_morphology.py From f4f89d1d384c0f15b2766fdf39d905b872e61df6 Mon Sep 17 00:00:00 2001 From: Marta Date: Thu, 21 Dec 2023 23:53:00 +0100 Subject: [PATCH 7/9] Fix figures --- figures/kCSD_properties/pots_propagation.py | 4 ++-- figures/kCSD_properties/tutorial_basic_3d.py | 25 +++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/figures/kCSD_properties/pots_propagation.py b/figures/kCSD_properties/pots_propagation.py index 265e5b7..6f5456f 100644 --- a/figures/kCSD_properties/pots_propagation.py +++ b/figures/kCSD_properties/pots_propagation.py @@ -123,11 +123,11 @@ def generate_figure(true_csd_xlims, total_ele, ele_lims, R_init=0.23): for i in range(len(ele_pos)): ax = fig.add_subplot(gs[plt_cord[i][0], plt_cord[i][1]:plt_cord[i][1]+2]) - ax.plot(np.linspace(0, 1, 100), est_csd[i], lw=2, c='red', + ax.plot(np.linspace(0, 1, 101), est_csd[i], lw=2, c='red', label='kCSD') ax.scatter(ele_pos, np.zeros(len(ele_pos)), c='k', label='Electrodes') ax2 = ax.twinx() - ax2.plot(np.linspace(0, 1, 100), OBJ_M[i].values('POT'), c='green', + ax2.plot(np.linspace(0, 1, 101), OBJ_M[i].values('POT'), c='green', label='Potentials') ax2.set_ylim([-1.5, 1.5]) ax.set_ylim([-150, 150]) diff --git a/figures/kCSD_properties/tutorial_basic_3d.py b/figures/kCSD_properties/tutorial_basic_3d.py index afb7056..a05743b 100644 --- a/figures/kCSD_properties/tutorial_basic_3d.py +++ b/figures/kCSD_properties/tutorial_basic_3d.py @@ -26,16 +26,18 @@ def generate_csd_3D(csd_profile, csd_seed, f = f / np.max(np.abs(f)) return csd_at, f -def grid(x, y, z, resX=100, resY=100): +def grid(x, y, z, resX=100j, resY=100j): """ Convert 3 column data to matplotlib grid """ x = x.flatten() y = y.flatten() z = z.flatten() - xi = linspace(min(x), max(x), resX) - yi = linspace(min(y), max(y), resY) - zi = griddata(x, y, z, xi, yi, interp='linear') + #xi = linspace(min(x), max(x), resX) + #yi = linspace(min(y), max(y), resY) + xi, yi = np.mgrid[min(x):max(x):resX, min(y):max(y):resY] + #zi = griddata(x, y, z, xi, yi, method='linear') + zi = griddata((x, y), z, (xi, yi), method='linear') return xi, yi, zi def generate_electrodes(xlims=[0.1,0.9], ylims=[0.1,0.9], zlims=[0.1,0.9], res=5): @@ -57,7 +59,7 @@ def make_plots(fig_title, """ Shows 3 plots 1_ true CSD generated based on the random seed given - 2_ interpolated LFT (NOT kCSD pot though), generated by simpsons rule integration + 2_ interpolated LFP (NOT kCSD pot though), generated by simpsons rule integration 3_ results from the kCSD 2D for the default values """ k_csd_x, k_csd_y, k_csd_z = k.estm_x, k.estm_y, k.estm_z @@ -312,9 +314,9 @@ def main_loop(csd_profile, csd_seed, prefix, total_ele=125, num_init_srcs=1000): start_x=x_lims[0], end_x=x_lims[1], start_y=y_lims[0], end_y=y_lims[1], start_z=z_lims[0], end_z=z_lims[1], - res_x=int((x_lims[1]-x_lims[0])/gdX), - res_y=int((y_lims[1]-y_lims[0])/gdY), - res_z=int((z_lims[1]-z_lims[0])/gdZ)) + res_x=int((x_lims[1]-x_lims[0])/gdX +1), + res_y=int((y_lims[1]-y_lims[0])/gdY +1), + res_z=int((z_lims[1]-z_lims[0])/gdZ +1)) rms = np.linalg.norm(abs(test_csd - est_csd[:,:,:,0])) rms /= np.linalg.norm(test_csd) @@ -331,11 +333,16 @@ def main_loop(csd_profile, csd_seed, prefix, total_ele=125, num_init_srcs=1000): plt.savefig(os.path.join(prefix, str(csd_seed)+'.pdf')) np.savez(os.path.join(prefix, str(csd_seed)+'.npz'), true_csd=true_csd, pots=pots, post_cv=est_csd, R=k.R) + #plt.savefig(prefix + str(csd_seed)+'.pdf') + #np.savez(prefix + str(csd_seed)+'.npz', + # true_csd=true_csd, pots=pots, post_cv=est_csd, R=k.R) return if __name__=='__main__': CSD_PROFILE = CSD.gauss_3d_small - prefix = '/home/chaitanya/kCSD-python/figures/kCSD_properties/small_srcs_3D' + prefix = os.getcwd() + '/small_srcs_3D' + if not os.path.isdir(prefix): + os.makedirs(prefix) total_ele = 125 #Normal run for csd_seed in range(50, 100): From 3fc7fa71eac4db442ed03c6e216211ee51ec07ca Mon Sep 17 00:00:00 2001 From: m-kowalska Date: Fri, 22 Dec 2023 13:35:43 +0100 Subject: [PATCH 8/9] Update README --- figures/kCSD_properties/README.txt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/figures/kCSD_properties/README.txt b/figures/kCSD_properties/README.txt index 2434cbc..9fa903e 100644 --- a/figures/kCSD_properties/README.txt +++ b/figures/kCSD_properties/README.txt @@ -79,19 +79,6 @@ Figure 11 - Error propagation maps for 1D pots_propagation.py -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Figure 13-Figure supplement 1 - Eigensurces 7-12 ('start=6', 'stop=12'), -Figure 13-Figure supplement 2 - Eigensurces 13-18 ('start=12', 'stop=18'), -Figure 13-Figure supplement 3 - Eigensurces 19-24 ('start=18', 'stop=24'), -Figure 13-Figure supplement 4 - Eigensurces 25-30 ('start=24', 'stop=30'), -Figure 13-Figure supplement 5 - Eigensurces 31-36 ('start=30', 'stop=36'), -Figure 13-Figure supplement 6 - Eigensurces 37-42 ('start=36', 'stop=42'), -Figure 13-Figure supplement 7 - Eigensurces 43-48 ('start=42', 'stop=48') - -All supplementary figures to Figure 13 were created using different -'start' and 'stop'parameters at: -npx/figure_traub_eigensources.py - ~~~~~~~~~~~~~~~~~~~~~~~ Figure 12 - 3D source reconstruction @@ -100,4 +87,7 @@ tutorial_basic_3d.py ~~~~~~~~~~~~~~~~~~~~~~~ Figure 13 - sKCSD example +You will need to install LFPy package first: +pip install lfpy + skcsd_and_l_curve_complex_morphology.py From 76d2905e10455d6939bbc577b50cfa42c1e813d3 Mon Sep 17 00:00:00 2001 From: m-kowalska Date: Fri, 22 Dec 2023 14:44:23 +0100 Subject: [PATCH 9/9] Fix data shapes in figures --- .../kCSD_with_reliability_map_2D.py | 16 ++++++++++------ figures/kCSD_properties/reliability_map_2D.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/figures/kCSD_properties/kCSD_with_reliability_map_2D.py b/figures/kCSD_properties/kCSD_with_reliability_map_2D.py index 419a180..487bad0 100644 --- a/figures/kCSD_properties/kCSD_with_reliability_map_2D.py +++ b/figures/kCSD_properties/kCSD_with_reliability_map_2D.py @@ -106,7 +106,7 @@ def make_reconstruction(KK, csd_profile, csd_seed, total_ele, def make_subplot(ax, val_type, xs, ys, values, cax, title=None, ele_pos=None, xlabel=False, ylabel=False, letter='', t_max=None, - mask=False, level=False): + mask=False, mask_x=False, mask_y=False, level=False): if val_type == 'csd': cmap = cm.bwr elif val_type == 'pot': @@ -128,7 +128,10 @@ def make_subplot(ax, val_type, xs, ys, values, cax, title=None, ele_pos=None, levels=levels, cmap=cmap, alpha=1, extent=(0, 0.5, 0, 0.5)) if mask is not False: - CS = ax.contour(xs, ys, mask, cmap='Greys') + if mask_x is not False: + CS = ax.contour(mask_x, mask_y, mask, cmap='Greys') + else: + CS = ax.contour(xs, ys, mask, cmap='Greys') ax.clabel(CS, # label every second level inline=1, fmt='%1.2f', @@ -186,7 +189,7 @@ def generate_figure(k, true_csd, ele_pos, pots, mask=False): # gs.update(top=.95, bottom=0.53) ax = plt.subplot(gs[0, 0]) cax = plt.subplot(gs[1, 0]) - make_subplot(ax, 'csd', csd_x, csd_y, true_csd, cax=cax, ele_pos=ele_pos, + make_subplot(ax, 'csd', k.estm_x, k.estm_y, true_csd, cax=cax, ele_pos=ele_pos, title='True CSD', xlabel=True, ylabel=True, letter='A', t_max=np.max(abs(true_csd))) ax = plt.subplot(gs[0, 1]) @@ -199,10 +202,10 @@ def generate_figure(k, true_csd, ele_pos, pots, mask=False): make_subplot(ax, 'csd', k.estm_x, k.estm_y, k.values('CSD')[:, :, 0], cax=cax, ele_pos=ele_pos, title='kCSD with Reliability Map', xlabel=True, letter='C', t_max=np.max(abs(true_csd)), - mask=mask) + mask=mask, mask_x=csd_x, mask_y=csd_y) ax = plt.subplot(gs[0, 3]) cax = plt.subplot(gs[1, 3]) - make_subplot(ax, 'diff', csd_x, csd_y, + make_subplot(ax, 'diff', k.estm_x, k.estm_y, abs(true_csd-k.values('CSD')[:, :, 0]), cax=cax, ele_pos=ele_pos, title='|True CSD - kCSD|', xlabel=True, letter='D', @@ -245,9 +248,10 @@ def matrix_symmetrization(point_error): Rs=Rs, lambdas=lambdas, method=method) + test_csd = CSD_PROFILE([k.estm_x, k.estm_y], CSD_SEED) error_l = np.load('error_maps_2D/point_error_large_100_all_ele.npy') error_s = np.load('error_maps_2D/point_error_small_100_all_ele.npy') error_all = np.concatenate((error_l, error_s)) symm_array_all = matrix_symmetrization(error_all) - generate_figure(k, true_csd, ele_pos, pots, + generate_figure(k, test_csd, ele_pos, pots, mask=np.mean(symm_array_all, axis=0)) diff --git a/figures/kCSD_properties/reliability_map_2D.py b/figures/kCSD_properties/reliability_map_2D.py index 341b6ea..b981110 100644 --- a/figures/kCSD_properties/reliability_map_2D.py +++ b/figures/kCSD_properties/reliability_map_2D.py @@ -77,7 +77,7 @@ def make_single_subplot(ax, val_type, xs, ys, values, cax, title=None, plt.colorbar(im, cax=cax, orientation='horizontal', format='%.2f', ticks=ticks) set_axis(ax, letter=letter) - plt.tight_layout() + #plt.tight_layout() return ax, cax