Skip to content

Commit 929ba2f

Browse files
author
Lawrence
committed
Merge branch 'schema_2.2.1'
2 parents 4998690 + a55cd19 commit 929ba2f

File tree

111 files changed

+3571
-889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3571
-889
lines changed

+file/Dataset.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
end
7676
end
7777

78+
if source.isKey('required')
79+
obj.required = strcmp(source('required'), 'true');
80+
end
81+
7882
obj.isConstrainedSet = ~isempty(obj.type) && ~obj.scalar;
7983

8084
boundsKey = 'dims';

+file/fillClass.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,15 @@
5454
depnm = namespace.getFullClassName(parentName);
5555
end
5656

57+
if isa(processed, 'file.Group')
58+
classTag = 'types.untyped.GroupClass';
59+
else
60+
classTag = 'types.untyped.DatasetClass';
61+
end
62+
5763
%% return classfile string
5864
classDef = [...
59-
'classdef ' name ' < ' depnm newline... %header, dependencies
65+
'classdef ' name ' < ' depnm ' & ' classTag newline... %header, dependencies
6066
'% ' upper(name) ' ' class.doc]; %name, docstr
6167
propgroups = {...
6268
@()file.fillProps(classprops, readonly, 'SetAccess=protected')...

+file/fillExport.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
bodystr = [bodystr {'fullpath = '''';'}];
1919
end
2020

21-
for i=1:length(propnames)
21+
for i = 1:length(propnames)
2222
pnm = propnames{i};
2323
pathProps = traverseRaw(pnm, raw);
2424
prop = pathProps{end};
2525
elideProps = pathProps(1:end-1);
2626

2727
%Construct elisions
2828
elisions = cell(length(elideProps),1);
29-
for j=1:length(elideProps)
29+
for j = 1:length(elideProps)
3030
elisions{j} = elideProps{j}.name;
3131
end
3232

+tests/+system/DynamicTableTest.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
classdef DynamicTableTest < tests.system.RoundTripTest & tests.system.AmendTest
22
methods
33
function addContainer(~, file)
4-
start_time = types.core.VectorData(...
4+
start_time = types.hdmf_common.VectorData(...
55
'description', 'start_time',...
66
'data', 1:100);
7-
stop_time = types.core.VectorData(...
7+
stop_time = types.hdmf_common.VectorData(...
88
'description', 'stop_time',...
99
'data', 2:200);
1010
colnames = {'start_time', 'stop_time', 'randomvalues'};
11-
id = types.core.ElementIdentifiers(...
11+
id = types.hdmf_common.ElementIdentifiers(...
1212
'data', 1:100);
1313

14-
randcol = types.core.VectorData(...
14+
randcol = types.hdmf_common.VectorData(...
1515
'description', 'random data to be indexed into',...
1616
'data', rand(500,1));
17-
randidx = types.core.VectorIndex(...
17+
randidx = types.hdmf_common.VectorIndex(...
1818
'target', types.untyped.ObjectView('/intervals/trials/randomvalues'),...
1919
'data', 5:5:500 - 1);
2020

@@ -37,7 +37,7 @@ function appendContainer(testCase, file)
3737
container.data = rand(500, 1); % new random values.
3838
file.intervals_trials.colnames{end+1} = 'newcolumn';
3939
file.intervals_trials.vectordata.set('newcolumn',...
40-
types.core.VectorData(...
40+
types.hdmf_common.VectorData(...
4141
'description', 'newly added column',...
4242
'data', 100:-1:1));
4343
end

+tests/+system/ElectricalSeriesIOTest.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ function addContainer(testCase, file) %#ok<INUSL>
1717
'location', 'tetrode location', ...
1818
'device', devlink);
1919

20-
ettable = types.core.DynamicTable(...
20+
ettable = types.hdmf_common.DynamicTable(...
2121
'colnames', {'x', 'y', 'z', 'imp', 'location', 'filtering', 'group', 'group_name'},...
22-
'id', types.core.ElementIdentifiers('data', 1:4),...
23-
'x', types.core.VectorData('data', ones(4,1),...
22+
'id', types.hdmf_common.ElementIdentifiers('data', 1:4),...
23+
'x', types.hdmf_common.VectorData('data', ones(4,1),...
2424
'description', 'the x coordinate of the channel location'),...
25-
'y', types.core.VectorData('data', repmat(2, 4, 1),...
25+
'y', types.hdmf_common.VectorData('data', repmat(2, 4, 1),...
2626
'description', 'the y coordinate of the channel location'),...
27-
'z', types.core.VectorData('data', repmat(3, 4, 1),...
27+
'z', types.hdmf_common.VectorData('data', repmat(3, 4, 1),...
2828
'description', 'the z coordinate of the channel location'),...
29-
'imp', types.core.VectorData('data', ones(4,1),...
29+
'imp', types.hdmf_common.VectorData('data', ones(4,1),...
3030
'description', 'the impedance of the channel'),...
31-
'location', types.core.VectorData('data', repmat({'CA1'},4,1),...
31+
'location', types.hdmf_common.VectorData('data', repmat({'CA1'},4,1),...
3232
'description', 'the location of channel within the subject e.g. brain region'),...
33-
'filtering', types.core.VectorData('data', repmat({'none'},4,1),...
33+
'filtering', types.hdmf_common.VectorData('data', repmat({'none'},4,1),...
3434
'description', 'description of hardware filtering'),...
35-
'group', types.core.VectorData('data', repmat(eglink,4,1),...
35+
'group', types.hdmf_common.VectorData('data', repmat(eglink,4,1),...
3636
'description', 'a reference to the ElectrodeGroup this electrodes is a part of'),...
37-
'group_name', types.core.VectorData('data', repmat({egnm},4,1),...
37+
'group_name', types.hdmf_common.VectorData('data', repmat({egnm},4,1),...
3838
'description', 'name of the ElectrodeGroup this electrode is a part of'),...
3939
'description', 'electrodes'...
4040
);
@@ -45,7 +45,7 @@ function addContainer(testCase, file) %#ok<INUSL>
4545
'data', [0:9;10:19], ...
4646
'timestamps', (0:9) .', ...
4747
'electrodes', ...
48-
types.core.DynamicTableRegion(...
48+
types.hdmf_common.DynamicTableRegion(...
4949
'data', [0;2],...
5050
'table', etReg,...
5151
'description', 'the first and third electrodes'));

+tests/+system/ImagingPlaneIOTest.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function addContainer(testCase, file) %#ok<INUSL>
1212
'excitation_lambda', 6.28, ...
1313
'imaging_rate', 2.718, ...
1414
'indicator', 'GFP', ...
15-
'location', 'somewhere in the brain');
15+
'location', 'somewhere in the brain',...
16+
'grid_spacing', []);
1617
file.general_devices.set('imaging_device_1', dev);
1718
file.general_optophysiology.set('imgpln1', ip);
1819
end

+tests/+system/NwbTestInterface.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ function setupClass(testCase)
1616
methods (TestMethodSetup)
1717
function setupMethod(testCase)
1818
testCase.applyFixture(matlab.unittest.fixtures.WorkingFolderFixture);
19-
generateCore(fullfile(testCase.root, ...
20-
'nwb-schema', 'core', 'nwb.namespace.yaml'));
19+
schemaPath = fullfile(testCase.root, 'nwb-schema');
20+
21+
generateCore(...
22+
fullfile(schemaPath, 'hdmf-common-schema', 'common', 'namespace.yaml'),...
23+
fullfile(schemaPath, 'core', 'nwb.namespace.yaml'));
2124
testCase.file = NwbFile( ...
2225
'session_description', 'a test NWB File', ...
2326
'identifier', 'TEST123', ...
@@ -45,7 +48,8 @@ function verifyContainerEqual(testCase, actual, expected)
4548
val1 = actual.(prop);
4649
val2 = expected.(prop);
4750
failmsg = ['Values for property ''' prop ''' are not equal'];
48-
if startsWith(class(val1), 'types.core.')
51+
if startsWith(class(val1), 'types.')...
52+
&& ~startsWith(class(val1), 'types.untyped')
4953
verifyContainerEqual(testCase, val1, val2);
5054
elseif isa(val1, 'types.untyped.Set')
5155
verifySetEqual(testCase, val1, val2, failmsg);

+tests/+system/PyNWBIOTest.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import numpy.testing as npt
77
import h5py
88

9-
from pynwb import NWBContainer, get_manager, NWBFile, NWBData, TimeSeries
9+
from pynwb import get_manager, NWBFile, TimeSeries
1010
from pynwb.ecephys import ElectricalSeries, Clustering
1111
from pynwb.ophys import OpticalChannel, TwoPhotonSeries
1212
from hdmf.backends.hdf5 import HDF5IO
13+
from hdmf.container import Container, Data
1314

1415
class PyNWBIOTest(unittest.TestCase):
1516
def setUp(self):
@@ -62,10 +63,10 @@ def assertContainerEqual(self, container1, container2): # noqa: C901
6263
f2 = getattr(container2, nwbfield)
6364
if isinstance(f1, (tuple, list, np.ndarray)):
6465
if len(f1) > 0:
65-
if isinstance(f1[0], NWBContainer):
66+
if isinstance(f1[0], Container):
6667
for sub1, sub2 in zip(f1, f2):
6768
self.assertContainerEqual(sub1, sub2)
68-
elif isinstance(f1[0], NWBData):
69+
elif isinstance(f1[0], Data):
6970
for sub1, sub2 in zip(f1, f2):
7071
self.assertDataEqual(sub1, sub2)
7172
continue
@@ -78,21 +79,21 @@ def assertContainerEqual(self, container1, container2): # noqa: C901
7879
self.assertAlmostEqual(v1, v2, places=6)
7980
else:
8081
self.assertTrue(np.array_equal(f1, f2))
81-
elif isinstance(f1, dict) and len(f1) and isinstance(next(iter(f1.values())), NWBContainer):
82+
elif isinstance(f1, dict) and len(f1) and isinstance(next(iter(f1.values())), Container):
8283
f1_keys = set(f1.keys())
8384
f2_keys = set(f2.keys())
8485
self.assertSetEqual(f1_keys, f2_keys)
8586
for k in f1_keys:
8687
with self.subTest(module_name=k):
8788
self.assertContainerEqual(f1[k], f2[k])
88-
elif isinstance(f1, NWBContainer):
89+
elif isinstance(f1, Container) or isinstance(f1, Container):
8990
self.assertContainerEqual(f1, f2)
90-
elif isinstance(f1, NWBData) or isinstance(f2, NWBData):
91-
if isinstance(f1, NWBData) and isinstance(f2, NWBData):
91+
elif isinstance(f1, Data) or isinstance(f2, Data):
92+
if isinstance(f1, Data) and isinstance(f2, Data):
9293
self.assertDataEqual(f1, f2)
93-
elif isinstance(f1, NWBData):
94+
elif isinstance(f1, Data):
9495
self.assertTrue(np.array_equal(f1.data, f2))
95-
elif isinstance(f2, NWBData):
96+
elif isinstance(f2, Data):
9697
self.assertTrue(np.array_equal(f1.data, f2))
9798
else:
9899
if isinstance(f1, (float, np.float32, np.float16, h5py.Dataset)):

+tests/+system/UnitTimesIOTest.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
methods
33
function addContainer(~, file)
44
vdata = rand(10,1);
5-
vd = types.core.VectorData('data', vdata, 'description', 'descr');
5+
vd = types.hdmf_common.VectorData('data', vdata, 'description', 'descr');
66

77
spike_loc = '/units/spike_times';
88
vd_ref = [...
99
types.untyped.RegionView(spike_loc, 1),...
1010
types.untyped.RegionView(spike_loc, 2:5),...
1111
types.untyped.RegionView(spike_loc, 9:10)...
1212
];
13-
vi = types.core.VectorIndex('data', vd_ref,...
13+
vi = types.hdmf_common.VectorIndex('data', vd_ref,...
1414
'target', types.untyped.ObjectView(spike_loc));
15-
ei = types.core.ElementIdentifiers('data', 1:3);
15+
ei = types.hdmf_common.ElementIdentifiers('data', 1:3);
1616
file.units = types.core.Units(...
1717
'colnames', {'spike_times'},...
1818
'description', 'test Units',...

+tests/+system/smokeTest.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function testSmokeInstantiateCore(testCase)
3535
function testSmokeReadWrite(testCase)
3636
epochs = types.core.TimeIntervals(...
3737
'colnames', {'id' 'start_time' 'stop_time'} .',...
38-
'id', types.core.ElementIdentifiers('data', 1),...
38+
'id', types.hdmf_common.ElementIdentifiers('data', 1),...
3939
'description', 'test TimeIntervals',...
40-
'start_time', types.core.VectorData('data', 0, 'description', 'start time'),...
41-
'stop_time', types.core.VectorData('data', 1, 'description', 'stop time'));
40+
'start_time', types.hdmf_common.VectorData('data', 0, 'description', 'start time'),...
41+
'stop_time', types.hdmf_common.VectorData('data', 1, 'description', 'stop time'));
4242
file = NwbFile('identifier', 'st', 'session_description', 'smokeTest', ...
4343
'session_start_time', datetime, 'intervals_epochs', epochs,...
4444
'timestamps_reference_time', datetime);

0 commit comments

Comments
 (0)