def test_basic_construction_binder(): buffer, data = _create_binder(axis=1) map_source = MappedSource(buffer) shape = data.shape assert map_source.shape == shape, 'Shape wrong' assert map_source.binary_channel_mask.sum( ) == shape[0], 'Wrong number of active channels' # repeat for transpose map_source = MappedSource(buffer, transpose=True) assert map_source.shape == shape[::-1], 'Shape wrong in transpose' assert map_source.binary_channel_mask.sum( ) == shape[1], 'Wrong number of active channels in transpose'
def test_basic_construction(): aux_arrays = ('test1', 'test2') buffer, data = _create_buffer(aux_arrays=aux_arrays) # hacky way to get h5py.File object... hdf = buffer.file_array.file aligned = dict([(k, HDF5Buffer(hdf[k])) for k in aux_arrays]) map_source = MappedSource(buffer, aligned_arrays=aligned) shape = data.shape assert map_source.shape == shape, 'Shape wrong' assert map_source.binary_channel_mask.sum( ) == shape[0], 'Wrong number of active channels' for field in aux_arrays: assert hasattr(map_source, field), 'Aux field {} not preserved'.format(field) assert getattr( map_source, field ).shape[1] == shape[1], 'aligned field {} wrong length'.format(field) # repeat for transpose map_source = MappedSource(buffer, aligned_arrays=aligned, transpose=True) assert map_source.shape == shape[::-1], 'Shape wrong in transpose' assert map_source.binary_channel_mask.sum( ) == shape[1], 'Wrong number of active channels in transpose'