How to use the hdmf.build.ReferenceBuilder function in hdmf

To help you get started, we’ve selected a few hdmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / test_ecephys.py View on Github external
'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('z', data=[3.0, 3.0, 3.0, 3.0],
                           attributes={'description': 'the z coordinate of the channel location',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('imp', data=[-1.0, -2.0, -3.0, -4.0],
                           attributes={'description': 'the impedance of the channel',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('location', data=['CA1', 'CA1', 'CA1', 'CA1'],
                           attributes={'description': 'the location of channel within the subject e.g. brain region',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('filtering', data=['none', 'none', 'none', 'none'],
                           attributes={'description': 'description of hardware filtering',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('group', data=[ReferenceBuilder(self.eg_builder),
                                          ReferenceBuilder(self.eg_builder),
                                          ReferenceBuilder(self.eg_builder),
                                          ReferenceBuilder(self.eg_builder)],
                           attributes={'description': 'a reference to the ElectrodeGroup this electrode is a part of',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
            DatasetBuilder('group_name', data=['tetrode1', 'tetrode1', 'tetrode1', 'tetrode1'],
                           attributes={'description': 'the name of the ElectrodeGroup this electrode is a part of',
                                       'neurodata_type': 'VectorData', 'namespace': 'core'}),
        ]
        return GroupBuilder('electrodes', datasets={d.name: d for d in datasets},
                            attributes={'colnames': (b'x',
                                                     b'y',
                                                     b'z',
                                                     b'imp',
                                                     b'location',
                                                     b'filtering',
                                                     b'group',
                                                     b'group_name'),
github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / test_ophys.py View on Github external
'format': DatasetBuilder('format', 'tiff'),
                                                 'dimension': DatasetBuilder('dimension', [2]),
                                                 })

        self.pixel_masks_builder = DatasetBuilder('pixel_mask', self.pix_mask,
                                                  attributes={
                                                   'namespace': 'core',
                                                   'neurodata_type': 'VectorData',
                                                   'description': 'Pixel masks for each ROI',
                                                   'help': 'Values for a list of elements'})

        self.pxmsk_index_builder = DatasetBuilder('pixel_mask_index', self.pxmsk_index,
                                                  attributes={
                                                   'namespace': 'core',
                                                   'neurodata_type': 'VectorIndex',
                                                   'target': ReferenceBuilder(self.pixel_masks_builder),
                                                   'help': 'indexes into a list of values for a list of elements'})

        self.image_masks_builder = DatasetBuilder('image_mask', self.img_mask,
                                                  attributes={
                                                   'namespace': 'core',
                                                   'neurodata_type': 'VectorData',
                                                   'description': 'Image masks for each ROI',
                                                   'help': 'Values for a list of elements'})

        ps_builder = GroupBuilder(
            'test_plane_seg_name',
            attributes={
                'neurodata_type': 'PlaneSegmentation',
                'namespace': 'core',
                'description': 'plane segmentation description',
                'colnames': (b'image_mask', b'pixel_mask'),
github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / test_ecephys.py View on Github external
'description': 'no description',
                                       'neurodata_type': 'ElectricalSeries'},
                           datasets={'data': data_builder,
                                     'timestamps': timestamps_builder,
                                     'electrodes': elec_builder})
        data = list(zip(reversed(range(10)), reversed(range(10, 20))))

        data_builder = DatasetBuilder('data', data,
                                      attributes={'unit': 'volts',
                                                  'conversion': 1.0,
                                                  'resolution': 0.0})
        timestamps_builder = DatasetBuilder('timestamps', timestamps, attributes={'unit': 'seconds', 'interval': 1})
        elec_builder = DatasetBuilder('electrodes', data=[1, 3],
                                      attributes={'neurodata_type': 'DynamicTableRegion',
                                                  'namespace': 'core',
                                                  'table': ReferenceBuilder(table_builder),
                                                  'description': 'the second and fourth electrodes'})
        es2 = GroupBuilder('test_eS2',
                           attributes={'namespace': base.CORE_NAMESPACE,
                                       'comments': 'no comments',
                                       'description': 'no description',
                                       'neurodata_type': 'ElectricalSeries'},
                           datasets={'data': data_builder,
                                     'timestamps': timestamps_builder,
                                     'electrodes': elec_builder})
        return es1, es2
github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / test_ophys.py View on Github external
'help': ('ROI responses over an imaging plane. Each element on the second dimension of data[] '
                         'should correspond to the signal from one ROI')},
            datasets={
                'data': DatasetBuilder(
                    'data', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
                    attributes={
                        'unit': 'lumens',
                        'conversion': 1.0,
                        'resolution': 0.0}
                ),
                'timestamps': DatasetBuilder('timestamps', [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
                                             attributes={'unit': 'Seconds', 'interval': 1}),
                'rois': DatasetBuilder('rois', data=[0],
                                       attributes={'help': 'a subset (i.e. slice or region) of a DynamicTable',
                                                   'description': 'the first of two ROIs',
                                                   'table': ReferenceBuilder(ps_builder),
                                                   'namespace': 'core',
                                                   'neurodata_type': 'DynamicTableRegion'}),
            })
github NeurodataWithoutBorders / pynwb / tests / integration / ui_write / test_ecephys.py View on Github external
def setUpBuilder(self):
        table_builder = self.get_table_builder(self)
        data = list(zip(range(10), range(10, 20)))
        timestamps = list(map(lambda x: x/10, range(10)))

        data_builder = DatasetBuilder('data', data,
                                      attributes={'unit': 'volts',
                                                  'conversion': 1.0,
                                                  'resolution': 0.0})
        timestamps_builder = DatasetBuilder('timestamps', timestamps, attributes={'unit': 'seconds', 'interval': 1})
        elec_builder = DatasetBuilder('electrodes', data=[0, 2],
                                      attributes={'neurodata_type': 'DynamicTableRegion',
                                                  'namespace': 'core',
                                                  'table': ReferenceBuilder(table_builder),
                                                  'description': 'the first and third electrodes'})
        return GroupBuilder('test_eS',
                            attributes={'namespace': base.CORE_NAMESPACE,
                                        'comments': 'no comments',
                                        'description': 'no description',
                                        'neurodata_type': 'ElectricalSeries'},
                            datasets={'data': data_builder,
                                      'timestamps': timestamps_builder,
                                      'electrodes': elec_builder})