Skip to content

Commit 27758f2

Browse files
authored
Merge pull request #40 from RodentDataAnalytics/mwm-ml-gen-beta
merge beta version
2 parents 9026253 + 1651ec3 commit 27758f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1915
-330
lines changed

check/check_cached_objects.m

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function path = check_cached_objects( obj, choice )
1+
function path = check_cached_objects( obj, choice, varargin )
22
%CHECK_CACHED_OBJECTS finds if the new object exists in the cache (output)
33
%folder. If not it saves it.
44

@@ -25,7 +25,9 @@
2525
path = strcat(path,'/',files(i).name);
2626
break;
2727
end
28-
end
28+
end
29+
case 3 % a lot of config_segments files
30+
continue;
2931
end
3032
end
3133

@@ -46,7 +48,11 @@
4648
classification_configs = obj;
4749
save(strcat(path,'/','classification_configs_',time),'classification_configs');
4850
path = strcat(path,'/','classification_configs_',time,'.mat');
49-
end
51+
case 3 % a lot of config_segments files
52+
segmentation_configs = obj;
53+
save(strcat(path,'/','segmentation_configs_',num2str(varargin{1,1})),'segmentation_configs');
54+
path = strcat(path,'/','segmentation_configs_',num2str(varargin{1,1}),'.mat');
55+
end
5056
end
5157
end
5258

check/check_tags.m

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
function result = check_tags(ABBREVIATION,DESCRIPTION,WEIGHT,data,varargin)
2+
%CHECK_TAGS checks if tag's properties are correct:
3+
4+
%ABBREVIATION, DESCRIPTION = unique, non-empty
5+
%WEIGHT = integer, non-empty
6+
7+
8+
result = 0;
9+
%Do not check for dublicates (edit)
10+
if ~isempty(varargin)
11+
if isempty(ABBREVIATION)
12+
errordlg('Abbreviation cannot be empty','Error');
13+
return;
14+
elseif isempty(DESCRIPTION)
15+
errordlg('Name cannot be empty','Error');
16+
return;
17+
elseif isempty(WEIGHT)
18+
errordlg('Weight cannot be empty','Error');
19+
return;
20+
elseif isempty(str2num(WEIGHT))
21+
errordlg('Weight needs to have an interger value','Error');
22+
return;
23+
else
24+
result = 1;
25+
return;
26+
end
27+
end
28+
29+
%Do full check
30+
%Abbrevistion (non-empty, unique)
31+
if isempty(ABBREVIATION)
32+
errordlg('Abbreviation cannot be empty','Error');
33+
return;
34+
else
35+
for i = 2:size(data,1)
36+
if isequal(ABBREVIATION,data{i,1})
37+
errordlg('Abbreviation already exists','Error');
38+
return;
39+
end
40+
end
41+
end
42+
%Description (non-empty, unique)
43+
if isempty(DESCRIPTION)
44+
errordlg('Name cannot be empty','Error');
45+
return;
46+
else
47+
for i = 2:size(data,1)
48+
if isequal(DESCRIPTION,data{i,2})
49+
errordlg('Name already exists','Error');
50+
return;
51+
end
52+
end
53+
end
54+
%Weight (non-empty, numeric)
55+
if isempty(WEIGHT)
56+
errordlg('Weight cannot be empty','Error');
57+
return;
58+
elseif isempty(str2num(WEIGHT))
59+
errordlg('Weight needs to have an interger value','Error');
60+
return;
61+
end
62+
63+
result = 1;
64+
65+
end
66+

check/check_user_feedback.m

+17-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ function user_feedback( sanity_table, switcher )
9696
elseif ~sanity_table(3)
9797
errordlg('Number of clusters. Field needs to contain an integer equal or bigger than 10','Input Error');
9898
end
99-
99+
100+
case 4
101+
% Path Errors
102+
if ~sanity_table(1)
103+
errordlg('Specify a correct folder path for Trajectory Data. The specified folder should also contain as many subfolders as the available sessions');
104+
elseif ~sanity_table(2)
105+
errordlg('Rec Time Field. Field needs to contain the recorded time field name as specified in the csv file','Input Error');
106+
elseif ~sanity_table(3)
107+
errordlg('X Field. Field needs to contain the X coordinates field name as specified in the csv file','Input Error');
108+
elseif ~sanity_table(4)
109+
errordlg('Y Field. Field needs to contain the Y coordinates field name as specified in the csv file','Input Error');
110+
elseif ~sanity_table(5)
111+
errordlg('Arena radius. Field needs to contain a numerical value','Input Error');
112+
elseif ~sanity_table(6)
113+
errordlg('X Centre. Field needs to contain a numerical value','Input Error');
114+
elseif ~sanity_table(7)
115+
errordlg('Y Centre. Field needs to contain a numerical value','Input Error');
100116
end
101117
end

check/check_user_input.m

+31-2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
i = i+1;
106106
catch ME
107107
sanity_table(i+9) = 0;
108+
i = i+1;
108109
end
109110
end
110111
% checkboxes
@@ -264,8 +265,36 @@
264265
end
265266
catch
266267
sanity_table(3) = 0;
267-
end
268-
end
268+
end
269+
270+
case 4
271+
%% Plugin: calibration %%
272+
% path
273+
if exist(user_input{1,1}{1}, 'dir') == 7
274+
sanity_table(1) = 1;
275+
end
276+
% file format
277+
for i = 1:3
278+
if ~isempty(user_input{1,2}{i})
279+
sanity_table(i+1) = 1;
280+
end
281+
end
282+
% experiment properties
283+
i = 1;
284+
while i<4
285+
try
286+
c = str2num(user_input{1,2}{i+3});
287+
if ~isempty(c)
288+
sanity_table(i+4) = 1;
289+
end
290+
i = i+1;
291+
catch ME
292+
sanity_table(i+4) = 0;
293+
i = i+1;
294+
end
295+
end
296+
297+
end
269298

270299
%% Outcome %%
271300
check_user_feedback(sanity_table,switcher);

clustering/clustering_results.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -701,16 +701,18 @@ function compress(inst)
701701
end
702702
end
703703

704-
function [out] = combine(inst, other_results, varargin)
704+
function [out] = combine(inst, other_results, feat_len_1, feat_len, varargin)
705705
% current segment in the original set
706706
% trajectory
707-
addpath(fullfile(fileparts(mfilename('fullpath')), '/extern'));
708707
[tolerance] = process_options(varargin, ...
709708
'SegmentTolerance', 20);
710709

711-
mapping = inst.segments.match_segments(other_results.segments, 'Tolerance', tolerance);
712-
tag_mapping = tag.mapping(inst.classes, other_results.classes);
713-
710+
mapping = inst.segments.match_segments(other_results.segments, feat_len_1, feat_len, 'Tolerance', tolerance);
711+
%tag_mapping = tag.mapping(inst.classes, other_results.classes);
712+
tag_mapping = zeros(1,length(inst.classes));
713+
for i = 1:length(tag_mapping)
714+
tag_mapping(i) = inst.classes{1,1}{1,3};
715+
end
714716
new_map = inst.class_map;
715717
for k = 1:inst.segments.count
716718
if mapping(k) > 0

configs/configs.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VARIABLE,VALUE,COMMENT
2+
FontName,Arial,figures and export
3+
FontSize,12,figures and export
4+
LineWidth,0.5,figures and export
5+
Export,.jpg,export
6+
ExportStyle,Low Quality,export

configs/configs_default.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VARIABLE,VALUE,COMMENT
2+
FontName,Arial,figures and export
3+
FontSize,12,figures and export
4+
LineWidth,0.5,figures and export
5+
Export,.jpg,export
6+
ExportStyle,Low Quality,export

configs/figure_configs.fig

29.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)