Skip to content

Commit 437fc86

Browse files
committed
playing with NPX files
1 parent ed46842 commit 437fc86

1 file changed

Lines changed: 44 additions & 18 deletions

File tree

figures/npx/dan_kCSD_from_npx.py

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ def dan_make_plot(k):
2929
fig = plt.figure(figsize=(7, 7))
3030
ax1 = plt.subplot(121)
3131

32-
est_csd = k.values('CSD')
33-
est_csd = est_csd.reshape(7, 90)
34-
est_pots = k.values('POT')
35-
est_pots = est_pots.reshape(7, 90)
36-
32+
est_csd = k.values('CSD').squeeze()
33+
est_pots = k.values('POT').squeeze()
34+
3735
make_plot(ax1, k.estm_x, k.estm_y, est_csd[:, :],
3836
title='Estimated CSD', cmap=cm.bwr)
3937

@@ -135,7 +133,7 @@ def eles_to_coords(eles):
135133
meta = readSGLX.readMeta(binFullPath)
136134
sRate = readSGLX.SampRate(meta)
137135

138-
tStart, tEnd = 500., 600. # 0., 1. # in seconds
136+
tStart, tEnd = 0., 600. # 500., 600. # 0., 1. # in seconds
139137

140138
firstSamp = int(sRate*tStart)
141139
lastSamp = int(sRate*tEnd)
@@ -199,7 +197,7 @@ def eles_to_coords(eles):
199197

200198
ele_pos = eles_to_coords(electrodes)
201199
print(ele_pos)
202-
csd_at_time = 30.
200+
csd_at_time = 0.3
203201
pots = []
204202
for ii, chann in enumerate(channels):
205203
print(ii, chann)
@@ -209,21 +207,36 @@ def eles_to_coords(eles):
209207
print(pots.shape)
210208

211209

210+
211+
electrode_order = np.argsort(ele_pos[:,1])
212+
temp_pots = convData[electrode_order, :]
213+
ax = plt.subplot(111)
214+
plt.imshow(temp_pots[:, 0:38400])
215+
ax.set_aspect(100)
216+
217+
218+
219+
212220
pots = pots.reshape((len(channels), 1))
213221
R = 5. # 0.3
214222
lambd = 0.
215-
h = 20. # 50
223+
h = 1. # 50
216224
sigma = 0.3
217225

218226
k = KCSD2D(ele_pos, pots, h=h, sigma=sigma,
219-
xmin=-35, xmax=35,
220-
ymin=1100, ymax=2000,
227+
xmin=-400, xmax=400,
228+
# ymin=1100, ymax=2000,
221229
# ymin=1000, ymax=10000,
230+
ymin=500, ymax=3000,
222231
gdx=10, gdy=10, lambd=lambd,
223232
R_init=R, n_src_init=10000,
224233
src_type='gauss') # rest of the parameters are set at default
234+
dan_make_plot(k)
235+
225236

226-
k.L_curve(Rs=np.logspace(-1., 2., 31), lambdas=np.logspace(-5., 1., 11))
237+
k.L_curve(Rs=np.logspace(-1., 2., 5), lambdas = None)
238+
# k.L_curve(Rs=np.logspace(-1., 2., 11), lambdas=np.logspace(-5., 1., 11))
239+
# k.L_curve(Rs=np.logspace(-1., 2., 11), lambdas=np.logspace(-5., 1., 31))
227240
plt.imshow(k.curve_surf)
228241

229242
# k.cross_validate(Rs=np.logspace(0., 2., 21), lambdas=np.logspace(-5., 1., 11))
@@ -232,17 +245,30 @@ def eles_to_coords(eles):
232245

233246
dan_make_plot(k)
234247

248+
for h in 1., 4., 16., 32., 64., 128.:
249+
k = KCSD2D(ele_pos, pots, h=h, sigma=sigma,
250+
xmin=-400, xmax=400,
251+
# ymin=1100, ymax=2000,
252+
# ymin=1000, ymax=10000,
253+
ymin=500, ymax=3000,
254+
gdx=10, gdy=10, lambd=lambd,
255+
R_init=R, n_src_init=10000,
256+
src_type='gauss') # rest of the parameters are set at default
257+
k.L_curve(Rs=np.logspace(-1., 2., 11))
258+
plt.imshow(k.curve_surf)
259+
dan_make_plot(k)
260+
235261

236262
# =============================================================================
237-
# for R in np.logspace(0., 2., 21):
263+
# for R in np.logspace(0., 2., 11):
238264
# for lambd in np.logspace(-5., 1., 11):
239265
# k = KCSD2D(ele_pos, pots, h=h, sigma=sigma,
240-
# xmin=-35, xmax=35,
241-
# ymin=1100, ymax=2000,
242-
# # ymin=1000, ymax=10000,
243-
# gdx=10, gdy=10, lambd=lambd,
244-
# R_init=R, n_src_init=1000,
245-
# src_type='gauss') # rest of the parameters are set at default
266+
# xmin=-35, xmax=35,
267+
# ymin=1100, ymax=2000,
268+
# # ymin=1000, ymax=10000,
269+
# gdx=10, gdy=10, lambd=lambd,
270+
# R_init=R, n_src_init=1000,
271+
# src_type='gauss') # rest of the parameters are set at default
246272
#
247273
# est_csd = k.values('CSD')
248274
# est_csd = est_csd.reshape(7, 90)

0 commit comments

Comments
 (0)