forked from Fehings/Vertex_git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neuronDynamicsStimPre.m
37 lines (28 loc) · 1.2 KB
/
neuronDynamicsStimPre.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function [NParams] = neuronDynamicsStimPre(NeuronParams,TP)
NParams = NeuronParams;
if isfield(NParams, 'minCompartmentSize')
adjustedcompartments = true;
% Adjusts the number and size of compartments to ensure that the
% electric field calculations remain valid. Caution should be advised
% that this can drastically increase the size of the simulation.
Nparams = adjustCompartments(NParams, TP);
NParams = Nparams;
end
NParams = calculatePassiveProperties(NParams, TP);
SS.parallelSim = false;
compartments{1,1} = NParams.compartmentXPositionMat;
compartments{1,2} = NParams.compartmentYPositionMat;
compartments{1,3} = NParams.compartmentZPositionMat;
iGroup = 1;
[compartmentlocations{iGroup,1}, compartmentlocations{iGroup,2}] = ...
convertcompartmentlocations({compartments{1,1}},...
{compartments{1,2}},{compartments{1,3}});
point1 = compartmentlocations{iGroup,1};
point2 = compartmentlocations{iGroup,2};
%get the mid points of the compartments
midpoints = zeros(3,length(point1.x(:,1)),length(point1.x(1,:)));
midpoints(1,:,:) = (point1.x + point2.x)./2;
midpoints(2,:,:) = (point1.y + point2.y)./2;
midpoints(3,:,:) = (point1.z + point2.z)./2;
NParams.midpoints = midpoints;
end