code for subject's session date range according to cycle