getSamples function

Get samples from a study