forked from shababo/iit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
iit_explorer.m
1000 lines (744 loc) · 38.7 KB
/
iit_explorer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function varargout = iit_explorer(varargin)
% IIT_EXPLORER MATLAB code for iit_explorer.fig
% IIT_EXPLORER, by itself, creates a new IIT_EXPLORER or raises the existing
% singleton*.
%
% H = IIT_EXPLORER returns the handle to a new IIT_EXPLORER or the handle to
% the existing singleton*.
%
% IIT_EXPLORER('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in IIT_EXPLORER.M with the given input arguments.
%
% IIT_EXPLORER('Property','Value',...) creates a new IIT_EXPLORER or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before iit_explorer_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to iit_explorer_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help iit_explorer
% Last Modified by GUIDE v2.5 20-Feb-2013 14:54:00
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @iit_explorer_OpeningFcn, ...
'gui_OutputFcn', @iit_explorer_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before iit_explorer is made visible.
function iit_explorer_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to iit_explorer (see VARARGIN)
% set(hObject, 'Renderer', 'painters')
% Choose default command line output for iit_explorer
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes iit_explorer wait for user response (see UIRESUME)
% uiwait(handles.iit_explorer);
% Set initial View
set(handles.Concepts,'Visible','Off')
set(handles.SystemPartitions,'Visible','Off')
% load data
if nargin == 4 && isstruct(varargin{1})
handles.data = varargin{1};
guidata(hObject,handles)
else
fprintf('Please load a struct when opening IIT_EXPLORER\n');
handles.output = 'ERROR';
guidata(hObject,handles)
close(gcf)
return
end
handles.mip_axes = [];
guidata(hObject,handles);
handles.export_plot = 0;
guidata(hObject,handles);
num_states = 2^handles.data.num_nodes;
all_states = length(handles.data.Big_phi_M) > 1;
% setup state listbox
if all_states
states = cell(1,num_states + 1);
states{1} = 'Average';
for i = 1:num_states
states{i + 1} = dec2bin(i-1,handles.data.num_nodes);
end
else
states = {mod_mat2str(handles.data.current_state')};
set(handles.state_list,'Enable','off')
end
set(handles.state_list,'String',states);
% setup subset listbox
nodes = cell(1,handles.data.num_nodes);
for i = 1:handles.data.num_nodes
nodes{i} = num2str(i);
end
set(handles.nodes_list,'String',nodes)
set(handles.nodes_list,'Value',handles.data.Complex{1})
set(handles.overview_axes_panel,'Visible','off');
set(handles.summary_panel,'Visible','off');
refresh_subset_button_Callback(handles.refresh_subset_button,eventdata,handles)
% set(handles.overview_scroll_panel,'Parent',handles.overview_axes_panel)
% --- Outputs from this function are returned to the command line.
function varargout = iit_explorer_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = 'Explorer Closed.';
% --- Executes on selection change in view_menu.
function view_menu_Callback(hObject, eventdata, handles)
% hObject handle to view_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns view_menu contents as cell array
% contents{get(hObject,'Value')} returns selected item from view_menu
subset = handles.data.subset; subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
view_choices = cellstr(get(hObject,'String'));
% turn all views off
for i = 1:length(view_choices)
this_view = view_choices{i}(view_choices{i} ~= ' ');
eval(['set(handles.' this_view ',''Visible'',''Off'')'])
end
% turn selected view on
view = view_choices{get(hObject,'Value')};
view_no_spaces = view(view ~= ' ');
eval(['set(handles.' view_no_spaces ',''Visible'',''On'')'])
if strcmp(view,'Overview')
set(handles.overview_axes_panel,'Visible','off')
drawnow
current_display_elements = allchild(handles.overview_axes_panel);
for i = 1:length(current_display_elements)
delete(current_display_elements(i))
end
set(handles.overview_axes_text,'Visible','off')
set(handles.big_phi_text,'String',['Big Phi = ' num2str(handles.data.Big_phi_M{state_index}(subset_index))])
set(handles.big_phi_MIP_text,'String',['Big Phi MIP = ' num2str(handles.data.Big_phi_MIP{state_index}(subset_index))])
set(handles.MIP_text,'String',{'MIP:',[mod_mat2str(handles.data.complex_MIP_M{state_index}{subset_index}) '-'...
mod_mat2str(pick_rest(subset,handles.data.complex_MIP_M{state_index}{subset_index}))]})
if handles.data.BFCut_M{state_index}{subset_index} == 1
BFCutString = '<-- BR cut';
else
BFCutString = '--> FR cut';
end
set(handles.BFCut_text,'String',{'Cut direction:',BFCutString})
if ~isempty(handles.data.purviews_M{state_index}{subset_index}) %Should not happen, but just in case
set(handles.sum_small_phi_text,'String',['Sum Small Phi = ' num2str(sum(handles.data.small_phi_M{state_index}{subset_index}(:,1)))])
set(handles.num_core_concepts_text,'String',['# Core Concepts = ' num2str(sum(handles.data.small_phi_M{state_index}{subset_index}(:,1) ~= 0))])
[IRR_REP IRR_phi IRR_MIP M_IRR] = IRR_points(handles.data.concepts_M{state_index},...
handles.data.small_phi_M{state_index},...
handles.data.concept_MIP_M{state_index},subset, subset_index);
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor',[0.9294 0.9294 0.9294]);
else
panel = handles.overview_axes_panel;
end
plot_REP(handles.data.Big_phi_M{state_index}(subset_index), IRR_REP, IRR_phi, IRR_MIP,...
subset, panel)
end
% reset export_panel flag
handles.export_plot = 0;
guidata(hObject,handles);
set(handles.summary_panel,'Visible','on')
set(handles.overview_axes_panel,'Visible','on')
set(handles.panel_slider,'Value',1.0)
elseif strcmp(view,'Concepts')
N = length(subset);
M_cell = cell(2^N-1,1);
k = 1;
for i = 1:N
C = nchoosek(subset,i);
N_C = size(C,1);
for j = 1:N_C % for all combos of size i
x0 = C(j,:); % pick a combination
M_cell{k} = x0;% store combo
k = k + 1;
end
end
num_concepts = length(M_cell);
concept_names = cell(2*num_concepts,1);
for i = 1:num_concepts
concept_names{i} = [mod_mat2str(M_cell{i}) '_past'];
end
for i = num_concepts+1:2*num_concepts
concept_names{i} = [mod_mat2str(M_cell{i-num_concepts}) '_future'];
end
set(handles.output_concepts_list,'String',concept_names)
set(handles.output_concepts_list,'Value',[]);
elseif strcmp(view,'System Partitions')
partition_names = cell(length(handles.data.complex_MIP_all_M{state_index}{subset_index}),1);
for i = 1:length(handles.data.complex_MIP_all_M{state_index}{subset_index})
partition_names{i} = [mod_mat2str(handles.data.complex_MIP_all_M{state_index}{subset_index}{i}) '-'...
mod_mat2str(pick_rest(subset,handles.data.complex_MIP_all_M{state_index}{subset_index}{i}))];
end
set(handles.partition_list,'String',partition_names)
select_MIP(handles, subset, state_index, subset_index)
update_purviews_list(handles)
plot_partition(handles);
end
% --- Executes during object creation, after setting all properties.
function view_menu_CreateFcn(hObject, eventdata, handles)
% hObject handle to view_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in nodes_list.
function nodes_list_Callback(hObject, eventdata, handles)
% hObject handle to nodes_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns nodes_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from nodes_list
% --- Executes during object creation, after setting all properties.
function nodes_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to nodes_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in complex_button.
function complex_button_Callback(hObject, eventdata, handles)
% hObject handle to complex_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)\
state_index = get_state_index(handles);
set(handles.nodes_list,'Value',handles.data.Complex{state_index})
refresh_subset_button_Callback(handles.refresh_subset_button, eventdata, handles)
function state_index = get_state_index(handles)
state_choice = get(handles.state_list,'Value');
if length(get(handles.state_list,'String')) == 1
state_index = 1;
else
state_index = trans10(flipud(trans2(state_choice - 2,handles.data.num_nodes)));
end
% % --------------------------------------------------------------------
% function brush_toggle_OffCallback(hObject, eventdata, handles)
% % hObject handle to brush_toggle (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% brush off
%
%
% % --------------------------------------------------------------------
% function brush_toggle_OnCallback(hObject, eventdata, handles)
% % hObject handle to brush_toggle (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% brush on
%
% % below is an attempt to get
% % for i = 1:length(handles.mip_axes)
% %
% % brushed = findall(handles.mip_axes{i},'tag','Brushing');
% % set(handles.brushed,'Parent',handles.mip_plot_panel,'Clipping','on')
% %
% % end
% --- Executes on selection change in partition_list.
function partition_list_Callback(hObject, eventdata, handles)
% hObject handle to partition_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns partition_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from partition_list
update_purviews_list(handles)
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes during object creation, after setting all properties.
function partition_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to partition_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in purviews_list.
function purviews_list_Callback(hObject, eventdata, handles)
% hObject handle to purviews_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns purviews_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from purviews_list
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes during object creation, after setting all properties.
function purviews_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to purviews_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
%Larissa
% --- Executes on button press in refresh_subset_button.
function refresh_subset_button_Callback(hObject, eventdata, handles)
% hObject handle to refresh_subset_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[handles.data.subset handles.data.subset_index handles.data.state_index] = get_subset_and_state(handles);
guidata(gcf,handles)
subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
if isempty(nnz(cell2mat(handles.data.BFCut_M{1})))
set(handles.overview_axes_panel,'Visible','off')
set(handles.overview_axes_text,'String','This state in not realizable.','Visible','on')
return
end
if isempty(handles.data.purviews_M{state_index}{subset_index})
set(handles.overview_axes_panel,'Visible','off')
if handles.data.network.options(3)==0
set(handles.overview_axes_text,'String','Only the full complex was calculated.','Visible','on')
else
set(handles.overview_axes_text,'String','This set of elements is not strongly connected or has no concepts.','Visible','on')
end
return
end
view_menu_Callback(handles.view_menu, eventdata, handles)
function select_MIP(handles, subset, state_index, subset_index)
partition_names = get(handles.partition_list,'String');
MIP_string = [mod_mat2str(handles.data.complex_MIP_M{state_index}{subset_index}) '-'...
mod_mat2str(pick_rest(subset,handles.data.complex_MIP_M{state_index}{subset_index}))];
MIP_index = find(strcmp(MIP_string,partition_names));
set(handles.partition_list,'Value',MIP_index)
%Larissa: This still needs to be checked if qualia plot is correct!
function plot_partition(handles)
subset = handles.data.subset; subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
if isempty(handles.data.purviews_M{state_index}{subset_index})
set(handles.mip_plot_panel,'Visible','off')
set(handles.partition_plot_info,'String','This set of elements is not strongly connected or has no concepts.','Visible','on')
return
end
[partition1 partition1_index partition2 partition2_index] = get_partitions(handles);
partition_index = 0;
for i = 1:length(partition1)-1
partition_index = partition_index + nchoosek(length(subset),i);
end
[ignore_var additional] = intersect(nchoosek(subset,length(partition1)),partition1,'rows');
partition_index = partition_index + additional;
system_partition_text = ['System: ' mod_mat2str(subset)];
partition_choices = get(handles.partition_list,'String');
partition_text = partition_choices{get(handles.partition_list,'Value')};
system_partition_text = [system_partition_text ', Partition: ' partition_text];
big_phi_partition_text = ['Big Phi (partition) = ' num2str(handles.data.Big_phi_MIP_all_M{state_index}{subset_index}(partition_index,1))];
highlight_indices = get(handles.purviews_list,'Value');
if ~isempty(highlight_indices)
purviews_list = get(handles.purviews_list,'String');
selected_concepts_text = ['Selected Concepts: ' purviews_list{highlight_indices(1)}];
for i = 2:length(highlight_indices)
selected_concepts_text = [selected_concepts_text ', ' purviews_list{highlight_indices(i)}];
end
else
selected_concepts_text = 'Selected Concepts: None';
end
direction_choices = get(handles.past_future_list,'String');
direction_text = ['Temporal Direction: ' direction_choices{get(handles.past_future_list,'Value')}];
Cutdirection_choices = get(handles.BFCut_list,'String');
Cutdirection_text = ['Cut Direction: ' Cutdirection_choices{get(handles.BFCut_list,'Value')}];
partition_info = {system_partition_text, big_phi_partition_text, selected_concepts_text, direction_text, Cutdirection_text};
set(handles.partition_plot_info,'String',partition_info)
existing_axes = findobj(handles.mip_plot_panel,'Parent',handles.mip_plot_panel);
for k = 1:length(existing_axes)
delete(existing_axes(k))
end
N = length(subset);
set(handles.mip_loading_text,'Visible','on')
set(handles.mip_plot_panel,'Visible','off')
drawnow
[w_concept_dists_p w_concept_dists_f w_phi_concepts p_concept_dists_p p_concept_dists_f parts_phi_concepts] = plot_PHI_Cut_concepts(subset, partition1, get(handles.BFCut_list,'Value'),...
handles.data.purviews_M{state_index},handles.data.concepts_M{state_index}, handles.data.small_phi_M{state_index},...
handles.data.concept_MIP_M{state_index}, handles.data.network);
plot_choices = get(handles.partition_plot_menu,'String');
plot_choice_index = get(handles.partition_plot_menu,'Value');
plot_choice = plot_choices{plot_choice_index};
%Larissa: it would be nice if we also had phi_back and phi_future for the
%cut system
all_phi = [w_phi_concepts; parts_phi_concepts];
%Larissa: Now here not in IF statement cause for oneShape I need both
unconstrained_p = comp_pers_cpt(handles.data.network.nodes,[],subset,handles.data.network.current_state,'backward',[],handles.data.network.past_state);
unconstrained_f = comp_pers_cpt(handles.data.network.nodes,[],subset,handles.data.network.current_state,'forward',[],handles.data.network.past_state);
unconstrained_p = unconstrained_p(:);
unconstrained_f = unconstrained_f(:);
if get(handles.past_future_list,'Value') == 1
all_concepts = [w_concept_dists_p'; p_concept_dists_p'];
unconstrained = unconstrained_p;
else
all_concepts = [w_concept_dists_f'; p_concept_dists_f'];
unconstrained = unconstrained_f;
end
%Larissa: For the moment all (Before it was only the ones that still exist)
part_purviews = handles.data.purviews_M{state_index}{subset_index};
% options for plot view
% 3D & 2D Scatter - Variance
% 3D Scatter - Variance
% 3D Scatter - PCA (unavail)
% 2D Scatter - Variance
% Concept Bar Graphs
% reset panel position
set(handles.mip_plot_panel,'Position',[0.14600231749710313,0.01160541586073501,0.8122827346465816,0.9052224371373307]);
dim_choices = get(handles.state_selection_menu,'String');
dim_choice = dim_choices{get(handles.state_selection_menu,'Value')};
plot_choice = 'One Shape'; %Larissa
% display chosen plot view
if strcmp(plot_choice,'3D & 2D Scatter')
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor','white');
else
panel = handles.mip_plot_panel;
end
set(handles.partition_panel_slider,'Visible','off')
conceptscatter3D2D(all_concepts,size(w_concept_dists_p,2), handles.data.purviews_M{state_index}{subset_index},...
part_purviews, highlight_indices, panel, '2D3D', dim_choice, all_phi, unconstrained);
handles.export_plot = 0;
guidata(handles.iit_explorer,handles);
elseif strcmp(plot_choice,'3D Scatter')
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor',[0.9294 0.9294 0.9294]);
else
panel = handles.mip_plot_panel;
end
set(handles.partition_panel_slider,'Visible','off')
conceptscatter3D2D(all_concepts,size(w_concept_dists_p,2), handles.data.purviews_M{state_index}{subset_index},...
part_purviews, highlight_indices, panel, '3D',dim_choice, all_phi, unconstrained);
handles.export_plot = 0;
guidata(handles.iit_explorer,handles);
elseif strcmp(plot_choice,'One Shape')
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor',[0.9294 0.9294 0.9294]);
else
panel = handles.mip_plot_panel;
end
set(handles.partition_panel_slider,'Visible','off')
plotQualiaOneShape(w_concept_dists_p, w_concept_dists_f, p_concept_dists_p, p_concept_dists_f, size(w_concept_dists_p,2), handles.data.purviews_M{state_index}{subset_index},...
part_purviews, highlight_indices, panel, dim_choice, all_phi, [unconstrained_p' unconstrained_f']);
handles.export_plot = 0;
guidata(handles.iit_explorer,handles);
% figure_handle = figure(999);
% my_panel = uipanel('Parent',figure_handle);
% set(handles.partition_panel_slider,'Visible','off')
% conceptscatter3D2D(all_concepts,size(w_concept_dists_p,2), handles.data.purviews_M{state_index}{subset_index},...
% part_purviews, highlight_indices, my_panel, '3D',dim_choice);
elseif strcmp(plot_choice,'2D Scatter')
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor',[0.9294 0.9294 0.9294]);
else
panel = handles.mip_plot_panel;
end
set(handles.partition_panel_slider,'Visible','off')
conceptscatter3D2D(all_concepts,size(w_concept_dists_p,2), handles.data.purviews_M{state_index}{subset_index},...
part_purviews, highlight_indices, panel, '2D',dim_choice, all_phi);
handles.export_plot = 0;
guidata(handles.iit_explorer,handles);
elseif strcmp(plot_choice,'Concept Bar Graphs')
if handles.export_plot
figure_handle = figure;
panel = uipanel('Parent',figure_handle);
set(handles.export_plot_button,'BackgroundColor',[0.9294 0.9294 0.9294]);
else
panel = handles.mip_plot_panel;
end
set(handles.partition_panel_slider,'Visible','on')
plot_partition_bar(all_concepts,size(w_concept_dists_p,2), w_phi_concepts, parts_phi_concepts,...
highlight_indices, panel, handles.data.purviews_M{state_index}{subset_index},...
part_purviews, handles.data.Big_phi_MIP_all_M{state_index}{subset_index}(partition_index,1));
set(handles.partition_panel_slider,'Value',1.0)
handles.export_plot = 0;
guidata(handles.iit_explorer,handles);
end
% linkdata on
set(handles.mip_loading_text,'Visible','off')
set(handles.mip_plot_panel,'Visible','on')
function [partition_p1 partition1_index partition_p2 partition2_index] = get_partitions(handles)
subset = handles.data.subset; subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
partition_index = get(handles.partition_list,'Value');
partition_p1 = handles.data.complex_MIP_all_M{state_index}{subset_index}{partition_index};
partition1_index = convi(partition_p1) - 1;
partition_p2 = pick_rest(subset,partition_p1);
partition2_index = convi(partition_p2) - 1;
% --- Executes on selection change in state_list.
function state_list_Callback(hObject, eventdata, handles)
% hObject handle to state_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns state_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from state_list
% --- Executes during object creation, after setting all properties.
function state_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to state_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function panel_slider_Callback(hObject, eventdata, handles)
% hObject handle to panel_slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
shift = get(hObject,'Value');
position = get(handles.overview_axes_panel,'Position');
position(2) = (1 - position(4))*shift;
set(handles.overview_axes_panel,'Position',position)
% --- Executes during object creation, after setting all properties.
function panel_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to panel_slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in mip_button.
function mip_button_Callback(hObject, eventdata, handles)
% hObject handle to mip_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
subset = handles.data.subset; subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
select_MIP(handles, subset, state_index, subset_index)
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes on button press in partition_plot_refresh.
function partition_plot_refresh_Callback(hObject, eventdata, handles)
% hObject handle to partition_plot_refresh (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
plot_partition(handles)
set(handles.partition_plot_refresh,'BackgroundColor',[.9294 .9294 .9294])
% --- Executes on button press in clear_purview_list.
function clear_purview_list_Callback(hObject, eventdata, handles)
% hObject handle to clear_purview_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.purviews_list,'Value',[]);
% plot_partition(handles)
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes on selection change in past_future_list.
function past_future_list_Callback(hObject, eventdata, handles)
% hObject handle to past_future_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns past_future_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from past_future_list
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes during object creation, after setting all properties.
function past_future_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to past_future_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in output_concepts_list.
function output_concepts_list_Callback(hObject, eventdata, handles)
% hObject handle to output_concepts_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns output_concepts_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from output_concepts_list
% --- Executes during object creation, after setting all properties.
function output_concepts_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to output_concepts_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in output_concepts.
function output_concepts_Callback(hObject, eventdata, handles)
% hObject handle to output_concepts (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
concept_indices = get(handles.output_concepts_list,'Value');
subset = handles.data.subset; subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
concept_count = length(get(handles.output_concepts_list,'String'))/2;
for i = 1:length(concept_indices)
concept_names = cellstr(get(handles.output_concepts_list,'String'));
name = concept_names{concept_indices(i)};
name = ['purview_' mod_mat2str(subset) '_' name];
name(name == '[') = [];
name(name == ']') = [];
name(name == ' ') = [];
if concept_indices(i) <= concept_count
assignin('base',name,handles.data.concepts_M{state_index}{subset_index,1}{concept_indices(i)}{1})
else
assignin('base',name,handles.data.concepts_M{state_index}{subset_index,1}{concept_indices(i)-concept_count}{2})
end
end
% Larissa: This doesn't work right now
%plot_partition(handles);
function [subset subset_index state_index] = get_subset_and_state(handles)
[subset subset_index] = get_subset(handles);
state_index = get_state_index(handles);
function [subset subset_index] = get_subset(handles)
subset = get(handles.nodes_list,'Value');
subset_index = convi(subset) - 1;
% make sure we don't return the empty set:
if subset_index == 0; subset_index = 1; end
% --- Executes on selection change in partition_plot_menu.
function partition_plot_menu_Callback(hObject, eventdata, handles)
% hObject handle to partition_plot_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns partition_plot_menu contents as cell array
% contents{get(hObject,'Value')} returns selected item from partition_plot_menu
set(handles.partition_plot_refresh,'BackgroundColor','g')
if any(get(hObject,'Value') == [1 2 3])
set(handles.state_selection_menu,'Visible','on')
else
set(handles.state_selection_menu,'Visible','off')
end
% --- Executes during object creation, after setting all properties.
function partition_plot_menu_CreateFcn(hObject, eventdata, handles)
% hObject handle to partition_plot_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function update_purviews_list(handles)
subset_index = handles.data.subset_index;
state_index = handles.data.state_index;
[ignore_var partition1_index ignore_var partition2_index] = get_partitions(handles);
%Larissa: For the moment show all, even the partitioned with phi = 0
num_concepts_whole = length(handles.data.purviews_M{state_index}{subset_index,1});
%num_concepts_part1 = length(handles.data.purviews_M{state_index}{partition1_index,1});
%num_concepts_part2 = length(handles.data.purviews_M{state_index}{partition2_index,1});
%num_concepts = num_concepts_whole + num_concepts_part1 + num_concepts_part2;
num_concepts = 2*num_concepts_whole;
concept_names = cell(num_concepts,1);
for i = 1:num_concepts_whole
concept_names{i} = [mod_mat2str(handles.data.purviews_M{state_index}{subset_index}{i}) '_whole'];
end
for i = 1:num_concepts_whole
concept_names{num_concepts_whole+i} = [mod_mat2str(handles.data.purviews_M{state_index}{subset_index}{i}) '_part'];
end
% for i = num_concepts_whole + 1 : num_concepts_whole + num_concepts_part1
% concept_names{i} = [mod_mat2str(handles.data.purviews_M{state_index}{partition1_index}{i-num_concepts_whole}) '_part1'];
% end
%
% for i = num_concepts_whole + num_concepts_part1 + 1:num_concepts
% concept_names{i} = [mod_mat2str(handles.data.purviews_M{state_index}{partition2_index}{i-num_concepts_part1-num_concepts_whole}) '_part1'];
% end
set(handles.purviews_list,'String',concept_names)
set(handles.purviews_list,'Value',[]);
% --- Executes on slider movement.
function partition_panel_slider_Callback(hObject, eventdata, handles)
% hObject handle to partition_panel_slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
shift = get(hObject,'Value');
position = get(handles.mip_plot_panel,'Position');
position(2) = (1 - position(4))*shift;
set(handles.mip_plot_panel,'Position',position)
% --- Executes during object creation, after setting all properties.
function partition_panel_slider_CreateFcn(hObject, eventdata, handles)
% hObject handle to partition_panel_slider (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on selection change in state_selection_menu.
function state_selection_menu_Callback(hObject, eventdata, handles)
% hObject handle to state_selection_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns state_selection_menu contents as cell array
% contents{get(hObject,'Value')} returns selected item from state_selection_menu
set(handles.partition_plot_refresh,'BackgroundColor','g')
% --- Executes during object creation, after setting all properties.
function state_selection_menu_CreateFcn(hObject, eventdata, handles)
% hObject handle to state_selection_menu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in export_plot_button.
function export_plot_button_Callback(hObject, eventdata, handles)
% hObject handle to export_plot_button (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.export_plot
handles.export_plot = 0;
set(hObject,'BackgroundColor',[.9294 .9294 .9294])
else
handles.export_plot = 1;
set(hObject,'BackgroundColor','red')
end
guidata(gcf,handles);
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on selection change in BFCut_list.
function BFCut_list_Callback(hObject, eventdata, handles)
% hObject handle to BFCut_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns BFCut_list contents as cell array
% contents{get(hObject,'Value')} returns selected item from BFCut_list
% --- Executes during object creation, after setting all properties.
function BFCut_list_CreateFcn(hObject, eventdata, handles)
% hObject handle to BFCut_list (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end