-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathStatsSanityCheck.m
120 lines (95 loc) · 3.73 KB
/
StatsSanityCheck.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
%% Sanity Checks
% Explore some simple numeric datasets to prove to ourselves that the code
% is working.
%% Delta Structure
% A delta structure is a sufficient criteria to create a heterogenous
% image.
structure = zeros( 5 );
structure( ceil( numel( structure )/2 ) ) = 1;
[F, xx] = SpatialStatsFFT( structure, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true);
clc;
% Print the iamge
disp( 'Image' )
disp( structure )
% Print the spatial statistics
disp( 'Spatial Statistics' )
disp( [ NaN xx{1};
xx{2}' F ] )
%% Vertical Structure
% A simple veritical line in the image because we can compute it by hand.
vertical = zeros( 5 );
vertical(:,ceil(size(vertical,2)./2) ) = 1;
[F, xx] = SpatialStatsFFT( vertical, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true);
clc;
disp( 'Image' )
disp( vertical )
disp( 'Spatial Statistics' )
disp( [ NaN xx{1};
xx{2}' F ] )
%% Perturbed Vertical Structure
% A simple veritical line in the image because we can compute it by hand.
vertical1 = vertical;
vertical1( 2, : ) = 0;
[Fnp, xx] = SpatialStatsFFT( vertical1, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true, ...
'periodic', false );
[Fp, xx] = SpatialStatsFFT( vertical1, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true, ...
'periodic', true );
clc;
disp( 'Image' )
disp( vertical1 )
disp( 'Spatial Statistics :: Non-Periodic' )
disp( [ NaN xx{1};
xx{2}' Fnp ] )
disp( '(Special Case) Spatial Statistics :: Periodic' )
disp( [ NaN xx{1};
xx{2}' Fp ] )
%% Diagonal Structure
% Let's wander over to Flatland.
dgnl = diag( ones(1,5) );% diagonal is a reserved word everywhere in the world.
[Fnp, xx] = SpatialStatsFFT( dgnl, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true, ...
'periodic', false );
[Fp, xx] = SpatialStatsFFT( dgnl, [], ... Autocorrelation of the ones ``1``'s in ``structure``
'display', false, ...
'shift', true, ...
'periodic', true );
clc;
disp( 'Image' )
disp( dgnl )
disp( 'Spatial Statistics :: Non-Periodic' )
disp( [ NaN xx{1};
xx{2}' Fnp ] )
disp( '(Special Case) Spatial Statistics :: Periodic' )
disp( [ NaN xx{1};
xx{2}' Fp ] )
%% Cross-Correlations!!
% Now we're gonna mix it up, woop woop!
[Fnp, xx] = SpatialStatsFFT( dgnl, vertical1, ... Autocorrelation of the ones ``1``'s in ``dgnl`` + ``vertical1``
'display', false, ...
'shift', true, ...
'periodic', false );
[Fp, xx] = SpatialStatsFFT( dgnl, vertical1, ... Crosscorrelation of the ones ``1``'s in ``dgnl`` + ``vertical1``
'display', false, ...
'shift', true, ...
'periodic', true );
clc;
disp( 'Image :: Head' )
disp( vertical1 )
disp( 'Image :: Tail' )
disp( dgnl )
disp( 'Spatial Statistics :: Non-Periodic' )
disp( [ NaN xx{1};
xx{2}' Fnp ] )
disp( '(Special Case) Spatial Statistics :: Periodic' )
disp( [ NaN xx{1};
xx{2}' Fp ] )
%% End Sanity Check