def get_stimulus_table(self, stimulus_name):
        ''' Return a stimulus table given a stimulus name 
        
        Notes
        -----
        For more information, see:
        http://help.brain-map.org/display/observatory/Documentation?preview=/10616846/10813485/VisualCoding_VisualStimuli.pdf 

        '''

        if stimulus_name == 'master':
            return self._get_master_stimulus_table()

        with h5py.File(self.nwb_file, 'r') as nwb_file:

            stimulus_group = _find_stimulus_presentation_group(
                nwb_file, stimulus_name)

            if stimulus_name in self.STIMULUS_TABLE_TYPES[
                    'abstract_feature_series']:
                datasets = h5_utilities.load_datasets_by_relnames(
                    ['data', 'features', 'frame_duration'], nwb_file,
                    stimulus_group)
                return _make_abstract_feature_series_stimulus_table(
                    datasets['data'],
                    h5_utilities.decode_bytes(datasets['features']),
                    datasets['frame_duration'])

            if stimulus_name in self.STIMULUS_TABLE_TYPES[
                    'indexed_time_series']:
                datasets = h5_utilities.load_datasets_by_relnames(
                    ['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_indexed_time_series_stimulus_table(
                    datasets['data'], datasets['frame_duration'])

            if stimulus_name in self.STIMULUS_TABLE_TYPES[
                    'repeated_indexed_time_series']:
                datasets = h5_utilities.load_datasets_by_relnames(
                    ['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_repeated_indexed_time_series_stimulus_table(
                    datasets['data'], datasets['frame_duration'])

            if stimulus_name == 'spontaneous':
                datasets = h5_utilities.load_datasets_by_relnames(
                    ['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_spontaneous_activity_stimulus_table(
                    datasets['data'], datasets['frame_duration'])

        raise IOError("Could not find a stimulus table named '%s'" %
                      stimulus_name)
    def get_stimulus_table(self, stimulus_name):
        ''' Return a stimulus table given a stimulus name 
        
        Notes
        -----
        For more information, see:
        http://help.brain-map.org/display/observatory/Documentation?preview=/10616846/10813485/VisualCoding_VisualStimuli.pdf 

        '''

        if stimulus_name == 'master':
            return self._get_master_stimulus_table()

        with h5py.File(self.nwb_file, 'r') as nwb_file:

            stimulus_group = _find_stimulus_presentation_group(nwb_file, stimulus_name)

            if stimulus_name in self.STIMULUS_TABLE_TYPES['abstract_feature_series']:
                datasets = h5_utilities.load_datasets_by_relnames(
                    ['data', 'features', 'frame_duration'], nwb_file, stimulus_group)
                return _make_abstract_feature_series_stimulus_table(
                    datasets['data'], h5_utilities.decode_bytes(datasets['features']), datasets['frame_duration'])

            if stimulus_name in self.STIMULUS_TABLE_TYPES['indexed_time_series']:
                datasets = h5_utilities.load_datasets_by_relnames(['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_indexed_time_series_stimulus_table(datasets['data'], datasets['frame_duration'])

            if stimulus_name in self.STIMULUS_TABLE_TYPES['repeated_indexed_time_series']:
                datasets = h5_utilities.load_datasets_by_relnames(['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_repeated_indexed_time_series_stimulus_table(datasets['data'], datasets['frame_duration'])

            if stimulus_name == 'spontaneous':
                datasets = h5_utilities.load_datasets_by_relnames(['data', 'frame_duration'], nwb_file, stimulus_group)
                return _make_spontaneous_activity_stimulus_table(datasets['data'], datasets['frame_duration'])

        raise IOError("Could not find a stimulus table named '%s'" % stimulus_name)
예제 #3
0
def test_decode_bytes():

    inp = np.array([b'a', b'b', b'c'])
    obt = h5_utilities.decode_bytes(inp)

    assert(np.array_equal( obt, ['a', 'b', 'c'] ))
예제 #4
0
def test_decode_bytes():

    inp = np.array([b'a', b'b', b'c'])
    obt = h5_utilities.decode_bytes(inp)

    assert (np.array_equal(obt, ['a', 'b', 'c']))