-
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.
- Loading branch information
Showing
194 changed files
with
13,385 additions
and
12,981 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
*.mlx -crlf -diff -merge | ||
*.mat -crlf -diff -merge | ||
*.fig -crlf -diff -merge | ||
*.p -crlf -diff -merge | ||
*.slx -crlf -diff -merge | ||
*.mdl -crlf -diff -merge | ||
*.mdlp -crlf -diff -merge | ||
*.slxp -crlf -diff -merge | ||
*.sldd -crlf -diff -merge | ||
*.mexa64 -crlf -diff -merge | ||
*.mexw64 -crlf -diff -merge | ||
*.mexmaci64 -crlf -diff -merge | ||
*.xlsx -crlf -diff -merge | ||
*.docx -crlf -diff -merge | ||
*.pdf -crlf -diff -merge | ||
*.jpg -crlf -diff -merge | ||
*.mlx -crlf -diff -merge | ||
*.mat -crlf -diff -merge | ||
*.fig -crlf -diff -merge | ||
*.p -crlf -diff -merge | ||
*.slx -crlf -diff -merge | ||
*.mdl -crlf -diff -merge | ||
*.mdlp -crlf -diff -merge | ||
*.slxp -crlf -diff -merge | ||
*.sldd -crlf -diff -merge | ||
*.mexa64 -crlf -diff -merge | ||
*.mexw64 -crlf -diff -merge | ||
*.mexmaci64 -crlf -diff -merge | ||
*.xlsx -crlf -diff -merge | ||
*.docx -crlf -diff -merge | ||
*.pdf -crlf -diff -merge | ||
*.jpg -crlf -diff -merge | ||
*.png -crlf -diff -merge |
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
function[dims] = char2dims( dimChar ) | ||
% Converts a comma delimited character array of dimension names to string | ||
dims = ""; | ||
if ~isempty(dimChar) | ||
comma = strfind(dimChar, ','); | ||
nDims = numel(comma) + 1; | ||
dims = cell(1, nDims); | ||
|
||
start = [1, comma+1]; | ||
stop = [comma-1, numel(dimChar)]; | ||
|
||
for d = 1:nDims | ||
dims{d} = dimChar( start(d):stop(d) ); | ||
end | ||
|
||
dims = string( dims ); | ||
end | ||
|
||
function[dims] = char2dims( dimChar ) | ||
% Converts a comma delimited character array of dimension names to string | ||
dims = ""; | ||
if ~isempty(dimChar) | ||
comma = strfind(dimChar, ','); | ||
nDims = numel(comma) + 1; | ||
dims = cell(1, nDims); | ||
|
||
start = [1, comma+1]; | ||
stop = [comma-1, numel(dimChar)]; | ||
|
||
for d = 1:nDims | ||
dims{d} = dimChar( start(d):stop(d) ); | ||
end | ||
|
||
dims = string( dims ); | ||
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
function[dimChar] = dims2char( dims ) | ||
% Converts a string array of dimension names to a comma delimited char | ||
dimChar = ''; | ||
if ~isempty(dims) | ||
dimChar = char(dims(1)); | ||
for k = 2:numel(dims) | ||
dimChar = [dimChar,',',char(dims(k))]; %#ok<AGROW> | ||
end | ||
end | ||
function[dimChar] = dims2char( dims ) | ||
% Converts a string array of dimension names to a comma delimited char | ||
dimChar = ''; | ||
if ~isempty(dims) | ||
dimChar = char(dims(1)); | ||
for k = 2:numel(dims) | ||
dimChar = [dimChar,',',char(dims(k))]; %#ok<AGROW> | ||
end | ||
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
function[siz] = fullSize( siz, d ) | ||
%% This gets the size of an array through a minumum number of dimensions. | ||
% | ||
% siz = fullSize( siz, d ) | ||
% Pads a size vector with trailing singletons through a minimum of d dimensions. | ||
% | ||
% ----- Inputs ----- | ||
% | ||
% siz: A size vector | ||
% | ||
% d: The minimum number of dimensions. | ||
% | ||
% ----- Outputs ----- | ||
% | ||
% siz: The size of the array. | ||
|
||
% ----- Written By ----- | ||
% Jonathan King, University of Arizona, 2019 | ||
|
||
% Get the size | ||
nDim = numel(siz); | ||
siz(nDim+1:d) = 1; | ||
|
||
function[siz] = fullSize( siz, d ) | ||
%% This gets the size of an array through a minumum number of dimensions. | ||
% | ||
% siz = fullSize( siz, d ) | ||
% Pads a size vector with trailing singletons through a minimum of d dimensions. | ||
% | ||
% ----- Inputs ----- | ||
% | ||
% siz: A size vector | ||
% | ||
% d: The minimum number of dimensions. | ||
% | ||
% ----- Outputs ----- | ||
% | ||
% siz: The size of the array. | ||
|
||
% ----- Written By ----- | ||
% Jonathan King, University of Arizona, 2019 | ||
|
||
% Get the size | ||
nDim = numel(siz); | ||
siz(nDim+1:d) = 1; | ||
|
||
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 |
---|---|---|
@@ -1,49 +1,49 @@ | ||
classdef (Abstract) gridData | ||
% Defines an interface for data structures that are placed in a | ||
% gridFile container object. | ||
|
||
properties | ||
dimOrder; % The order of dimensions in the gridded dataset | ||
size; % The size of the gridded dataset | ||
mergeSet; % Maps the merged dimensions back onto unmerged dimensions | ||
unmergedSize; % Size without any squashed dimensions | ||
merge; % Indicates which dimensions should be merged | ||
end | ||
|
||
% Interface methods | ||
methods (Abstract = true) | ||
% Reads data from the data structure | ||
[X] = read( obj, scs ); | ||
end | ||
|
||
% Static Utilities | ||
methods (Static) | ||
% Removes trailing singletons from a size vector | ||
siz = squeezeSize( siz ); | ||
|
||
% Returns a list of numeric types | ||
[types] = numericTypes | ||
|
||
% Get the size up to n dimensions | ||
[siz] = fullSize( siz, d ) | ||
|
||
% Initial processing of merged dimensions | ||
[umSize, mSize, uniqDim, merge, mergeSet] = processSourceDims( dimOrder, iSize ) | ||
|
||
% Actually merge data dimension | ||
[X] = mergeDims( X, merge ) | ||
|
||
% Convert string array of dimensions to comma delimited char | ||
dimChar = dims2char( dims ); | ||
|
||
% Convert comma delimietd char to string array of dimensions | ||
dims = char2dims( dimChar ); | ||
end | ||
|
||
methods | ||
% Adjust SCS and keep for merged | ||
[fullSCS, keep] = unmergeSCS( obj, scs ) | ||
end | ||
|
||
end | ||
classdef (Abstract) gridData | ||
% Defines an interface for data structures that are placed in a | ||
% gridFile container object. | ||
|
||
properties | ||
dimOrder; % The order of dimensions in the gridded dataset | ||
size; % The size of the gridded dataset | ||
mergeSet; % Maps the merged dimensions back onto unmerged dimensions | ||
unmergedSize; % Size without any squashed dimensions | ||
merge; % Indicates which dimensions should be merged | ||
end | ||
|
||
% Interface methods | ||
methods (Abstract = true) | ||
% Reads data from the data structure | ||
[X] = read( obj, scs ); | ||
end | ||
|
||
% Static Utilities | ||
methods (Static) | ||
% Removes trailing singletons from a size vector | ||
siz = squeezeSize( siz ); | ||
|
||
% Returns a list of numeric types | ||
[types] = numericTypes | ||
|
||
% Get the size up to n dimensions | ||
[siz] = fullSize( siz, d ) | ||
|
||
% Initial processing of merged dimensions | ||
[umSize, mSize, uniqDim, merge, mergeSet] = processSourceDims( dimOrder, iSize ) | ||
|
||
% Actually merge data dimension | ||
[X] = mergeDims( X, merge ) | ||
|
||
% Convert string array of dimensions to comma delimited char | ||
dimChar = dims2char( dims ); | ||
|
||
% Convert comma delimietd char to string array of dimensions | ||
dims = char2dims( dimChar ); | ||
end | ||
|
||
methods | ||
% Adjust SCS and keep for merged | ||
[fullSCS, keep] = unmergeSCS( obj, scs ) | ||
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
function[X] = mergeDims( X, merge ) | ||
|
||
% For each set of merged dimension | ||
mergeSet = unique( merge(~isnan(merge)) ); | ||
dimIndex = 1:numel(merge); | ||
for m = 1:numel(mergeSet) | ||
|
||
% Get the dimensions being merged and permute to front | ||
dims = ( mergeSet(m) == merge ); | ||
permOrder = [dimIndex(dims), dimIndex(~dims)]; | ||
X = permute( X, permOrder ); | ||
|
||
% Reshape the merged dims. Replace secondary dimensions with singletons | ||
% to preserve dimension order | ||
siz = size(X); | ||
nMerge = sum(dims); | ||
X = reshape( X, [prod(siz(1:nMerge)), ones(1,nMerge-1), siz(nMerge+1:end)] ); | ||
|
||
% Unpermute | ||
[~, unorder] = sort( permOrder ); | ||
X = permute( X, unorder ); | ||
end | ||
|
||
% Remove the merged singletons | ||
X = squeeze(X); | ||
|
||
end | ||
|
||
function[X] = mergeDims( X, merge ) | ||
|
||
% For each set of merged dimension | ||
mergeSet = unique( merge(~isnan(merge)) ); | ||
dimIndex = 1:numel(merge); | ||
for m = 1:numel(mergeSet) | ||
|
||
% Get the dimensions being merged and permute to front | ||
dims = ( mergeSet(m) == merge ); | ||
permOrder = [dimIndex(dims), dimIndex(~dims)]; | ||
X = permute( X, permOrder ); | ||
|
||
% Reshape the merged dims. Replace secondary dimensions with singletons | ||
% to preserve dimension order | ||
siz = size(X); | ||
nMerge = sum(dims); | ||
X = reshape( X, [prod(siz(1:nMerge)), ones(1,nMerge-1), siz(nMerge+1:end)] ); | ||
|
||
% Unpermute | ||
[~, unorder] = sort( permOrder ); | ||
X = permute( X, unorder ); | ||
end | ||
|
||
% Remove the merged singletons | ||
X = squeeze(X); | ||
|
||
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
function[types] = numericTypes | ||
% Returns a list of matlab numeric types. | ||
|
||
types = ["single";"double";"int8";"uint8";"int16";"uint16";"int32";"uint32";... | ||
"int64";"uint64"]; | ||
|
||
function[types] = numericTypes | ||
% Returns a list of matlab numeric types. | ||
|
||
types = ["single";"double";"int8";"uint8";"int16";"uint16";"int32";"uint32";... | ||
"int64";"uint64"]; | ||
|
||
end |
Oops, something went wrong.