add function to extract time course