|
1 | 1 | classdef Device < types.core.NWBContainer & types.untyped.GroupClass |
2 | | -% DEVICE - Metadata about a data acquisition device, e.g., recording system, electrode, microscope. |
| 2 | +% DEVICE - Metadata about a specific instance of a data acquisition device, e.g., recording system, electrode, microscope. Link to a DeviceModel.model to represent information about the model of the device. |
3 | 3 | % |
4 | 4 | % Required Properties: |
5 | 5 | % None |
|
8 | 8 | % OPTIONAL PROPERTIES |
9 | 9 | properties |
10 | 10 | 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. |
11 | | - manufacturer; % (char) The name of the manufacturer of the device, e.g., Imec, Plexon, Thorlabs. |
12 | | - model_name; % (char) The model name of the device, e.g., Neuropixels 1.0, V-Probe, Bergamo III. |
13 | | - 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. |
| 11 | + manufacturer; % (char) DEPRECATED. The name of the manufacturer of the device, e.g., Imec, Plexon, Thorlabs. Instead of using this field, store the value in DeviceModel.manufacturer and link to that DeviceModel from this Device. |
| 12 | + model; % DeviceModel |
| 13 | + model_name; % (char) DEPRECATED. The model name of the device, e.g., Neuropixels 1.0, V-Probe, Bergamo III. Instead of using this field, create and add a new DeviceModel named the model name and link to that DeviceModel from this Device. |
| 14 | + model_number; % (char) DEPRECATED. 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. Instead of using this field, store the value in DeviceModel.model_number and link to that DeviceModel from this Device. |
14 | 15 | serial_number; % (char) The serial number of the device. |
15 | 16 | end |
16 | 17 |
|
|
26 | 27 | % Input Arguments (Name-Value Arguments): |
27 | 28 | % - 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. |
28 | 29 | % |
29 | | - % - manufacturer (char) - The name of the manufacturer of the device, e.g., Imec, Plexon, Thorlabs. |
| 30 | + % - manufacturer (char) - DEPRECATED. The name of the manufacturer of the device, e.g., Imec, Plexon, Thorlabs. Instead of using this field, store the value in DeviceModel.manufacturer and link to that DeviceModel from this Device. |
30 | 31 | % |
31 | | - % - model_name (char) - The model name of the device, e.g., Neuropixels 1.0, V-Probe, Bergamo III. |
| 32 | + % - model (DeviceModel) - The model of the device. |
32 | 33 | % |
33 | | - % - 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. |
| 34 | + % - model_name (char) - DEPRECATED. The model name of the device, e.g., Neuropixels 1.0, V-Probe, Bergamo III. Instead of using this field, create and add a new DeviceModel named the model name and link to that DeviceModel from this Device. |
| 35 | + % |
| 36 | + % - model_number (char) - DEPRECATED. 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. Instead of using this field, store the value in DeviceModel.model_number and link to that DeviceModel from this Device. |
34 | 37 | % |
35 | 38 | % - serial_number (char) - The serial number of the device. |
36 | 39 | % |
|
46 | 49 | p.StructExpand = false; |
47 | 50 | addParameter(p, 'description',[]); |
48 | 51 | addParameter(p, 'manufacturer',[]); |
| 52 | + addParameter(p, 'model',[]); |
49 | 53 | addParameter(p, 'model_name',[]); |
50 | 54 | addParameter(p, 'model_number',[]); |
51 | 55 | addParameter(p, 'serial_number',[]); |
52 | 56 | misc.parseSkipInvalidName(p, varargin); |
53 | 57 | obj.description = p.Results.description; |
54 | 58 | obj.manufacturer = p.Results.manufacturer; |
| 59 | + obj.model = p.Results.model; |
55 | 60 | obj.model_name = p.Results.model_name; |
56 | 61 | obj.model_number = p.Results.model_number; |
57 | 62 | obj.serial_number = p.Results.serial_number; |
|
67 | 72 | function set.manufacturer(obj, val) |
68 | 73 | obj.manufacturer = obj.validate_manufacturer(val); |
69 | 74 | end |
| 75 | + function set.model(obj, val) |
| 76 | + obj.model = obj.validate_model(val); |
| 77 | + end |
70 | 78 | function set.model_name(obj, val) |
71 | 79 | obj.model_name = obj.validate_model_name(val); |
72 | 80 | end |
|
86 | 94 | val = types.util.checkDtype('manufacturer', 'char', val); |
87 | 95 | types.util.validateShape('manufacturer', {[1]}, val) |
88 | 96 | end |
| 97 | + function val = validate_model(obj, val) |
| 98 | + if isa(val, 'types.untyped.SoftLink') |
| 99 | + if isprop(val, 'target') |
| 100 | + types.util.checkDtype('model', 'types.core.DeviceModel', val.target); |
| 101 | + end |
| 102 | + else |
| 103 | + val = types.util.checkDtype('model', 'types.core.DeviceModel', val); |
| 104 | + if ~isempty(val) |
| 105 | + val = types.untyped.SoftLink(val); |
| 106 | + end |
| 107 | + end |
| 108 | + end |
89 | 109 | function val = validate_model_name(obj, val) |
90 | 110 | val = types.util.checkDtype('model_name', 'char', val); |
91 | 111 | types.util.validateShape('model_name', {[1]}, val) |
|
110 | 130 | if ~isempty(obj.manufacturer) |
111 | 131 | io.writeAttribute(fid, [fullpath '/manufacturer'], obj.manufacturer); |
112 | 132 | end |
| 133 | + if ~isempty(obj.model) |
| 134 | + refs = obj.model.export(fid, [fullpath '/model'], refs); |
| 135 | + end |
113 | 136 | if ~isempty(obj.model_name) |
114 | 137 | io.writeAttribute(fid, [fullpath '/model_name'], obj.model_name); |
115 | 138 | end |
|
0 commit comments