nsamples function

Generic function for extracting the number of posterior samples