Skip to content

Commit

Permalink
all figures compile
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-s committed Jun 29, 2020
1 parent 5c0632a commit 2f2d6c7
Show file tree
Hide file tree
Showing 358 changed files with 45 additions and 25 deletions.
40 changes: 25 additions & 15 deletions fig5/make_fig_4.m → +fig5/make.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
addpath('../')
close all


try
data_loc = getpref('size_comp','data');
catch
error('Tell this script where the data is using setpref>size_comp>data/')
end


figure('outerposition',[300 300 800 801],'PaperUnits','points','PaperSize',[800 801]); hold on
for i = 4:-1:1
ax(i) = subplot(2,2,i); hold on
Expand All @@ -24,7 +32,7 @@
g0 = [379 165 2.35 .72 297 1713 .46 1370];

% control -- integral controller
x = singleCompartment.makeNeuron('controller_type','IntegralController');
x = singleCompartment.makeNeuron('controller_type','oleary/IntegralController');
x.set('*gbar',g0)
x.reset
x.integrate;
Expand Down Expand Up @@ -65,9 +73,9 @@
all_gbar(:,7) = g0(7);
all_gbar = all_gbar';

if exist('generalized_perturbations.mat','file') == 2
if exist(fullfile(data_loc,'generalized_perturbations.mat'),'file') == 2

load('generalized_perturbations.mat','data','params')
load(fullfile(data_loc,'generalized_perturbations.mat'),'data','params')
else

p = xgrid;
Expand All @@ -89,7 +97,7 @@
[data, params] = p.gather;


save('generalized_perturbations.mat','data','params')
save(fullfile(data_loc,'generalized_perturbations.mat'),'data','params')
end

metrics = data{1};
Expand Down Expand Up @@ -143,7 +151,7 @@
% now we show calcium nullclines for a whole bunch of very similar neurons
% but with different properties in the standard projection

allfiles = dir('./perturb-similar-bursters/*calcium.voronoi');
allfiles = dir(fullfile(data_loc,'perturb-similar-bursters','*calcium.voronoi'));
alldata = singleCompartment.perturb.consolidateCalciumNullclines(allfiles);


Expand Down Expand Up @@ -182,7 +190,7 @@
x.set('*gbar',[379 165 2.35 .72 297 1713 .46 1370])
gbar = x.get('*gbar');
save_name = hashlib.md5hash([gbar(:); gbar_x(:); gbar_y(:)]);
load([save_name '_calcium.voronoi'],'-mat','v')
load(fullfile(data_loc,[save_name '_calcium.voronoi']),'-mat','v')

X = v.boundaries(1).regions.x;
Y = v.boundaries(1).regions.y;
Expand All @@ -198,7 +206,7 @@
x.set('*gbar',[379 165 2.35 .72 297 1713 .46 1370])
gbar = x.get('*gbar');
save_name = hashlib.md5hash([x.hash hashlib.md5hash([gbar_x(:); gbar_y(:)])]);
load([save_name '_1.voronoi'],'-mat','v')
load(fullfile(data_loc,[save_name '_1.voronoi']),'-mat','v')
v.plotBoundaries(ax(1))
axlib.resolveOverlappingPolyShapes(ax(1))

Expand Down Expand Up @@ -249,6 +257,8 @@
plot_data.X = [];
plot_data.Y = [];

x.integrate;

parfor j = 1:N

g = singleCompartment.perturb.scaleG(v.data.g0,all_x(i),all_y(j),gbar_x,gbar_y);
Expand All @@ -269,7 +279,7 @@
end

for j = 1:N
plotlib.trajectory(ax(1),plot_data(j).X,plot_data(j).Y,'Color',this_color,'ArrowLength',.015,'LineWidth',1,'norm_x',false,'norm_y',false,'n_arrows',1);
plotlib.trajectory(ax(1),plot_data(j).X,plot_data(j).Y,'Color',this_color,'ArrowLength',.015,'LineWidth',1,'NormX',false,'NormY',false,'NArrows',1);

end
drawnow
Expand Down Expand Up @@ -303,7 +313,7 @@
x.set('*gbar',[379 165 2.35 .72 297 1713 .46 1370])
gbar = x.get('*gbar');
save_name = hashlib.md5hash([gbar(:); gbar_x(:); gbar_y(:)]);
load([save_name '_calcium.voronoi'],'-mat','v')
load(fullfile(data_loc,[save_name '_calcium.voronoi']),'-mat','v')


X = v.boundaries(1).regions.x;
Expand All @@ -320,7 +330,7 @@
x.set('*gbar',[379 165 2.35 .72 297 1713 .46 1370])
gbar = x.get('*gbar');
save_name = hashlib.md5hash([x.hash hashlib.md5hash([gbar_x(:); gbar_y(:)])]);
load([save_name '_1.voronoi'],'-mat','v')
load(fullfile(data_loc,[save_name '_1.voronoi']),'-mat','v')
v.plotBoundaries(ax(2))
axlib.resolveOverlappingPolyShapes(ax(2))

Expand Down Expand Up @@ -390,7 +400,7 @@
end

for j = 1:N
plotlib.trajectory(ax(2),plot_data(j).X,plot_data(j).Y,'Color',this_color,'ArrowLength',.015,'LineWidth',1,'norm_x',false,'norm_y',false,'n_arrows',1);
plotlib.trajectory(ax(2),plot_data(j).X,plot_data(j).Y,'Color',this_color,'ArrowLength',.015,'LineWidth',1,'NormX',false,'NormY',false,'NArrows',1);

end
drawnow
Expand Down Expand Up @@ -425,10 +435,10 @@



axlib.label(ax(1),'a','x_offset',-.05,'y_offset',0,'font_size',24);
axlib.label(ax(2),'b','x_offset',-.05,'y_offset',0,'font_size',24);
axlib.label(ax(3),'c','x_offset',-.05,'y_offset',0,'font_size',24);
axlib.label(ax(4),'d','x_offset',-.05,'y_offset',0,'font_size',24);
axlib.label(ax(1),'a','XOffset',-.05,'YOffset',0,'FontSize',24);
axlib.label(ax(2),'b','XOffset',-.05,'YOffset',0,'FontSize',24);
axlib.label(ax(3),'c','XOffset',-.05,'YOffset',0,'FontSize',24);
axlib.label(ax(4),'d','XOffset',-.05,'YOffset',0,'FontSize',24);

ax(3).YLim = [600 1500];

Expand Down
10 changes: 8 additions & 2 deletions +singleCompartment/+perturb/analyzeWithControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@

status = 1;

try
data_loc = getpref('size_comp','data');
catch
error('Tell this script where the data is using setpref>size_comp>data/')
end


gbar = x.get('*gbar');
%save_name = hashlib.md5hash([gbar(:); gbar_x(:); gbar_y(:)]);

save_name = hashlib.md5hash([x.hash hashlib.md5hash([gbar_x(:); gbar_y(:)])]);

if exist([save_name '_1.voronoi'],'file')
if exist(fullfile(data_loc,[save_name '_1.voronoi']),'file')
disp('Already done, skipping...')
status = 0;
return
Expand Down Expand Up @@ -56,7 +62,7 @@

x0 = logspace(-.9,0,10)*x0;
y0 = logspace(-.9,0,10)*y0;
singleCompartment.perturb.segmentAndSave(v, x0, y0, [save_name '_1.voronoi']);
singleCompartment.perturb.segmentAndSave(v, x0, y0, fullfile(data_loc,[save_name '_1.voronoi']));


% clean up the start file
Expand Down
17 changes: 10 additions & 7 deletions +singleCompartment/+perturb/findCalciumNullcline.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

function status = findCalciumNullcline(x, gbar_x, gbar_y)

try
data_loc = getpref('size_comp','data');
catch
error('Tell this script where the data is using setpref>size_comp>data/')
end


status = 1;

if nargin == 1
Expand All @@ -22,16 +29,14 @@

disp(['Saving using: ' save_name])

if exist([save_name '_calcium.voronoi'],'file')
if exist(fullfile(data_loc,[save_name '_calcium.voronoi']),'file')
disp('Already done, skipping...')
status = 0;
return
end

x.reset;

% write to disk just so we know where it's writing
save([save_name '.start'],'status')


disp('==========================================')
Expand All @@ -46,7 +51,7 @@
if data.metrics_base.firing_rate == 0
disp('Bad model, skipping...')
delete([save_name '.start'])
save([save_name '.bad_model'],'status')
save(fullfile(data_loc,[save_name '.bad_model']),'status')
return
end

Expand Down Expand Up @@ -80,9 +85,7 @@
x0 = logspace(-.9,.4,10)*x0;
y0 = logspace(-.9,.4,10)*y0;

singleCompartment.perturb.segmentAndSave(v, x0, y0, [save_name '_calcium.voronoi']);
singleCompartment.perturb.segmentAndSave(v, x0, y0, fullfile(data_loc,[save_name '_calcium.voronoi']));

% clean up the start file
delete([save_name '.start'])


3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ images/
*.log
*.aux
*.out
*.start
*.start
*.voronoi
Binary file removed 9395145c8e98069c30447d3ef7d1d4fb_calcium.voronoi
Binary file not shown.
Binary file not shown.
Binary file removed fig5/3b08ad1e9f82e53f2ebf4fa54563389e_1.voronoi
Binary file not shown.
Binary file removed fig5/89bb546e1642d11c3fd3957a0aeddc5c_1.voronoi
Binary file not shown.
Binary file removed fig5/94b371a2765ac3e9e52d5e127c99d5d6_1.voronoi
Binary file not shown.
Binary file not shown.
Binary file removed fig5/e01e666b8d3316665b7c11dc03368178_1.voronoi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 2f2d6c7

Please sign in to comment.