Skip to content

Commit 654ee7a

Browse files
asiaszmekccluri
authored andcommitted
Add sKCSD tutorial (#88)
* Introduction to sKCSD tutorial * Add description for load data * Add example how to add morphology to empty data * Better description of assign function * Update test files. Update files for tests (and test_loadData.py to account for change filenames). Add segment lengths and membrane currents for sKCSD tutorial. Fix a bug in checking branching points in test_sKCSDcell.py. * Delete unused test data files. * Fix typo in the name of the file with electrode positions * Fix error in skcsd calculation skcsd is current density, no need to divide by segment length. * Add test data generation * Shorter simulation for test data * Make data plot of ground truth current density * Even shorter data (using a smaller morphology) for the skcsd tutorial * First description of values() * Add a comparison fig to the tutorial * Clean up dataset Increase number of used electrodes from 16 to 100. Record soma voltage, so it can be shown in tutorials. * Remove unused morphology file * New morphology file This actually is the same morphology file as before, only with a filename corresponding to the simulation parameters, which have been changed, because now 10x10 electrode grid is used. * Save array with timestamps to file * Add soma voltage plot * Fix small errors * Add some morphology transformations * Comment out L-curve for speed * Add savefig Switch to plotting with imshow, remove plt.show(), add a few tweaks. * Do not draw circles for morphology * Provide extent in meters not in microns. For compatibility with the rest of KCSD, which is implemented in SI units. * Remove obsolete figure * Remove unnecessary print * Move sKCSDcell.distribute_srcs_3D_morph() to init * Rewrite calculation of 2D morphology for images Rewrite calculation of 2D morphology for drawing images to use only code used for finding indices for CSD and potential transformations from loops to 3D morphology, to assure that morphology and CSD (or potential) will match perfectly. Provide extent in ordinary form and not switched x and y (for easier use with imshow). * Switch to 4 x 5 electrode setup * Explore more lambdas * Remove unused file * Update test morphology filename * Cleared kernel * More values of lambda to choose from * Remove l-curve from the figure * Divide code into functions * Plot morphology with interpolation to get rid of visible pixels * Initial setup of the figure * Move drawing plots into separate functions * Draw electrode positions * Draw CSD and ground truth in 2D projection * Make pixels for 3D visualizations of all equal dimensions * Use loop coordinates for index calculation * Draw with gray, where neuron is active * Add transparency to plotting circles (squares) * Use segment coordinates for plotting morphology * If not enough sources use segment coordinates for 3D visualization * Daniel's suggestions Change number of panels. Add panel labels. * Remove obsolete file * Revert "If not enough sources use segment coordinates for 3D visualization" This reverts commit 3464307. This commit introduced a bug. * Remove execution of distribute_srcs_morph() This method is now executed when initializing the sKCSDcell object. * Remove tests with y_points I no longer remember, what they were supposed to test. * Fix tests after fixing loop coordinates in sKCSDcell 1) For ball and stick neuron give 104 sources, so there are two loops for each segment. 2) Fix test for segment coordinates for Y-stick neuron -- last segment has 4 points. 3) Take correct point (first) for testing loop continuity for Y-stick neuron. * For points in between the same point return this point * Choose if drawn morphology should be based on segments or loops * Remove obsolete file * Add utf-8 clause for Python2 compatibility * Quatation marks instead of apostrophes for clarity * Use loop right ends as estimation points for sKCSD There was an inconsitency in choosing points for sKCSD estimation. The point of origin was also taken, which made the x dimension k_interp_pot different from the number of loops. This has been fixed by adding a new class variable, loop_pos, which is used only for sKCSD estimation. Variables est_poz and est_xyz are used for finding Cartesian coordinates of points on the morphology loop. * Make TimeStim the same length as the simulation itself * Fix drawing cell with custom resolution Add custom dx for calculating pixel coordinates for drawing segments. First find correct dxs for custom resolution then calculate pixel coordinates. Remove np.ceil, which made all the custom dxs equal one. * Deal with transformation of snapshots A snapshot of potential or CSD (potential or CSD at a chosen time t) is one dimensional and sKCSDcell.transform_to_3D yields an IndexError. Transform 1D array to a 3D array if necessary. * Ignore directories generated by scripts and neuron * Transform snapshots of CSD and ground_truth * Best parameters for the complex morphology * Ignore files in LCurve results directory * Narrower basis function to better match sKCSD to ground truth * Update estm_dists tests estm_dists are of the len(sKCSDcell.source_pos) x len(sKCSD.est_pos) - 1 size. sKCSD.est_pos contains all the loop positions starting with the origin, which results in two points for the first loop and one point for all the others. Consequently the origin is not included in estm_dists. * Update tests, the origin no longer in estm_dist * Fix preposition * Remove unnecessary print * Microns in coded in utf-8 * Move sKCSD utility functions to sKCSD_utils * Fix small bugs * Fix errors introduced by changing LoadData location * Uncomment reconstruction * Remove unused imports
1 parent 2cfdf56 commit 654ee7a

30 files changed

Lines changed: 1517 additions & 1863 deletions

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,11 @@ raw_data/
7777
/#*
7878
*png
7979
Data/gang_min/
80-
simulation
80+
simulation
81+
deactivate/
82+
#directory with generated figures
83+
Figures
84+
#directories generated by neuron
85+
synapse_locations
86+
x86_64
87+
LCurve

data/gang_7x7_200/LFP/MyLFP

Lines changed: 20 additions & 0 deletions
Large diffs are not rendered by default.

data/gang_7x7_200/LFP/myLFP

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 60 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,60 @@
1-
-600
2-
-400
3-
-200
4-
0
5-
200
6-
400
7-
600
8-
-600
9-
-400
10-
-200
11-
0
12-
200
13-
400
14-
600
15-
-600
16-
-400
17-
-200
18-
0
19-
200
20-
400
21-
600
22-
-600
23-
-400
24-
-200
25-
0
26-
200
27-
400
28-
600
29-
-600
30-
-400
31-
-200
32-
0
33-
200
34-
400
35-
600
36-
-600
37-
-400
38-
-200
39-
0
40-
200
41-
400
42-
600
43-
-600
44-
-400
45-
-200
46-
0
47-
200
48-
400
49-
600
50-
-600
51-
-600
52-
-600
53-
-600
54-
-600
55-
-600
56-
-600
57-
-400
58-
-400
59-
-400
60-
-400
61-
-400
62-
-400
63-
-400
64-
-200
65-
-200
66-
-200
67-
-200
68-
-200
69-
-200
70-
-200
71-
0
72-
0
73-
0
74-
0
75-
0
76-
0
77-
0
78-
200
79-
200
80-
200
81-
200
82-
200
83-
200
84-
200
85-
400
86-
400
87-
400
88-
400
89-
400
90-
400
91-
400
92-
600
93-
600
94-
600
95-
600
96-
600
97-
600
98-
600
99-
-20
100-
-20
101-
-20
102-
-20
103-
-20
104-
-20
105-
-20
106-
-20
107-
-20
108-
-20
109-
-20
110-
-20
111-
-20
112-
-20
113-
-20
114-
-20
115-
-20
116-
-20
117-
-20
118-
-20
119-
-20
120-
-20
121-
-20
122-
-20
123-
-20
124-
-20
125-
-20
126-
-20
127-
-20
128-
-20
129-
-20
130-
-20
131-
-20
132-
-20
133-
-20
134-
-20
135-
-20
136-
-20
137-
-20
138-
-20
139-
-20
140-
-20
141-
-20
142-
-20
143-
-20
144-
-20
145-
-20
146-
-20
147-
-20
1+
-2.000000000000000000e+01
2+
-6.666666666666666075e+00
3+
6.666666666666667851e+00
4+
2.000000000000000000e+01
5+
-2.000000000000000000e+01
6+
-6.666666666666666075e+00
7+
6.666666666666667851e+00
8+
2.000000000000000000e+01
9+
-2.000000000000000000e+01
10+
-6.666666666666666075e+00
11+
6.666666666666667851e+00
12+
2.000000000000000000e+01
13+
-2.000000000000000000e+01
14+
-6.666666666666666075e+00
15+
6.666666666666667851e+00
16+
2.000000000000000000e+01
17+
-2.000000000000000000e+01
18+
-6.666666666666666075e+00
19+
6.666666666666667851e+00
20+
2.000000000000000000e+01
21+
-2.000000000000000000e+01
22+
-2.000000000000000000e+01
23+
-2.000000000000000000e+01
24+
-2.000000000000000000e+01
25+
-1.000000000000000000e+01
26+
-1.000000000000000000e+01
27+
-1.000000000000000000e+01
28+
-1.000000000000000000e+01
29+
0.000000000000000000e+00
30+
0.000000000000000000e+00
31+
0.000000000000000000e+00
32+
0.000000000000000000e+00
33+
1.000000000000000000e+01
34+
1.000000000000000000e+01
35+
1.000000000000000000e+01
36+
1.000000000000000000e+01
37+
2.000000000000000000e+01
38+
2.000000000000000000e+01
39+
2.000000000000000000e+01
40+
2.000000000000000000e+01
41+
5.000000000000000000e+01
42+
5.000000000000000000e+01
43+
5.000000000000000000e+01
44+
5.000000000000000000e+01
45+
5.000000000000000000e+01
46+
5.000000000000000000e+01
47+
5.000000000000000000e+01
48+
5.000000000000000000e+01
49+
5.000000000000000000e+01
50+
5.000000000000000000e+01
51+
5.000000000000000000e+01
52+
5.000000000000000000e+01
53+
5.000000000000000000e+01
54+
5.000000000000000000e+01
55+
5.000000000000000000e+01
56+
5.000000000000000000e+01
57+
5.000000000000000000e+01
58+
5.000000000000000000e+01
59+
5.000000000000000000e+01
60+
5.000000000000000000e+01

data/gang_7x7_200/membcurr

Lines changed: 17 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)