def _allocate_data(data, data_buffer, data_shape, dtype):
 if (data is None):
  if isinstance(data_buffer, string_types):
   data = np.memmap(data_buffer, mode='w+', dtype=dtype, shape=data_shape)
  else:
   data = np.zeros(data_shape, dtype=dtype)
 return data

def _allocate_data ( data , data_buffer , data_shape , dtype ) : if ( data is None ) : if isinstance ( data_buffer , string_types ) : data = np . memmap ( data_buffer , mode = 'w+' , dtype = dtype , shape = data_shape ) else : data = np . zeros ( data_shape , dtype = dtype ) return data
allocate data in memory or in memmap for preloading .