-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from OSU-LRAM/Ross
Ross
- Loading branch information
Showing
326 changed files
with
5,246 additions
and
789 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function B = celltensorconvert(A) | ||
% Takes an NxMx... cell array of YxZx... arrays, and returns an YxZx... cell array of | ||
% NxMx.. arrays | ||
|
||
|
||
% Create a cell containing a matrix whose dimensions are taken from A | ||
new_cell = {zeros(size(A))}; | ||
|
||
% Replicate this cell to make a cell array whose dimensions are taken from | ||
% the contents of (the first value of) A | ||
B = repmat(new_cell,size(A{1})); | ||
|
||
for i = 1:numel(A) | ||
|
||
for j = 1:numel(B) | ||
|
||
B{j}(i) = A{i}(j); | ||
|
||
end | ||
|
||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...oolbox/fatbackbone_from_curvature_bases.m → ...oolbox/fatbackbone_from_curvature_bases.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lbox/fatbackbone_from_general_curvature.m → ...lbox/fatbackbone_from_general_curvature.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 8 additions & 2 deletions
10
...ies/curvature_mode_toolbox/make_curvdef.m → ...ies/curvature_mode_toolbox/make_curvdef.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
ProgramFiles/Utilities/curvature_mode_toolbox/triangle_wave_generator.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
function triangle_wave_matched = triangle_wave_generator | ||
|
||
% Generate a scale factor so that the maximum angle reached by the sin and | ||
% pinched sin basis functions is the same | ||
n = logspace(-1,1.5,100); | ||
|
||
x = linspace(0,pi/2); | ||
|
||
base_area = trapz(x,cos(x)); | ||
|
||
for idx = 1:numel(n) | ||
|
||
scale_factor(idx) = base_area/trapz(x,cos(x).^n(idx)); %#ok<AGROW> | ||
|
||
end | ||
|
||
P = polyfit(n,scale_factor,3); | ||
|
||
|
||
|
||
% Now generate the pinched sin function | ||
|
||
n=10; | ||
|
||
syms a1 a2 omega s | ||
|
||
% Wave with sin and cosine amplitudes | ||
raw_wave = (a1*cos(omega*2*pi*s)+a2*sin(omega*2*pi*s)); | ||
|
||
% Amplitude of the wave | ||
amp_wave = (a1^2+a2^2)^(.5); | ||
|
||
% Normalize the wave | ||
norm_wave = raw_wave/amp_wave; | ||
|
||
% Pinch the wave | ||
pinched_wave = (abs(norm_wave)^n) * sign(norm_wave); | ||
|
||
% Restore the scale of the wave | ||
pinched_wave_restored = pinched_wave*amp_wave; | ||
|
||
% Scale to match max angle with original wave | ||
triangle_wave_matched = pinched_wave_restored * (P*[n^3;n^2;n;1]); | ||
|
||
|
||
|
||
|
||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
function outCell=mat2tiles(inArray,varargin) | ||
%MAT2TILES - breaks up an array into a cell array of adjacent sub-arrays of | ||
% equal sizes | ||
% | ||
% C=mat2tiles(X,D1,D2,D3,...,Dn) | ||
% C=mat2tiles(X,[D1,D2,D3,...,Dn]) | ||
% | ||
%will produce a cell array C containing adjacent chunks of the array X, | ||
%with each chunk of dimensions D1xD2xD3x...xDn. If a dimensions Di does | ||
%not divide evenly into size(X,i), then the chunks at the upper boundary of | ||
%X along dimension i will be truncated. | ||
% | ||
%It is permissible for the Di to be given value Inf. When this is done, it is | ||
%equivalent to setting Di=size(X,i). | ||
% | ||
%If n < ndims(X), then the unspecified dimensions Dj, n<j<=ndims(X) will be | ||
%set to size(X,i). | ||
% | ||
%If n > ndims(X), the the extra dimensions Dj, j>ndims(X) will be ignored. | ||
% | ||
%EXAMPLE 1: Split a 28x28 matrix into 4x7 sub-matrices | ||
% | ||
% >> A=rand(28); C=mat2tiles(A,[4,7]) | ||
% | ||
% C = | ||
% | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% [4x7 double] [4x7 double] [4x7 double] [4x7 double] | ||
% | ||
%EXAMPLE 2: Split a 20x20x6 array into 20x6x3 sub-arrays. This example | ||
%illustrates how 'Inf' can be used to indicate that one of the sub-array | ||
%dimensions is to be the same as in the original array, in this case size(A,1)=20. | ||
% | ||
% | ||
% >> A=rand(20,20,6); | ||
% | ||
% >> C=mat2tiles(A,[Inf,6,3]) %equivalent to mat2tiles(A,[20,6,3]) | ||
% | ||
% C(:,:,1) = | ||
% | ||
% [20x6x3 double] [20x6x3 double] [20x6x3 double] [20x2x3 double] | ||
% | ||
% | ||
% C(:,:,2) = | ||
% | ||
% [20x6x3 double] [20x6x3 double] [20x6x3 double] [20x2x3 double] | ||
% | ||
%The example also shows a situation where the original array does not | ||
%divide evenly into sub-arrays of the specified size. Note therefore that | ||
%some boundary sub-chunks are 20x2x3. | ||
|
||
tileSizes=[varargin{:}]; | ||
|
||
N=length(tileSizes); | ||
|
||
Nmax=ndims(inArray); | ||
|
||
if N<Nmax | ||
|
||
tileSizes=[tileSizes,inf(1,Nmax-N)]; | ||
|
||
|
||
elseif N>Nmax | ||
|
||
tileSizes=tileSizes(1:Nmax); | ||
|
||
end | ||
N=Nmax; | ||
|
||
C=cell(1,N); | ||
|
||
for ii=1:N %loop over the dimensions | ||
|
||
dim=size(inArray,ii); | ||
T=min(dim, tileSizes(ii)); | ||
|
||
if T~=floor(T) || T<=0 | ||
error 'Tile dimension must be a strictly positive integer or Inf' | ||
end | ||
|
||
nn=( dim / T ); | ||
nnf=floor(nn); | ||
|
||
resid=[]; | ||
if nnf~=nn | ||
nn=nnf; | ||
resid=dim-T*nn; | ||
end | ||
|
||
C{ii}=[ones(1,nn)*T,resid]; | ||
|
||
|
||
end | ||
|
||
outCell=mat2cell(inArray,C{:}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function f = fourier_eval(x,AN,BN,T) | ||
% Evaluate a fourier function with coefficients AN and BN at points x for a | ||
% period T | ||
|
||
ii = (1:length(AN))-1; % The indices. (with zero-indexing) | ||
lgh = length(x); | ||
[ii x] = meshgrid(ii,x); % Arrays for angles. | ||
AN = repmat(AN',lgh,1); % Create arrays for approximation. | ||
BN = repmat(BN',lgh,1); | ||
theta = ii.*x.*(2*pi)/T; % The angles. | ||
f = (sum(AN.*cos(theta)+BN.*sin(theta),2))'; % the F approximation. | ||
|
||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function s = calc_stretch_functions(s) | ||
% Apply cartographic normalization to the shape space | ||
|
||
s.convert = fast_flatten_metric(s.grid.metric_display,s.metricfield.metric_display.content.metric); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
ProgramFiles/sys_calcsystem_fcns/ensure_connection_and_metric.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function s = ensure_connection_and_metric(s) | ||
|
||
% Currently, this program only ensures that there is a metric -- the | ||
% connection and metric denominators are now only calculated if explicitly | ||
% provided by the user. | ||
|
||
% Get the number of shape variables | ||
n_shape = nargin(s.A_num); | ||
shape_test_list = num2cell(ones(n_shape,1)); | ||
|
||
% % If there is no connection denominator, make it all ones | ||
% if ~isfield(s,'A_den') | ||
% | ||
% shape_test_list = num2cell(ones(n_shape,1)); | ||
% s.A_den = @(a,varargin) repmat(ones(size(s.A_num(shape_test_list{:}))),size(a)); | ||
% | ||
% end | ||
|
||
|
||
%Ensure presence of a metric and a metric denominator | ||
if ~isfield(s,'metric') | ||
|
||
s.metric = @(a,varargin) repmat(eye(size(shape_test_list,1)),size(a)); | ||
|
||
end | ||
|
||
% if ~isfield(s,'metric_den') | ||
% | ||
% s.metric_den = @(a,varargin) repmat(ones(size(shape_test_list,1)),size(a)); | ||
% | ||
% end | ||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
%Evaluate the connection over the fine grid for calculations and the coarse | ||
%grid for vector display | ||
function s = evaluate_connection(s) | ||
|
||
|
||
|
||
%list of all components of the local connection and metric that may be present | ||
component_list = {'A_num','A_den','B_ref_point',... | ||
'B_rot_add','B_rot_mult'}; | ||
|
||
|
||
% Evaluate all components in the list at the eval density | ||
|
||
s = evaluate_tensors_in_system_file(s,component_list,{'eval','eval'},'vecfield'); | ||
|
||
% resample the fields at a low density for vector field display | ||
s = resample_tensors_in_system_file(s,component_list,'eval',{'display','vector'},'vecfield'); | ||
|
||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
%Evaluate the connection over the fine grid for calculations and the coarse | ||
%grid for vector display | ||
function s = evaluate_metric(s) | ||
|
||
|
||
%list of all components of the local connection and metric that may be present | ||
component_list = {'metric','metric_den'}; | ||
|
||
|
||
% Evaluate all components in the list | ||
|
||
s = evaluate_tensors_in_system_file(s,component_list,{'metric_eval','metric_eval'},'metricfield'); | ||
|
||
% resample metric at a resolution appropriate for displaying as an | ||
% ellipse field | ||
s = resample_tensors_in_system_file(s,component_list,'metric_eval',{'metric_display','metric_display'},'metricfield'); | ||
|
||
|
||
end |
Oops, something went wrong.