{"action":"created","issue":{"url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/480","repository_url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb","labels_url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/480/labels{/name}","comments_url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/480/comments","events_url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/480/events","html_url":"https://github.com/NeurodataWithoutBorders/pynwb/issues/480","id":316889299,"number":480,"title":"dims check for auto-generated extension classes","user":{"login":"bendichter","id":844306,"avatar_url":"https://avatars0.githubusercontent.com/u/844306?v=4","gravatar_id":"","url":"https://api.github.com/users/bendichter","html_url":"https://github.com/bendichter","followers_url":"https://api.github.com/users/bendichter/followers","following_url":"https://api.github.com/users/bendichter/following{/other_user}","gists_url":"https://api.github.com/users/bendichter/gists{/gist_id}","starred_url":"https://api.github.com/users/bendichter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendichter/subscriptions","organizations_url":"https://api.github.com/users/bendichter/orgs","repos_url":"https://api.github.com/users/bendichter/repos","events_url":"https://api.github.com/users/bendichter/events{/privacy}","received_events_url":"https://api.github.com/users/bendichter/received_events","type":"User","site_admin":false},"labels":[{"id":661411412,"url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":661458004,"url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/labels/proposal","name":"proposal","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-23T16:32:17Z","updated_at":"2018-04-23T19:52:02Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I would like classes that are auto-generated by extensions to automatically check that dimensions with the same label across datasets have the same length. If they do not, either throw an error or a warning. For example, in the code below, `dset1` and `dset2` are in `DimsTest` and both have a dimension named `'cells'`. I would like it to be enforced that the lengths of these datasets must be equal. The code demonstrates that this is not currently the case, since there is no warning or error when I set `dset1=[0, 1, 2, 3], dset2=[0, 1, 2]`. I would prefer if this check occurred in the `__init__` of `NWBDataInterface`, as opposed to on write or in a separate validator.\r\n\r\n\r\n```python\r\nfrom datetime import datetime\r\n\r\nfrom pynwb.spec import (NWBGroupSpec, NWBDatasetSpec, NWBNamespaceBuilder)\r\nfrom pynwb import get_class, load_namespaces, NWBHDF5IO, NWBFile\r\n\r\n\r\nproject_name = 'dims_test'\r\nns_path = project_name + '.namespace.yaml'\r\next_source = project_name + '.extensions.yaml'\r\nns_builder = NWBNamespaceBuilder(project_name, project_name)\r\n\r\ndatasets = [\r\n    NWBDatasetSpec(doc='dset1', dtype='uint32',shape=(None,),\r\n                   name='dset1', dims=('cells',)),\r\n    NWBDatasetSpec(doc='dset2', dtype='uint64', shape=(None,),\r\n                   name='dset2', dims=('cells',))\r\n]\r\n\r\ncont_data = NWBGroupSpec(doc='data',\r\n                         datasets=datasets,\r\n                         neurodata_type_inc='NWBDataInterface',\r\n                         neurodata_type_def='DimsTest')\r\n\r\nns_builder.add_spec(ext_source, cont_data)\r\nns_builder.export(ns_path)\r\n\r\n##\r\n\r\nload_namespaces(ns_path)\r\nDimsTest = get_class('DimsTest', project_name)\r\n\r\ndims_test = DimsTest(name='name', source='source', dset1=[0, 1, 2, 3], dset2=[0, 1, 2])\r\n\r\nnwbfile = NWBFile(source='source', session_description='session_description',\r\n                  identifier='identifier', session_start_time=datetime.now(),\r\n                  file_create_date=datetime.now())\r\n\r\nmodule = nwbfile.create_processing_module(name='name',\r\n                                          source='source',\r\n                                          description='description')\r\nmodule.add_container(dims_test)\r\n\r\nwith NWBHDF5IO('dims_test.nwb', mode='w') as io:\r\n    io.write(nwbfile)\r\n```\r\n\r\n## Checklist\r\n\r\n- [x] Have you ensured the feature or change was not already [reported](https://github.com/NeurodataWithoutBorders/pynwb/issues/) ?\r\n- [x] Have you included a brief and descriptive title?\r\n- [x] Have you included a clear description of the problem you are trying to solve?\r\n- [x] Have you included a minimal code snippet that reproduces the issue you are encountering?\r\n"},"comment":{"url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/comments/383701003","html_url":"https://github.com/NeurodataWithoutBorders/pynwb/issues/480#issuecomment-383701003","issue_url":"https://api.github.com/repos/NeurodataWithoutBorders/pynwb/issues/480","id":383701003,"user":{"login":"bendichter","id":844306,"avatar_url":"https://avatars0.githubusercontent.com/u/844306?v=4","gravatar_id":"","url":"https://api.github.com/users/bendichter","html_url":"https://github.com/bendichter","followers_url":"https://api.github.com/users/bendichter/followers","following_url":"https://api.github.com/users/bendichter/following{/other_user}","gists_url":"https://api.github.com/users/bendichter/gists{/gist_id}","starred_url":"https://api.github.com/users/bendichter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendichter/subscriptions","organizations_url":"https://api.github.com/users/bendichter/orgs","repos_url":"https://api.github.com/users/bendichter/repos","events_url":"https://api.github.com/users/bendichter/events{/privacy}","received_events_url":"https://api.github.com/users/bendichter/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T19:52:02Z","updated_at":"2018-04-23T19:52:02Z","author_association":"CONTRIBUTOR","body":"OK fair enough, you might run into this issue with `'time'` if you had two different `TimeSeries` objects with different sampling rates in the same extension class.\r\n\r\nI agree, if this requires changes to the schema language it's clearly a 2.x issue."}}
{"actor":{"display_login":"bendichter"}}