Skip to content

Commit d7fe607

Browse files
committed
[Dimensions] hide optional arguments for now
1 parent 9a26367 commit d7fe607

File tree

4 files changed

+40
-32
lines changed

4 files changed

+40
-32
lines changed

+nix/DataArray.m

+9-29
Original file line numberDiff line numberDiff line change
@@ -135,69 +135,49 @@
135135
% Example: dim = currDataArray.appendSetDimension();
136136
%
137137
% See also nix.SetDimension.
138-
138+
139139
fname = strcat(obj.alias, '::appendSetDimension');
140140
h = nix_mx(fname, obj.nixhandle);
141141
r = nix.Utils.createEntity(h, @nix.SetDimension);
142142
end
143143

144-
function r = appendSampledDimension(obj, interval, label, unit, offset)
144+
function r = appendSampledDimension(obj, interval)
145145
% Append a new SampledDimension as last entry to the list of
146146
% existing dimension descriptors of the invoking DataArray.
147147
%
148148
% Used to describe the regularly sampled dimension of data.
149149
%
150150
% interval (double): The sampling interval of the Dimension to create.
151-
% label (string): The label used for the described axis, default empty.
152-
% unit (string): The unit of the axis, default empty.
153-
% offset (double): The offset of the dimension, default 0.0.
154151
%
155152
% Returns: (nix.SampledDimension) The newly created SampledDimension.
156153
%
157154
% Example: stepSize = 5;
158-
% label = "time";
159-
% unit = "s";
160-
% offset = 1.0;
161-
% dim = currDataArray.appendSampledDimension(stepSize, label, unit, offset);
155+
%
156+
% dim = currDataArray.appendSampledDimension(stepSize);
162157
%
163158
% See also nix.SampledDimension.
164-
if nargin < 3
165-
label = "";
166-
end
167-
if nargin < 4
168-
unit = "";
169-
end
170-
if nargin < 5
171-
offset = 0.0;
172-
end
159+
173160
fname = strcat(obj.alias, '::appendSampledDimension');
174-
h = nix_mx(fname, obj.nixhandle, interval, label, unit, offset);
161+
h = nix_mx(fname, obj.nixhandle, interval);
175162
r = nix.Utils.createEntity(h, @nix.SampledDimension);
176163
end
177164

178-
function r = appendRangeDimension(obj, ticks, label, unit)
165+
function r = appendRangeDimension(obj, ticks)
179166
% Append a new SampledDimension as last entry to the list of
180167
% existing dimension descriptors of the invoking DataArray.
181168
%
182169
% Used to describe the irregularly sampled dimension of data.
183170
%
184171
% ticks ([double]): The ticks of the RangeDimension.
185-
% label (string): The label used to describe this dimension, default empty
186-
% unit (string): The unit of the ticks stored in this dimsension, default empty
187172
%
188173
% Returns: (nix.RangeDimension) The newly created RangeDimension.
189174
%
190175
% Example: dim = currDataArray.appendRangeDimension([1 10 21 15]);
191176
%
192177
% See also nix.SampledDimension.
193-
if nargin < 3
194-
label = "";
195-
end
196-
if nargin < 4
197-
unit = "";
198-
end
178+
199179
fname = strcat(obj.alias, '::appendRangeDimension');
200-
h = nix_mx(fname, obj.nixhandle, ticks, label, unit);
180+
h = nix_mx(fname, obj.nixhandle, ticks);
201181
r = nix.Utils.createEntity(h, @nix.RangeDimension);
202182
end
203183

nix_mx.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ void mexFunction(int nlhs,
242242
.add("openDimensionIdx", nixdataarray::openDimensionIdx)
243243
.add("compare", nixdataarray::compare)
244244
.add("sourcesFiltered", nixdataarray::sourcesFiltered)
245+
.add("appendSampledDimension", nixdataarray::arrayAppendSampledDimension)
246+
.add("appendSetDimension", nixdataarray::arrayAppendSetDimension)
247+
.add("appendRangeDimension", nixdataarray::arrayAppendRangeDimension)
245248
.reg("sources", IDATAARRAY(std::vector<nix::Source>, EntityWithSources, std::function<bool(const nix::Source &)>, sources, const))
246249
.reg("openMetadataSection", IDATAARRAY(nix::Section, EntityWithMetadata, , metadata, const))
247250
.reg("setMetadata", IDATAARRAY(void, EntityWithMetadata, const std::string&, metadata, ))
@@ -257,10 +260,10 @@ void mexFunction(int nlhs,
257260
.reg("setNoneExpansionOrigin", SETTER(boost::none_t, nix::DataArray, expansionOrigin))
258261
.reg("setNonePolynomCoefficients", SETTER(boost::none_t, nix::DataArray, polynomCoefficients))
259262
.reg("dimensions", FILTER(std::vector<nix::Dimension>, nix::DataArray, , dimensions))
260-
.reg("appendSetDimension", &nix::DataArray::appendSetDimension)
261-
.reg("appendRangeDimension", &nix::DataArray::appendRangeDimension)
263+
//.reg("appendSetDimension", &nix::DataArray::appendSetDimension)
264+
//.reg("appendRangeDimension", &nix::DataArray::appendRangeDimension)
262265
.reg("appendAliasRangeDimension", &nix::DataArray::appendAliasRangeDimension)
263-
.reg("appendSampledDimension", &nix::DataArray::appendSampledDimension)
266+
//.reg("appendSampledDimension", &nix::DataArray::appendSampledDimension)
264267
.reg("createSetDimension", &nix::DataArray::createSetDimension)
265268
.reg("createRangeDimension", &nix::DataArray::createRangeDimension)
266269
.reg("createAliasRangeDimension", &nix::DataArray::createAliasRangeDimension)

src/nixdataarray.cc

+19
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,23 @@ namespace nixdataarray {
185185
output.set(0, res);
186186
}
187187

188+
void arrayAppendSampledDimension(const extractor &input, infusor &output) {
189+
nix::DataArray currObj = input.entity<nix::DataArray>(1);
190+
double si = static_cast<double>(input.num<double>(2));
191+
nix::SampledDimension d = currObj.appendSampledDimension(si);
192+
output.set(0, d);
193+
}
194+
195+
void arrayAppendSetDimension(const extractor &input, infusor &output) {
196+
nix::DataArray currObj = input.entity<nix::DataArray>(1);
197+
nix::SetDimension d = currObj.appendSetDimension();
198+
output.set(0, d);
199+
}
200+
201+
void arrayAppendRangeDimension(const extractor &input, infusor &output) {
202+
nix::DataArray currObj = input.entity<nix::DataArray>(1);
203+
std::vector<double> ticks = input.vec<double>(2);
204+
nix::RangeDimension d = currObj.appendRangeDimension(ticks);
205+
output.set(0, d);
206+
}
188207
} // namespace nixdataarray

src/nixdataarray.h

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ namespace nixdataarray {
4949

5050
void sourcesFiltered(const extractor &input, infusor &output);
5151

52+
void arrayAppendSampledDimension(const extractor &input, infusor &output);
53+
54+
void arrayAppendRangeDimension(const extractor &input, infusor &output);
55+
56+
void arrayAppendSetDimension(const extractor &input, infusor &output);
57+
5258
} // namespace nixdataarray
5359

5460
#endif

0 commit comments

Comments
 (0)