Skip to content

Commit efbd30e

Browse files
committed
Rename readYAML to readYAMLfile
Avoid confusion with the existing readYAMLmodel, which reads cobra- format model YAMLs specifically. The two functions now form a clear pair: readYAMLfile for arbitrary YAML documents, readYAMLmodel for the model schema. Updates the function name, its docstring + error identifiers, and the single call site in core/applyCondition.m.
1 parent 6807467 commit efbd30e

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

core/applyCondition.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
% Inputs:
1717
% model RAVEN model struct.
1818
% condition Either a path to a YAML condition file or a struct
19-
% already produced by readYAML. The expected schema
19+
% already produced by readYAMLfile. The expected schema
2020
% (all keys optional):
2121
%
2222
% prelude:
@@ -46,10 +46,10 @@
4646
% model Modified model.
4747
%
4848
% Usage: model = applyCondition(model, 'data/conditions/anaerobic.yml')
49-
% model = applyCondition(model, readYAML('data/conditions/anaerobic.yml'))
49+
% model = applyCondition(model, readYAMLfile('data/conditions/anaerobic.yml'))
5050

5151
if ischar(condition) || isstring(condition)
52-
cond = readYAML(char(condition));
52+
cond = readYAMLfile(char(condition));
5353
elseif isstruct(condition)
5454
cond = condition;
5555
else

io/readYAML.m renamed to io/readYAMLfile.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function out = readYAML(filename)
2-
% readYAML
1+
function out = readYAMLfile(filename)
2+
% readYAMLfile
33
% Read an arbitrary YAML file into a MATLAB struct / cell tree.
44
%
55
% Use this for parsing arbitrary YAML configuration / data files
@@ -27,16 +27,16 @@
2727
% py.bool -> logical
2828
% py.None -> []
2929
%
30-
% Usage: cfg = readYAML('data/conditions/anaerobic.yml')
30+
% Usage: cfg = readYAMLfile('data/conditions/anaerobic.yml')
3131

3232
if ~isfile(filename)
33-
error('readYAML:fileNotFound', 'File not found: %s', filename);
33+
error('readYAMLfile:fileNotFound', 'File not found: %s', filename);
3434
end
3535

3636
try
3737
py.importlib.import_module('yaml');
3838
catch ME
39-
error('readYAML:pyyamlMissing', ...
39+
error('readYAMLfile:pyyamlMissing', ...
4040
['pyyaml is required to read arbitrary YAML files. Install it ' ...
4141
'in your MATLAB-linked Python environment (`pip install pyyaml`).' ...
4242
'\nUnderlying error: %s'], ME.message);

0 commit comments

Comments
 (0)