do out.write(data) just if enough samples