adding logarithm logic to subsampling