-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into change/improve-type-validator-error-message
- Loading branch information
Showing
38 changed files
with
4,495 additions
and
940 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
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
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
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
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
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,3 +1,3 @@ | ||
hdf5plugin | ||
git+https://github.com/NeurodataWithoutBorders/nwbinspector@dev | ||
git+https://github.com/NeurodataWithoutBorders/pynwb.git@dev | ||
git+https://github.com/NeurodataWithoutBorders/nwbinspector.git@dev | ||
git+https://github.com/NeurodataWithoutBorders/pynwb.git@dev |
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 |
---|---|---|
|
@@ -4,8 +4,11 @@ | |
|
||
% OPTIONAL PROPERTIES | ||
properties | ||
description; % (char) Description of the device (e.g., model, firmware version, processing software version, etc.) as free-form text. | ||
manufacturer; % (char) The name of the manufacturer of the device. | ||
description; % (char) Description of the device as free-form text. If there is any software/firmware associated with the device, the names and versions of those can be added to NWBFile.was_generated_by. | ||
manufacturer; % (char) The name of the manufacturer of the device, e.g., Imec, Plexon, Thorlabs. | ||
model_name; % (char) The model name of the device, e.g., Neuropixels 1.0, V-Probe, Bergamo III. | ||
model_number; % (char) The model number (or part/product number) of the device, e.g., PRB_1_4_0480_1, PLX-VP-32-15SE(75)-(260-80)(460-10)-300-(1)CON/32m-V, BERGAMO. | ||
serial_number; % (char) The serial number of the device. | ||
end | ||
|
||
methods | ||
|
@@ -20,9 +23,15 @@ | |
p.StructExpand = false; | ||
addParameter(p, 'description',[]); | ||
addParameter(p, 'manufacturer',[]); | ||
addParameter(p, 'model_name',[]); | ||
addParameter(p, 'model_number',[]); | ||
addParameter(p, 'serial_number',[]); | ||
misc.parseSkipInvalidName(p, varargin); | ||
obj.description = p.Results.description; | ||
obj.manufacturer = p.Results.manufacturer; | ||
obj.model_name = p.Results.model_name; | ||
obj.model_number = p.Results.model_number; | ||
obj.serial_number = p.Results.serial_number; | ||
if strcmp(class(obj), 'types.core.Device') | ||
cellStringArguments = convertContainedStringsToChars(varargin(1:2:end)); | ||
types.util.checkUnset(obj, unique(cellStringArguments)); | ||
|
@@ -35,6 +44,15 @@ | |
function set.manufacturer(obj, val) | ||
obj.manufacturer = obj.validate_manufacturer(val); | ||
end | ||
function set.model_name(obj, val) | ||
obj.model_name = obj.validate_model_name(val); | ||
end | ||
function set.model_number(obj, val) | ||
obj.model_number = obj.validate_model_number(val); | ||
end | ||
function set.serial_number(obj, val) | ||
obj.serial_number = obj.validate_serial_number(val); | ||
end | ||
%% VALIDATORS | ||
|
||
function val = validate_description(obj, val) | ||
|
@@ -73,6 +91,60 @@ | |
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_model_name(obj, val) | ||
val = types.util.checkDtype('model_name', 'char', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
else | ||
valsz = size(val); | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_model_number(obj, val) | ||
val = types.util.checkDtype('model_number', 'char', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
else | ||
valsz = size(val); | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_serial_number(obj, val) | ||
val = types.util.checkDtype('serial_number', 'char', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
else | ||
valsz = size(val); | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
%% EXPORT | ||
function refs = export(obj, fid, fullpath, refs) | ||
refs = [email protected](obj, fid, fullpath, refs); | ||
|
@@ -85,6 +157,15 @@ | |
if ~isempty(obj.manufacturer) | ||
io.writeAttribute(fid, [fullpath '/manufacturer'], obj.manufacturer); | ||
end | ||
if ~isempty(obj.model_name) | ||
io.writeAttribute(fid, [fullpath '/model_name'], obj.model_name); | ||
end | ||
if ~isempty(obj.model_number) | ||
io.writeAttribute(fid, [fullpath '/model_number'], obj.model_number); | ||
end | ||
if ~isempty(obj.serial_number) | ||
io.writeAttribute(fid, [fullpath '/serial_number'], obj.serial_number); | ||
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
methods | ||
function obj = IZeroClampSeries(varargin) | ||
% IZEROCLAMPSERIES Constructor for IZeroClampSeries | ||
varargin = [{'stimulus_description' 'N/A'} varargin]; | ||
varargin = [{'bias_current' types.util.correctType(0, 'single') 'bridge_balance' types.util.correctType(0, 'single') 'capacitance_compensation' types.util.correctType(0, 'single') 'stimulus_description' 'N/A'} varargin]; | ||
obj = [email protected](varargin{:}); | ||
|
||
|
||
|
@@ -33,58 +33,25 @@ | |
%% VALIDATORS | ||
|
||
function val = validate_bias_current(obj, val) | ||
val = types.util.checkDtype('bias_current', 'single', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
if isequal(val, 0) | ||
val = 0; | ||
else | ||
valsz = size(val); | ||
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''bias_current'' property of class ''<a href="matlab:doc types.core.IZeroClampSeries">IZeroClampSeries</a>'' because it is read-only.') | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_bridge_balance(obj, val) | ||
val = types.util.checkDtype('bridge_balance', 'single', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
if isequal(val, 0) | ||
val = 0; | ||
else | ||
valsz = size(val); | ||
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''bridge_balance'' property of class ''<a href="matlab:doc types.core.IZeroClampSeries">IZeroClampSeries</a>'' because it is read-only.') | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_capacitance_compensation(obj, val) | ||
val = types.util.checkDtype('capacitance_compensation', 'single', val); | ||
if isa(val, 'types.untyped.DataStub') | ||
if 1 == val.ndims | ||
valsz = [val.dims 1]; | ||
else | ||
valsz = val.dims; | ||
end | ||
elseif istable(val) | ||
valsz = [height(val) 1]; | ||
elseif ischar(val) | ||
valsz = [size(val, 1) 1]; | ||
if isequal(val, 0) | ||
val = 0; | ||
else | ||
valsz = size(val); | ||
error('NWB:Type:ReadOnlyProperty', 'Unable to set the ''capacitance_compensation'' property of class ''<a href="matlab:doc types.core.IZeroClampSeries">IZeroClampSeries</a>'' because it is read-only.') | ||
end | ||
validshapes = {[1]}; | ||
types.util.checkDims(valsz, validshapes); | ||
end | ||
function val = validate_stimulus_description(obj, val) | ||
if isequal(val, 'N/A') | ||
|
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
Oops, something went wrong.