code duplicates cell densities in each direction for small file